Check_by_ssh configuration in nagios

– First you need to configure ssh password less authentication.
– Then configure nagios accordantly.

Setup password less authentication:-

Let Nagios server: – and
       Target server:-

Step 1: Create Authentication SSH-Kegen Keys on – (

# ssh-keygen -t rsa

This will generate a pair of public keys.

Step 2: Create .ssh Directory on

#ssh nagios@ mkdir -p .ssh

Step 3: Upload Generated Public Keys to –

#cat .ssh/ | ssh nagios@ ‘cat >> .ssh/authorized_keys’

Step 4: Set Permissions on –

#ssh nagios@ “chmod 700 .ssh; chmod 640 .ssh/authorized_keys”

Step 5: Login from to Server without Password

#ssh nagios@

Configure nagios for check_by_ssh.

– 1st you check required plug-in are present or not in bellow location if not then install 1st.


– after that create command in “commands.cfg” (/usr/local/nagios/etc/objects/)

define command{
command_name check_remote_procs
command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ -t 60 -l nagios -C “/home/nagios/check_procs -C $ARG1$ -w 1:20 -c 1:50”

– copy required plug-in or script on target server. In this example I use “check_procs” plug-in and copy in “/home/nagios”.

[nagios@localhost ~]$ ll /home/nagios/
total 96
-rwxr-xr-x 1 nagios nagios 89660 Jul 18 10:30 check_procs

– After that add new check in “linux.cfg” or main check file.

define service{
use local-service ; Name of service template to use
host_name cntos
service_description Process
check_command check_remote_procs!httpd

save and reload nagios service.

#/etc/init.d/nagios reload

after some resubmit it’s ok

– Cross check you’re plug-in by bellow command.

[nagios@localhost ~]$ /usr/local/nagios/libexec/check_by_ssh -H -t 60 -l nagios -C “/home/nagios/check_procs -C httpd -w 1:20 -c 1:50”

PROCS OK: 9 processes with command name ‘httpd’

Leave a Reply