Skip to content

Commit

Permalink
nrpe
Browse files Browse the repository at this point in the history
  • Loading branch information
ppabc committed Jan 13, 2017
1 parent 892b876 commit 92d8e0d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ansible/ansible_nagios_em2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
## ansible_nagios_em2 2017-01-13
## http://www.aqzt.com
## email: [email protected]
## robert yu
## centos 6

ps -ef | grep 'nagios' | grep 'nrpe' | grep -v 'grep' | awk '{print $2}' | xargs kill
num1=`cat /usr/local/nagios/etc/nrpe.cfg |grep -v "#" |grep em2 | grep public123 | awk -F ' ' '{print $11}' | awk -F ',' '{print $2}'`
num2=`cat /usr/local/nagios/etc/nrpe.cfg |grep -v "#" |grep em2 | grep public123 | awk -F ' ' '{print $11}'`
num5=`cat /usr/local/nagios/etc/nrpe.cfg |grep -v "#" |grep em2 | grep public123 | awk -F ' ' '{print $13}' | awk -F ',' '{print $2}'`
num6=`cat /usr/local/nagios/etc/nrpe.cfg |grep -v "#" |grep em2 | grep public123 | awk -F ' ' '{print $13}'`
var1=`expr $num1 + 10000`
var2=`expr $num5 + 10000`
echo "w=$num1 c=$num5"
echo "w=$var1 c=$var2"
sed -i "s/-w $num2/-w $var1,$var1/g" /usr/local/nagios/etc/nrpe.cfg
sed -i "s/-c $num6/-c $var2,$var2/g" /usr/local/nagios/etc/nrpe.cfg
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
18 changes: 18 additions & 0 deletions ansible/ansible_nagios_ss.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
## ansible_nagios_ss 2017-01-13
## http://www.aqzt.com
## email: [email protected]
## robert yu
## centos 6

ps -ef | grep 'nagios' | grep 'nrpe' | grep -v 'grep' | awk '{print $2}' | xargs kill
num1=`cat /usr/local/nagios/etc/nrpe.cfg |grep -v "#" |grep check_ss | grep nagios | awk -F ' ' '{print $2}'`
num2=`cat /usr/local/nagios/etc/nrpe.cfg |grep -v "#" |grep check_ss | grep nagios | awk -F ' ' '{print $2}'`
num5=`cat /usr/local/nagios/etc/nrpe.cfg |grep -v "#" |grep check_ss | grep nagios | awk -F ' ' '{print $3}'`
num6=`cat /usr/local/nagios/etc/nrpe.cfg |grep -v "#" |grep check_ss | grep nagios | awk -F ' ' '{print $3}'`
var1=`expr $num1 + 2000`
var2=`expr $num5 + 2000`
echo "w=$num1 c=$num5"
echo "w=$var1 c=$var2"
sed -i "s/check_ss.sh $num1 $num5/check_ss.sh $var1 $var2/g" /usr/local/nagios/etc/nrpe.cfg
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

0 comments on commit 92d8e0d

Please sign in to comment.