Nagios is an open source free network monitoring tool, can effectively monitor Windows, Linux and UNIX host State, switch routers and other network settings, printers and so on. When the system or service status is abnormal, send an email or SMS alert the first time to notify the site operators, in the state of recovery after the normal mail or SMS notification.
#!/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;
#spawn $cmd 4;
Set timeout;
Spawn $cmd 3; Set timeout 20; #spawn $cmd 2;
Set timeout 1200; #expect "*@*"; send \ "$cmd 1\r exit\r\";; Expect EOF; "If [$i-eq 145]
then
i=151 fi done