Nagios distribution file Implementation code _linux shell

Source: Internet
Author: User

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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.