Monitor Linux-server via SSH


#1

How can i monitor my linux servers via SSH.
I only find that’s it possible but i can’t find any documentation.


#2

Monitoring Linux servers remotely:
nagios.sourceforge.net/docs/3_0/ … linux.html
(Be aware of the overhead in using check_by_ssh)
Check_by_ssh man page:
nagiosplugins.org/man/check_by_ssh


#3

I decided to use nrp for my linux hosts. Works great!
I need only check_by_ssh for my hp-ux server.
I configured ssh login without password.
So, when i start following command from nagios server, it returnes the status.

./check_by_ssh nagios -H hp-ux-02 -C '/msp/home/nagios/nagios/libexec/check_users -w 7 -c 10’
USERS CRITICAL - 11 users currently logged in |users=11;7;10;0

When i try to configure it in nagios configuration i recieve that my syntax is wrong. "Usage:check_users -w -c "

define command{
command_name check_local_users
command_line $USER1$/check_users -w $ARG1$ -c $ARG2$
}

define service{
use generic-service
host_name hp-ux-02
service_description check_users
check_command check_by_ssh!’/msp/home/nagios/nagios/libexec/check_users’!200!500
}

What am i doing wrong?

Thanks in advance

Tom


#4

Well, the thing is that you copied the command definition for “check_local_users” whereas you’re using check_by_ssh

define command{
command_name check_local_users
command_line $USER1$/check_users -w $ARG1$ -c $ARG2$
}

define service{
use generic-service
host_name hp-ux-02
service_description check_users
check_command check_by_ssh!’/msp/home/nagios/nagios/libexec/check_users’!200!500
}

Maybe you should check that the command definition for check_by_ssh is correctly written
(i’d say:
define command{
command_name check_by_ssh
command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ -C $ARG1$ -w $ARG2$ -c $ARG3$
}
)


#5

Thanks you very mutch. I forgot the -w and -c in my check_by_ssh command.

I decided to alter my config i create my seperate check_by_ssh commands, makes it easier in my situation.
This also works great.

‘check_ssh_users’ command definition

define command{
command_name check_ssh_users
command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ -C “$USER1$/check_users -w $ARG1$ -c $ARG2$”
}
define service{
use generic-service
host_name hp-ux-02
service_description check_users
check_command check_ssh_users!480!500
}

Nagios is a super tool !!!