Need some help w/custom plug-in, please

Dean Bishop dbishop at ehvert.com
Fri Apr 11 15:35:24 CEST 2003


Glad I was able to help.  Actually, I am sorry I didn't notice it earlier.
I should have picked that up from your script.

Anyway, glad to hear that it is working.

Later,
dean

-----Original Message-----
From: Scott Whitney [mailto:swhitney at journyx.com] 
Sent: April 10, 2003 6:22 PM
To: Dean Bishop
Subject: Re: [Nagios-users] Need some help w/custom plug-in, please

Eureka!  You are the man.  I didn't even think of debugging it like this.

Turns out it was (as usual) a boneheaded mistake.

su - nagios, right?
<run the script>

implies environment, so "uvscan --version" runs fine.

The nagios user HAS NO PATH when running, so "/usr/local/bin/uvscan" runs
while "uvscan" complains about not knowing where it is.  *sigh*

Thanks for the help, man!

ps: you use mcAfee on Unix, you're welcome to this script.  It works, now.
;)
----- Original Message -----
From: "Dean Bishop" <dbishop at ehvert.com>
To: "'Scott Whitney'" <swhitney at journyx.com>
Sent: Thursday, April 10, 2003 3:51 PM
Subject: RE: [Nagios-users] Need some help w/custom plug-in, please


To make sure that the plugin is operating properly change the line in your
checkcommands.cfg to:

  command_line         /bin/echo "$USER1$/check_virus_dat" > /tmp/debug.txt

force the service check and then check the contents of /tmp/debug.txt

then try something like this to get the output to go to a file.  I am not
sure about the syntax here.  It might be easier to add some debugging lines
to your script.

  command_line         $USER1$/check_virus_dat 2>&1 >> /tmp/debug.txt



-----Original Message-----
From: Scott Whitney [mailto:swhitney at journyx.com]
Sent: April 10, 2003 4:45 PM
To: Dean Bishop
Subject: Re: [Nagios-users] Need some help w/custom plug-in, please

Nope.  He sits there with a warning/crit saying "No Output!"

I'm wondering if he's even hitting the check_virus_dat plugin.  It's in the
libexec dir, and everything else there runs.  I just don't get it.
----- Original Message -----
From: "Dean Bishop" <dbishop at ehvert.com>
To: "'Scott Whitney'" <swhitney at journyx.com>
Sent: Thursday, April 10, 2003 3:43 PM
Subject: RE: [Nagios-users] Need some help w/custom plug-in, please


Does Nagios receive the exit status properly?  Can you force a successful
check and see if the service turns green even though there is a (No Output!)
message?

dean

-----Original Message-----
From: Scott Whitney [mailto:swhitney at journyx.com]
Sent: April 10, 2003 4:39 PM
To: Dean Bishop
Subject: Re: [Nagios-users] Need some help w/custom plug-in, please

Yep.  Just did.

[nagios at camel libexec]$ ./check_virus_dat
Virus definitions on camel are 1086 days old. 2
[nagios at camel libexec]$ echo $?
2
[nagios at camel libexec]$

The status code is there.
----- Original Message -----
From: "Dean Bishop" <dbishop at ehvert.com>
To: "'Scott Whitney'" <swhitney at journyx.com>
Sent: Thursday, April 10, 2003 8:29 AM
Subject: RE: [Nagios-users] Need some help w/custom plug-in, please


I was thinking about this in the shower last night (best thinking is done in
the bathroom) and wondered if the status was working or not.  What I mean
is, does Nagios at least see the status code (0, 1, or 2) and turn the
service the correct colour?  Can this be run locally on the Nagios box as a
service?

What I am getting at is whether it is just the output text that is the
problem or the whole of the output status (i.e. $? Plus text).  Have you
verified the output code?

bash$ ./check_virus_dat
bash$ echo $?
[output code is here]
bash$

just thinkin'

dean

-----Original Message-----
From: Dean Bishop
Sent: April 9, 2003 1:49 PM
To: 'Scott Whitney'
Subject: RE: [Nagios-users] Need some help w/custom plug-in, please

