脚本之家,脚本语言编程技术及教程分享平台!
分类导航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|shell|

服务器之家 - 脚本之家 - shell - nagios 分发文件实现代码

nagios 分发文件实现代码

2023-02-20 14:03脚本之家 shell

这篇文章主要介绍了nagios 分发文件实现代码,需要的朋友可以参考下

Nagios是一款开源的免费网络监视工具,能有效监控Windows、Linux和Unix的主机状态,交换机路由器等网络设置,打印机等。在系统或服务状态异常时发出邮件或短信报警第一时间通知网站运维人员,在状态恢复后发出正常的邮件或短信通知。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/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

 

延伸 · 阅读

精彩推荐