Check_mk provides a nice way to migrate your old NRPE based checks into Check_mk using MRPE
Although the documentation of MRPE is very comprehensive but today I messed the whole day with small issue.
I had written small script which can connect to another host by ssh and collect some facts. The problem started when I was using the same command two times with different parameters.
e.g. check my mrpe.cfg
The whole issue was in the script test.sh I have used ssh to connect to remote host and which is causing the issue.
To fix this need to append the
Although the documentation of MRPE is very comprehensive but today I messed the whole day with small issue.
I had written small script which can connect to another host by ssh and collect some facts. The problem started when I was using the same command two times with different parameters.
e.g. check my mrpe.cfg
so despite I have defined two services , check_mk_agent is recongnizing only one,[root@appmon2 tmp]# cat mrpe.cfg### Just a TestTEST1 ./test.sh ALLTEST2 ./test.sh COLO
[root@tiber tmp]# check_mk_agent
<<>>
(test.sh) TEST1 0 OK: ALL is Green
The whole issue was in the script test.sh I have used ssh to connect to remote host and which is causing the issue.
To fix this need to append the
[root@tiber tmp]# diff test.sh test1.sh
52,53c52
< ssh root@$HA $command >> /tmp/juned.txt
---
>
> /tmp/juned.txt
And now check_mk_agent is happy
<<>> (test.sh) TEST1 0 OK: ALL is Green(test.sh) TEST2 0 OK: app is Green
Edit : 2 July 2015
Once again messed with the same issue, and found that if you are using ssh inside mrpe its always advisable to Close stdin. to avoid the issue.
So in the function where you using the ssh command on remote host add <&- after the closing }.
e.g.
function execute_command {
ssh root@$SRV $command >> /tmp/out.txt
if [ $? -eq 0 ]; then
msg="Green"
sstatus=0
else
msg="Critical: Red"
sstatus=2
fi
}<&-
No comments:
Post a Comment