check_ssh inquiry
Marc Powell
marc at ena.com
Fri Oct 21 23:34:56 CEST 2005
> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
> admin at lists.sourceforge.net] On Behalf Of Nelson Serafica
> Sent: Friday, October 21, 2005 4:02 PM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] check_ssh inquiry
>
> How can i use ssh on nagios. It always shows:
>
> check_ssh: Port number must be a positive integer - -H
>
>
> Here is my checkcommands:
>
> # 'check_ssh' command definition
> define command{
> command_name check_ssh
> command_line $USER1$/check_ssh -H
> $HOSTADDRESS$ -p $ARG1$
> }
This command definition is expecting a single argument ($ARG1$)
corresponding to the port number to check and passed to it via the
check_command in the service definition.
> Here is my service.cfg:
>
> }
> #SSH
> define service{
> host_name HOST1
> service_description SSH
> is_volatile 0
> check_period 24x7
> max_check_attempts 3
> normal_check_interval 3
> retry_check_interval 3
> contact_groups NOC-admins
> notification_interval 60
> notification_period 24x7
> notification_options d,c,r
> check_command check_ssh! -H 192.168.0.8 -t 5
> -p 3500
> }
In this service definition, $ARG1$ is going to be ' -H 192.168.0.8 -t 5
-p 3500' which is more than just a single port number. The corresponding
command that was run by nagios looks like '/path/to/check_ssh -H
192.168.0.8 -p -H 192.168.0.8 -t 5 -p 3500', hence the error above.
This presumes that 192.168.0.8 is the address in the host definition for
HOST1.
To synthesize the command definition and the service definition to get
what I think you want you'll need something like the following --
# 'check_ssh' command definition
define command{
command_name check_ssh
command_line $USER1$/check_ssh -H $HOSTADDRESS$ -p $ARG1$ -t
$ARG2$
}
#SSH
define service{
host_name HOST1
service_description SSH
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 3
retry_check_interval 3
contact_groups NOC-admins
notification_interval 60
notification_period 24x7
notification_options c,r
check_command check_ssh!3500!5
}
Please notice that I removed 'd' from your notification options. That's
not valid for services.
In the above example, $HOSTADDRESS$ is automatically populated by
Nagios, $ARG1$ is 3500 and $ARG2$ is 5. Populated into the command
definition the result is '/path/to/check_ssh -H 192.168.0.8 -p 3500 -t
5'. You'll want to verify that any other services that use the check_ssh
command conform to this standard so that they don't break.
--
Marc
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list