开发nagios插件监控/etc/passwd中文件变化
生活随笔
收集整理的這篇文章主要介紹了
开发nagios插件监控/etc/passwd中文件变化
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
環(huán)境:
nagios客戶端:centos6.5
[root@long63 nagios]# uname -r 2.6.32-431.el6.x86_64 [root@long63 nagios]# ifconfig eth0|grep "inet addr"|awk -F '[ :]' '{print $13}' 192.168.200.63nagios服務(wù)端:centos6.5?
[root@long62 /]# uname -r 2.6.32-431.el6.x86_64 [root@long62 nagios]# ifconfig eth0|grep "inet addr"|awk -F '[ :]' '{print $13}' 192.168.200.62操作步驟:
第一步:【客戶端】開發(fā)腳本,并授權(quán)腳本
[root@long63 libexec]# cat check_md5_ps #!/bin/sh PROGNAME=`basename $0` PROGPATH=`dirname $0` . $PROGPATH/utils.sh OriMD5="d6f7ff0f80e82d8288cfb53f1be07808" CurrMd5=`md5sum /etc/passwd|cut -c 1-32` if [ "$OriMD5" == "$CurrMd5" ]thenecho "/etc/passwd:OK"exit 0 elseecho "/etc/passwd:flase"exit 2 fi[root@long63 libexec]# chmod 755 check_md5_ps
第二步:【客戶端】在nrpe.cfg里面添加一行
command[check_md5]=/usr/local/nagios/libexec/check_md5_ps
第三步:【客戶端】重啟nrpe
[root@long63 libexec]# ps -ef|grep nrpe nagios 4258 1 0 08:24 ? 00:00:00 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d root 4262 4133 0 08:25 pts/0 00:00:00 grep nrpe [root@long63 libexec]# pkill nrpe [root@long63 libexec]# ps -ef|grep nrpe root 4265 4133 0 08:25 pts/0 00:00:00 grep nrpe [root@long63 libexec]# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d [root@long63 libexec]# ps -ef|grep nrpe nagios 4267 1 0 08:25 ? 00:00:00 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d root 4269 4133 0 08:25 pts/0 00:00:00 grep nrpe
第四步【服務(wù)端】services.cfg里面添加服務(wù)
define service{use generic-servicehost_name 063-client01check_command check_nrpe!check_md5service_description md5_etc_passwdmax_check_attempts 3normal_check_interval 10retry_check_interval 2contact_groups adminsnotification_options w,u,c,rnotification_interval 60notification_period 24x7check_period 24x7 }
第五步:【服務(wù)端】重啟nagios服務(wù)
[root@long62 services]# /etc/init.d/nagios checkconfig Running configuration check... OK. [root@long62 services]# /etc/init.d/nagios reload Running configuration check...done. Reloading nagios configuration...done結(jié)果驗(yàn)證
轉(zhuǎn)載于:https://www.cnblogs.com/quanag/p/9137900.html
總結(jié)
以上是生活随笔為你收集整理的开发nagios插件监控/etc/passwd中文件变化的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: EXP1 PC平台逆向破解
- 下一篇: ROStopic 通信方式