#!/usr/bin/python2.6 nagios培训
from fabric.api import *
from fabric.colors import * nagios实施
from fabric.context_managers import *
user = 'ec2-user'
hosts = [ 'bidder1' , 'bidder2' , 'bidder3' , 'bidder4' , 'bidder5' , 'bidder6' , 'bidder7' , 'bidder8' ] 监控软件
# hosts = ['bidder1',]
[ /u/874748]@task[/url]
def put_task():
print yellow( "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" ) print green( "Put File success and restart nagios nrpe service!" ) 开源监控软件
for host in hosts:
env.host_string = host nagios安装
put_task()
#put_task()
想做Nagios, Zabbix,Cacti,iTop各种交流的,可以进入开源监控工具Nagios交流 QQ群号 :476809427
|