用什么自动推送nagios client脚本
来自:网络#!/usr/bin/python2.6 nagios培训
fromfabric.apiimport*
fromfabric.colorsimport* nagios实施
fromfabric.context_managersimport*
user='ec2-user'
hosts=[ 'bidder1' , 'bidder2' , 'bidder3' , 'bidder4' , 'bidder5' , 'bidder6' , 'bidder7' , 'bidder8' ] 监控软件
# hosts = ['bidder1',]
@task
defput_task():
printyellow( "Put Local File to remote" )
with settings(warn_only = True ):
put( "/home/ec2-user/check_cpu_utili.sh" , "/home/ec2-user/check_cpu_utili.sh" ) nagios配置
sudo( "cp /home/ec2-user/check_cpu_utili.susr/local/nagios/libexec" )
sudo( "chown nagios:nagios /usr/local/nagios/libexec/check_cpu_utili.sh" )
sudo( "chmod +x /usr/local/nagios/libexec/check_cpu_utili" )
sudo( "kill -9 `ps aux | grep nrpe | head -n1 | awk '{print $2}' `" )
sudo( "/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d" ) printgreen( "Put File success and restart nagios nrpe service!" ) 开源监控软件
forhostinhosts:
env.host_string=host nagios安装
put_task()
#put_task()
想做Nagios, Zabbix,Cacti,iTop各种交流的,可以进入开源监控工具Nagios交流QQ群号 :476809427
页:
[1]