Sorry, I don't know python.

i just created my first couple of plugins using perl and ran into the same
error.  I already sent you one suggestion that leans toward meeting the
nagios-plugins rules for development(although you will have to python-ize
it), also I found that I needed to use a linefeed on my exit text.


Sorry I couldn't be more help,

Later,
Dean


-----Original Message-----
From: Scott Whitney [mailto:swhitney at journyx.com]
Sent: April 9, 2003 1:30 PM
To: Dean Bishop
Subject: Re: [Nagios-users] Need some help w/custom plug-in, please

Not at all.  I appreciate your help with this.
----- Original Message -----
From: "Dean Bishop" <dbishop at ehvert.com>
To: "'Scott Whitney'" <swhitney at journyx.com>
Sent: Wednesday, April 09, 2003 12:24 PM
Subject: RE: [Nagios-users] Need some help w/custom plug-in, please


Would you mind sending the code to your plugin?

I just had a similar problem with a perl script and had to include the
lines:

use lib "/usr/local/nagios/libexec";
use utils qw(%ERRORS% &print_revision &support &usage);

$ENV{'PATH'}='';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';

dean


-----Original Message-----
From: Scott Whitney [mailto:swhitney at journyx.com]
Sent: April 9, 2003 12:35 PM
To: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Need some help w/custom plug-in, please

Dean,
I thought of that, but the thing runs just fine.  If you run it from the
command line.  The permissions are all the same for this plug-in as well as
all the others in that directory.  Also, if I su to nagios, it runs fine (as
well as as root).  It just keeps saying "No Output".

My resource config file says:
$USER1$=/var/www/nagios/libexec

My command file(check_virus_dat.cfg) says:
define command {
  command_name                    check_virus_dat
  command_line                    $USER1$/check_virus_dat
}

The service file for the box it's on (camel) says:
####################### BEGIN SERVICE DEFINITION #######################
define service {
  use                             int-service

  host_name                       camel
  service_description             virus_dat
  check_command                   check_virus_dat
}
######################## END SERVICE DEFINITION ########################

There shouldn't be any more to it, I would think.

Anyone????????????  This is killing me!


----- Original Message -----
From: "Dean Bishop" <dbishop at ehvert.com>
To: "'Scott Whitney'" <swhitney at journyx.com>;
<nagios-users at lists.sourceforge.net>
Sent: Wednesday, April 09, 2003 8:04 AM
Subject: RE: [Nagios-users] Need some help w/custom plug-in, please


Could it be a permissions problem??

-----Original Message-----
From: Scott Whitney [mailto:swhitney at journyx.com]
Sent: April 8, 2003 4:24 PM
To: nagios-users at lists.sourceforge.net
Subject: [Nagios-users] Need some help w/custom plug-in, please

I have a simple plug in.  It calculates the age of the virus files based on
"now" and alerts you if outside your acceptable range.

It's called check_virus_dat.  It returns statusText of "Virus files are ___
days old." via sys.stdout and exits with exit code 0,1 or 2 based on good,
warn, critical.

Now, it's python-based, but the last 2 lines are all that matter.  My
command is:
define command {
  command_name                    check_virus_dat
  command_line                    $USER1$/check_virus_dat
}

The last 2 lines are:
print StatusText, status
sys.exit(status)

It returns the statusText ok, and I can see the exit code it's about to use.
Other scripts I've written are using these same exits fine.

When I run locally, I get (No output!)
When I run via nrpe, I get "Return code 32 is out of bounds."

Can anyone help me on this, please?

Scott Whitney






-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
_______________________________________________
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


-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger
for complex code. Debugging C/C++ programs can leave you feeling lost and
disoriented. TotalView can help you find your way. Available on major UNIX
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
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



-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger
for complex code. Debugging C/C++ programs can leave you feeling lost and
disoriented. TotalView can help you find your way. Available on major UNIX
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
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


-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
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