IT运维流程库历史主题 · 只读
← 返回目录

Dell-OMSA监控设备硬件,整合nagios*

来自:网络


27 cat check_memory_module.py #!/usr/bin/python2.7 # -*- coding:utf-8 -*- """ CHECK DELL SERVER --> Memory module author jastme """ import commands,os,sys def Memory_module(): Memory=commands.getoutput('cat /tmp/Dell_Hardware_Detail.txt | grep Memory') Memory_num=commands.getoutput('cat /tmp/Dell_Hardware_Detail.txt | grep Memory | wc -l') l=[] NUM=0 for i in Memory.split('\n'): l.append(' '.join(i.split('|'))+' \n') if 'OK' in i and 'Ok' in i: NUM=NUM+1 if int(NUM) == int(Memory_num): print '%s | Status = %sOK;' %(l,NUM) sys.exit(0) else: print '%s | Status = %sOK;' %(l,NUM) sys.exit(2) if __name__ == '__main__': Memory_module() ? 1 2 ./check_memory_module.py [' OK 0 Memory module 0 [DIMM_A1, 16384 MB] is Ok \n', ' OK 1 Memory module 1 [DIMM_A2, 16384 MB] is Ok \n', ' OK 2 Memory module 2 [DIMM_A3, 16384 MB] is Ok \n', ' OK 3 Memory module 3 [DIMM_A4, 16384 MB] is Ok \n', ' OK 4 Memory module 4 [DIMM_A5, 16384 MB] is Ok \n', ' OK 5 Memory module 5 [DIMM_A6, 16384 MB] is Ok \n', ' OK 6 Memory module 6 [DIMM_A7, 16384 MB] is Ok \n', ' OK 7 Memory module 7 [DIMM_A8, 16384 MB] is Ok \n'] | Status = 8OK; ##############################################################################################
以上就是全部的代码
?
1 2 3 为nagios用户创建cron #dell */5 * * * * /data/program/nagios-client/libexec/Get_Dell_Server_Detail.py 每5分钟搜集一次系统状态 然后启动nrpe
后面就是页面的展示了
然后启动nrpe
后面就是页面的展示了


想做Nagios, Zabbix,Cacti,iTop各种交流的,可以进入开源监控工具Nagios交流 QQ群号 :476809427