Remote modification of the Nrpe script preface: As an O & M personnel, frequent modification of monitoring is inevitable. It is better to change a small number of machines, if the amount is too large, it will not be easy. As the boss said, it would be silly to modify the check_disk parameter of all machines. I met today. I wrote a script to modify the check_swap of all business systems for your reference. Two files: www.2cto.com 1. hostlist: host file for modifying monitoring parameters; 2. editnrpe. sh: This is my script. When executing the script, you need to call file 1; 3. scannrpe. sh: after the modification, I will scan the Nrpe script file. The following script implements the following functions. The previous Nrpe parameter is: command [check_swap] =/usr/local/nagios/libexec/check_swap-w 80%-c 70%: command [check_swap] =/usr/local/nagios/libexec/check_swap-w 75%-c 65% Script: [only.liu@l-rtools1.ops.cn1 ~] $ Cat editnrpe. sh #! /Bin/bash # This script is auto edit Nrpe # By Only. liu swapfile = "/usr/local/nagios/etc/nrpe. cfg "for host in 'cat hostlist' do ping-c 1 $ host >>/ dev/null 2> & 1 if [" $? "= 0]; then echo" $ host is alived! "Ssh $ host" sudo sed-I-e '/check_swap/{s/\-w 80 \ %/\-w 75 \ % /; s/-c 70 \ %/-c 65 \ %/} ''$ swapfile '" if ["$? "= 0]; then echo" Swap is edited success! "Ssh $ host" grep "check_swap" $ swapfile "fi ssh $ host" ps aux | grep nrpe | grep-v grep | awk '{print \ $2}' | xargs sudo kill-HUP "ssh $ host" exit "echo" Nrpe restart OK! "Fidone after modification, don't worry, then scan: script is as follows: www.2cto.com [only.liu@l-rtools1.ops.cn1 ~] $ Cat scannrpe. sh #! /Bin/bash # This script is auto edit Nrpe # By Only. liu # hostlist = 'cat hostlist' swapfile = "/usr/local/nagios/etc/nrpe. cfg "for host in 'cat hostlist' do ping-c 1 $ host >>/ dev/null 2> & 1 if [" $? "= 0]; then echo" $ host is alived! "Ssh $ host" sudo sed-n'/check_swap/P' $ swapfile '"fidone