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 is Ok \n', ' OK 1 Memory module 1 is Ok \n', ' OK 2 Memory module 2 is Ok \n', ' OK 3 Memory module 3 is Ok \n', ' OK 4 Memory module 4 is Ok \n', ' OK 5 Memory module 5 is Ok \n', ' OK 6 Memory module 6 is Ok \n', ' OK 7 Memory module 7 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后面就是页面的展示了uploads/space/2015/0715/110231_wa36_1790313.png
想做Nagios, Zabbix,Cacti,iTop各种交流的,可以进入开源监控工具Nagios交流QQ群号 :476809427
页:
[1]