重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
1.nagios 启动(root身份)
慈利ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联建站的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:13518219792(备注:SSL证书合作)期待与您的合作!
/etc/init.d/nagios restart
(/etc/init.d/xinetd restart 重启nsca,用于接收客户端的数据,端口为5667,接收数据出现问题时,需要重启)
2.nagios 配置文件编辑
(su - nagios编辑)
1)/usr/local/nagios/etc/objects/hostgroups.cfg中定义hostgroup,有时禁用host,需要在这里把相应主机注释掉
define hostgroup{
hostgroup_name NETWORK-DEVICE Group
alias NETWOKR_DEVICE
members FW01
}
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