时间:2021-02-15 10:22:50 | 栏目:Shell | 点击:次
Nagios是一款开源的免费网络监视工具,能有效监控Windows、Linux和Unix的主机状态,交换机路由器等网络设置,打印机等。在系统或服务状态异常时发出邮件或短信报警第一时间通知网站运维人员,在状态恢复后发出正常的邮件或短信通知。
#!/bin/bash #!/usr/bin/expect -f #!/usr/bin/env bash for((i=101;i<=177;i++)) do #cmd="wget http://172.16.92.99/scripts/nagios_client_install.sh && chmod 777 nagios_client_install.sh && sh nagios_client_install.sh" line="192.168.89.$i" cmd1="/etc/init.d/xinetd restart" cmd2="ssh root@$line" cmd3="scp -r ./nagios/libexec $line:/usr/local/nagios" cmd4="scp ./nagios/nrpe.cfg $line:/usr/local/nagios/etc/" expect -c "#set timeout 20; #spawn $cmd4; set timeout 200; spawn $cmd3; set timeout 20; #spawn $cmd2; set timeout 1200; #expect "*@*";send \"$cmd1\r exit\r\";; expect eof;" if [ $i -eq 145 ] then i=151 fi done