ssh and output

Demetri Mouratis dmourati at cm.math.uiuc.edu
Thu Aug 28 17:59:26 CEST 2003


Lena,

You should look at the check_by_ssh command.  It will do exactly what you
want.

Here's an example:

# 'check_remote_disk' command definition
define command{
        command_name    check_remote_disk
        command_line    $USER1$/check_by_ssh -t 60 -H $HOSTADDRESS$ -l \
	 nagios -i $USER5$ -C "$USER6$/check_disk -w $ARG1$ -c $ARG2$"
        }

# from resource.cfg
$USER5$=/home/nagios/.ssh/id_dsa
$USER6$=/home/nagios/bin

Also, check our ssh-keygen to create a public/private keypair for the
nagios user to permit passwordless logins.

Finally, take a look at keychain,
http://www.gentoo.org/proj/en/keychain.xml, for non-blank ssh passphrases.

HTH.

On Thu, 28 Aug 2003, Lena M wrote:

> Hello, All,
>
> My name is Lena, and I'm new to the list.
>
> I'm having a problem with nagios displaying output of the commands it runs over ssh. I hope you can help me solve it.
>
> For instance, when I run the following from a command prompt of my monitoring host, I get an output:
> -bash-2.05b$  /usr/bin/ssh redhat1  /usr/local/nagios/check_disk -w 3 -c 1 /dev/hda1
>
> DISK OK [1058016 kB (20%) free on /dev/hda1]
>
> However, nagios displays "Current Status: Unknown" and "Status information: No output!" in its web page when it runs the same command.
>
> I tried using different ssh commands but..the same result. Both hosts have redhat 8.0 and nagios 1.1 installed. Your help will be greatly appreciated.
>
> Here is configuration info from nagios files:
>
> checkcommands.cfg
>
> define command{
>
>         command_name    ssh-2check-users
>
>         command_line    /usr/bin/ssh redhat1 /usr/local/nagios/check_users -w 3 -c 1
>
>         }
>
> services.cfg
>
> define service{
>
>         use                             generic-service         ; Name of service template to use
>
>
>
>         host_name                       redhat1
>
>         service_description             FREE DISK SPACE
>
>         is_volatile                     0
>
>         check_period                    24x7
>
>         max_check_attempts              3
>
>         normal_check_interval           5
>
>         retry_check_interval            2
>
>         contact_groups                  redhat-admins
>
>         notification_interval           240
>
>         notification_period             24x7
>
>         notification_options            w,u,c,r
>
>         check_command                   ssh-2check-disk!80%!90%!/dev/hda1
>
>
>
> Web Output:
>
> Service State Information
>
>                   Current Status:
>                    UNKNOWN
>
>                   Status Information:
>                  (No output!)
>
>                   Current Attempt:
>                  3/3
>
>                   State Type:
>                  HARD
>
>                   Last Check Type:
>                  ACTIVE
>
>                   Last Check Time:
>                  08-28-2003 11:16:23
>
>                   Status Data Age:
>                  0d 0h 0m 32s
>
>                   Next Scheduled Active Check:
>                  08-28-2003 11:21:23
>
>                   Latency:
>                  < 1 second
>
>                   Check Duration:
>                  1 second
>
>                   Last State Change:
>                  08-28-2003 10:43:52
>
>                   Current State Duration:
>                  0d 0h 33m 3s
>
>                   Last Service Notification:
>                  08-28-2003 10:43:52
>
>                   Current Notification Number:
>                  1
>
>                   Is This Service Flapping?
>                  N/A
>
>                   Percent State Change:
>                  N/A
>
>                   In Scheduled Downtime?
>                    NO
>
>                   Last Update:
>                  08-28-2003 11:16:43
>
>
>
>
>
>                   Service Checks:
>                    ENABLED
>
>                   Passive Checks:
>                    ENABLED
>
>                   Service Notifications:
>                    ENABLED
>
>                   Event Handler:
>                    ENABLED
>
>                   Flap Detection:
>                    ENABLED
>
>
>
>
>
>
>
>
>
>
>
>
>

---------------------------------------------------------------------
Demetri Mouratis
dmourati at linfactory.com



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
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