Plugin to grep command output - Not working with SSH
Posted: Mon Mar 31, 2014 6:32 pm
Hi guys,
Hope someone can help, so I don't know everything about linux systems, as I've only had to interact with them for this job, but I know enough to get by. Let me explain the scenario.
We have come into a situation where we need to be able to monitor the states of degraded virtual disks within OnApp VM's within a cloud. This can be done by running a "getdegradedvdisks" command from the OnApp API on each HyperVisor within the cloud, but due to the number of Hypervisors, this is not possible to do full scale. So we set up access via SSH Keys for the Control Server in the cloud to be able to ssh into the Hypervisors. Now from the control server in each cloud we simply run:
# ssh root@10.10.21.123 getdegradedvdisks
And it returns the output for the hypervisor at that private IP.
grepping that for a specific string is simple, and the string "VDisks:" can be used to single out lines where degraded vdisks are present, so thats perfectly fine. The issue comes from getting Nagios to run that and grep the output and return exit states based on it.
I've come across the following plugin:
http://exchange.nagios.org/directory/Pl ... ut/details
Which on the face of it should work perfectly (with a little modifying of output states etc, nothing hard)... But...
It doesnt. I've tried running it locally on the HV's with a simple command, giving it /usr/bin/tail for example, and a parameter of /var/log/messages then giving it a --critical value of "snmpd" for exmaple, will return critical output state if tailing the messages log contained an snmpd error.
Now I go full prooduction on it and give it /usr/bin/ssh, a parameter of root@10.10.... etc and give it the --critical value of "VDisks:" as previously mentioned, and it does, nothing. Infact it locks my SSH session in putty, I can't brak the operation or anything, I have to close the session and make a new one, lol... Which is strange. It seems the plugin just doesnt like SSH'ing to another machine, i cant see why thsi should be an issue though, it should just work.
Any ideas? I've also tried eliminating the parameter addition, and just putting the whole ssh command into the --command variable, if i do this, the check seemingly does not execute, it just drops the console to a new line, no output from the plugin at all, no errors, no usage instructions, ntohing, just drops a line.
Help a nagios noob out? Cheers all in advance,
Dave.
Hope someone can help, so I don't know everything about linux systems, as I've only had to interact with them for this job, but I know enough to get by. Let me explain the scenario.
We have come into a situation where we need to be able to monitor the states of degraded virtual disks within OnApp VM's within a cloud. This can be done by running a "getdegradedvdisks" command from the OnApp API on each HyperVisor within the cloud, but due to the number of Hypervisors, this is not possible to do full scale. So we set up access via SSH Keys for the Control Server in the cloud to be able to ssh into the Hypervisors. Now from the control server in each cloud we simply run:
# ssh root@10.10.21.123 getdegradedvdisks
And it returns the output for the hypervisor at that private IP.
grepping that for a specific string is simple, and the string "VDisks:" can be used to single out lines where degraded vdisks are present, so thats perfectly fine. The issue comes from getting Nagios to run that and grep the output and return exit states based on it.
I've come across the following plugin:
http://exchange.nagios.org/directory/Pl ... ut/details
Which on the face of it should work perfectly (with a little modifying of output states etc, nothing hard)... But...
It doesnt. I've tried running it locally on the HV's with a simple command, giving it /usr/bin/tail for example, and a parameter of /var/log/messages then giving it a --critical value of "snmpd" for exmaple, will return critical output state if tailing the messages log contained an snmpd error.
Now I go full prooduction on it and give it /usr/bin/ssh, a parameter of root@10.10.... etc and give it the --critical value of "VDisks:" as previously mentioned, and it does, nothing. Infact it locks my SSH session in putty, I can't brak the operation or anything, I have to close the session and make a new one, lol... Which is strange. It seems the plugin just doesnt like SSH'ing to another machine, i cant see why thsi should be an issue though, it should just work.
Any ideas? I've also tried eliminating the parameter addition, and just putting the whole ssh command into the --command variable, if i do this, the check seemingly does not execute, it just drops the console to a new line, no output from the plugin at all, no errors, no usage instructions, ntohing, just drops a line.
Help a nagios noob out? Cheers all in advance,
Dave.