works from command line fails from web

Dan McManus mothbitten1 at yahoo.com
Thu Jan 8 23:54:27 CET 2009


What happens if you hard code the IP address of whatever host "turing" is in the command definition?



----- Original Message ----
From: Lois Bennett <nagios at loisbennett.com>
To: Marc Powell <marc at ena.com>; Nagios Users <nagios-users at lists.sourceforge.net>
Sent: Thursday, January 8, 2009 3:04:44 PM
Subject: Re: [Nagios-users] works from command line fails from web

Alright I put it back to being run as nagios.  I had tried that
because our old server ran as root. and  I have a perl script I run on
the old one that is failing to connect to mysql when it is run as
nagios but that is a different problem I think.  As nagios both
check_dns and check_simap run successfully on the command line:

when I run as the nagios user from the command line this is what I get:

root #  su - nagios -c  "/opt/TWWfsw/nagiosserver30/libexec/check_dns
-H coffee.bwh.harvard.edu -s turing --timeout=25"
DNS ok - 0 seconds response time, Address(es) is/are 134.174.249.54

root #  su - nagios -c
"/opt/TWWfsw/nagiosserver30/libexec/check_simap -H turing -p 993"
SIMAP OK - 0.038 second response time on port 993 [* OK [CAPABILITY
IMAP4REV1 LITERAL+ SASL-IR LOGIN-REFERRALS AUTH=PLAIN AUTH=LOGIN]
turing IMAP4rev1 2006c.374 at Thu, 8 Jan 2009 14:26:56 -0500
(EST)]|time=0.038170s;;;0.000000;10.000000

In nagios on the web I get these errors.
    
DNS CRITICAL - '/usr/sbin/nslookup' output parsing exited with no address
IMAPS  Connection refused

The commands are :
define command{
    command_name    check_dns
    command_line    $USER1$/check_dns -H coffee.bwh.harvard.edu -s
$HOSTADDRESS$ --timeout=25
    }
define command{
        command_name    check_simap
        command_line    $USER1$/check_simap -H $HOSTADDRESS$ -p 993
        }

from resource.cfg:
# Sets $USER1$ to be the path to the plugins
$USER1$=/opt/TWWfsw/nagiosserver30/libexec

The services:
#turing service template
define service{
    host_name            turing
    normal_check_interval        5
    retry_check_interval        1
    name                turing-service-template
    use                generic-service
        register                        0               ; DONT REGISTER THIS
DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
    }

define service{
    use                turing-service-template
    service_description        DNS
    check_command            check_dns
    }

define service{
    use                turing-service-template
    service_description        IMAPS
    check_command            check_simap
    }

the versions of those plugins are

check_dns (nagios-plugins 1.3.1) 1.8.2.3
check_simap v1991 (nagios-plugins 1.4.12)

I downgraded check_dns from the old server because the new one
(check_dns v1992) kept dumping core.

Except for the mysql problem I have other services running fine.  ssh
and nrpe checking disk space and load and the presece of certain
processes on remote machines.

Where do I look now?

Thanks!

On Thu, Jan 8, 2009 at 1:38 PM, Marc Powell <marc at ena.com> wrote:
>
> On Jan 8, 2009, at 12:01 PM, Lois Bennett wrote:
>
>> Hi
>> I am using Nagios 3.0.3 on a Solaris 8 box. (Solaris 10 will come soon
>> to this box.)
>>
>> I am moving and upgrading my nagios server.  It has been going pretty
>> well until now. Two of my check modules work fine when invoked from
>> the command line but fail when called by nagios. check_dns and
>> check_simap.
>>
>> I tested that they run in sh with no path set as root.
>
> Nagios does not run as root. Test as the nagios user and you'll likely
> see different results.
>
>>  I set nagios to run as root but that has not solved my problem.
>
> You should never do this.
>
>> here is the command line output:
>> # /opt/TWWfsw/nagiosserver30/libexec/check_dns -H
>> coffee.bwh.harvard.edu -s turing --timeout=25
>> DNS ok - 0 seconds response time, Address(es) is/are 134.174.249.54
>
>>
>> # /opt/TWWfsw/nagiosserver30/libexec/check_simap -H turing -p 993
>> SIMAP OK - 0.039 second response time on port 993 [* OK [CAPABILITY
>> IMAP4REV1 LITERAL+ SASL-IR LOGIN-REFERRALS AUTH=PLAIN AUTH=LOGIN]
>> turing IMAP4rev1 2006c.374 at Thu, 8 Jan 2009 12:40:17 -0500
>> (EST)]|time=0.038972s;;;0.000000;10.000000
>>
>>
>> the errors in nagios are
>> DNS CRITICAL - '/usr/sbin/nslookup' output parsing exited with no
>> address
>> IMAPS Connection refused
>
> I'd say either you'll see different results when testing as the nagios
> user which will probably provide more direction or the commands being
> run by nagios are not the same as what you're testing. Please post the
> service{} and command{} definitions for these if your testing as the
> nagios user is successful.
>
> --
> Marc
>
>
> ------------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It is the best place to buy or sell services for
> just about anything Open Source.
> http://p.sf.net/sfu/Xq1LFB
> _______________________________________________
> 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
>

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
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



      

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
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