nagios 平常維護

1.nagios 啓動(root身份)ios

/etc/init.d/nagios restartide

(/etc/init.d/xinetd restart 重啓nsca,用於接收客戶端的數據,端口爲5667,接收數據出現問題時,須要重啓)spa

2.nagios 配置文件編輯rest

(su - nagios編輯)xml

1/usr/local/nagios/etc/objects/hostgroups.cfg中定義hostgroup,有時禁用host,須要在這裏把相應主機註釋掉ip

 

define hostgroup{it

        hostgroup_name  NETWORK-DEVICE Groupio

        alias NETWOKR_DEVICEclass

        members  FW01sed

        }

 

 

2)/usr/local/nagios/etc/nagios.cfg (禁用主機註釋掉相應主機配置文件)

cfg_file=/usr/local/nagios/etc/objects/DB1.cfg


 


3.檢查配置,

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 用來檢查配置是否有問題,

出現這樣的說明沒問題

.........

Total Warnings: 0

Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check

再用root重啓/etc/init.d/nagios restart 



經常使用腳本


客戶端

useradd -u 2001 -s /sbin/nologin nagios

cd /usr/local

tar -xzvf nagios.tar.gz

sed -i "s/WEB2/DB3/g"  /usr/local/nagios/exe_scripts.sh  

echo "*/2 * * * * sh /usr/local/nagios/exe_scripts.sh >/dev/null 2>&1" >>/var/spool/cron/nagios

 

服務端

sed -i "s/ DB1/DB3/g"  /usr/local/nagios/etc/objects/DB3.cfg

sed -i "s/address 10.99.2.40/address 10.99.2.42/g"  /usr/local/nagios/etc/objects/DB3.cfg

相關文章
相關標籤/搜索