Page 1 of 1

Checking via SSH

Posted: Thu Jan 02, 2014 10:01 am
by BanditBBS
We have started checking some servers via ssh, and not the conventional method. we are not using the check_by_ssh method or connecting and running script installed on the remote machine. Instead, we are using this command(with ssh keys set between the servers):

Code: Select all

ssh nagios@$HOSTADDRESS$ 'bash -s' -- < $USER1$/$ARG1$ $ARG2$
And then we are using some custom scripts to do the basic disk, mem and cpu checks. Is there any issue doing checks using this method that you can think of? The checks have to be a script, can't be a compile program like the default check_mem or check_disk is the biggest issue I can think of, any others?

This group wants to use this method so the scripts don't need copied and/or updated multiple places, just the nagios server.

Re: Checking via SSH

Posted: Thu Jan 02, 2014 10:18 am
by slansing
Sounds interesting... :). You will also need to make sure you get the return output from your scripts in a valid fashion "of course," also, if your scripts may take a bit longer to execute or return the session will need to be kept open so they don't get cut off, if that makes sense. Are you going to give nagios some more sudoers rules to run these ssh based check commands? "I've not personally tested this, you may not have to."

Re: Checking via SSH

Posted: Thu Jan 02, 2014 10:21 am
by BanditBBS
As of right now, I am just checking disk, CPU and ram. CPU check is just parsing data from iostat and disk is parsing data from df. The mem check is basically doing something similar, so special perms have not been needed yet.


edited for missing the word "not"

Re: Checking via SSH

Posted: Thu Jan 02, 2014 11:28 am
by lmiltchev
I haven't tested this either, but I am going to give it a try. BanditBBS, you never run out of ideas! :D