×

扫描二维码登录本站

QQ登录

只需一步,快速开始

标签: 监控设备硬件
来自:网络


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





上一篇:Zabbix,Nagios,OneAPM Servers 安装对比
下一篇:整合nagios的Dell-OMSA监控设备硬件
monicazhang

写了 2297 篇文章,拥有财富 12859,被 21 人关注

您需要登录后才可以回帖 登录 | 立即注册
B Color Link Quote Code Smilies

成为第一个吐槽的人

手机版|小黑屋|最新100贴|论坛版块|ITIL先锋论坛 |粤ICP备11099876号|网站地图
Powered by Discuz! X3.4 Licensed  © 2001-2017 Comsenz Inc.
返回顶部