nagios Status information (null) issue

I can't figure out why a specific command isn't working and giving me a Null result.

The command in question is check_bl.  The command works fine from the command line when logged in as the Nagios user.  It gives the proper result for the mail server I am testing ("Not Listed") and for my home address which I expect ("Listed at...")

nagios@Nagios:/usr/local/nagios/libexec$ ./check_bl -H {server IP obfuscated} -B zen.spamhaus.org bl.spamcop.net dnsbl.ahbl.org
Not black-listed

I saw a thread somewhere about changing the working directory path from the default for check_bl from "/usr/local/nagios/plugins" to "/usr/local/nagios/libexec", which I did so I have ruled that one out'

Anyone else have any ideas on this one?  Thanks in advance!

Jack


The server is Ubuntu 10.10
Nagios® Core™
Version 3.2.3

Command:
#check to see if mail server is on any public RBLs (real time blackhole lists)
define      command      {
      command_name      check_bl
      command_line      $USER1$/check_bl -H $HOSTADDRESS$ -B zen.spamhaus.org bl.spamcop.net dnsbl.ahbl.org dnsbl.njabl.org dnsbl.sorbs.net virbl.dnsbl.bit.nl rbl.efnet.org phishing.rbl.msrbl.net 0spam.fusionzero.com list.dsbl.org multihop.dsbl.org unconfirmed.dsbl.org will-spam-for-food.eu.org blacklist.spambag.org blackholes.brainerd.net blackholes.uceb.org spamsources.dnsbl.info map.spam-rbl.com ns1.unsubscore.com psbl.surriel.com l2.spews.dnsbl.sorbs.net bl.csma.biz sbl.csma.biz dynablock.njabl.org no-more-funn.moensted.dk  ubl.unsubscore.com dnsbl-1.uceprotect.net dnsbl-2.uceprotect.net dnsbl-3.uceprotect.net spamguard.leadmon.net opm.blitzed.org bl.spamcannibal.org rbl.schulte.org dnsbl.ahbl.org virbl.dnsbl.bit.nl combined.rbl.msrbl.net
      }
Service check:


define service {
      host_name            MailServer
      service_description      BLACKLIST
#      is_volatile            0
      check_command            check_bl!{server IP obfuscated}
      max_check_attempts      3
      normal_check_interval      60
      retry_check_interval      60
      active_checks_enabled      1
      passive_checks_enabled      1
      check_period            24x7
      flap_detection_enabled      1
      failure_prediction_enabled      1
      process_perf_data      1
      retain_status_information      1
      retain_nonstatus_information      1
      contact_groups            admins
      notification_interval      240
      notification_period      24x7
      notification_options      c,r
      notifications_enabled      1
#      register            1
      }

LVL 4
freymishAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nociSoftware EngineerCommented:
Is your hostname / ip address spelled correctly?

The only place to get an error is when an invalid hostname is supplied with -H.
then it returns this error:
Use of uninitialized value $lookupip in substitution (s///) at /usr/lib/nagios/plugins/contrib//check_bl line 141.

Before Not-Blacklisted...

0
freymishAuthor Commented:
I double-checked the spelling or the hostname and it is correct.  I also tried replacing $HOSTADDRESS$ with the FQDN of the server  and replacing $USER1$ with the actual path to the script file but that yielded the same result as well.  I was able to cut and paste the check command from the Command Expansion window directly into the console connection, logged in as the nagios user, and it ran just fine.

Argh...
0
nociSoftware EngineerCommented:
BTW, don't put !{ipadress} in your service spec. This is meant to pass an Argument (ARG1) to the check command from the service profile. The Hostaddress is passed using it's own variable.  (this is not your problem though)

appearantly your nagios path is: /usr/local/nagios/libexec
so that should consistently be used, where did you change the nagios path
and does it match the path mentioned inside check_bl, there is a use lib "..."
"use util" after that might CRITICAL error.  (exits status 2, with no output to stdout)
That would explain the message given.

The error in stderr is: (is the path inside check_bl is incorrect).
Can't locate utils.pm in @INC (@INC contains: /usr/lib/nagios/plugins/x /etc/perl /usr/lib/perl5/site_perl/5.12.2/i686-linux-thread-multi /usr/lib/perl5/site_perl/5.12.2 /usr/lib/perl5/vendor_perl/5.12.2/i686-linux-thread-multi /usr/lib/perl5/vendor_perl/5.12.2 /usr/lib/perl5/5.12.2/i686-linux-thread-multi /usr/lib/perl5/5.12.2 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/local/lib/site_perl .) at ../contrib/check_bl line 28.
BEGIN failed--compilation aborted at ../contrib/check_bl line 28.


0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

freymishAuthor Commented:
the {ipaddress} is just in the post in place of the actual IP which I didn't want to advertise.

I did change the check_bl code to reflect the correct path for the file as I mentioned above.

The path change I mentioned was as below:

from:
define      command      {
      command_name      check_bl
      command_line      $USER1$/check_bl [...]

to:

define      command      {
      command_name      check_bl
      command_line      /usr/local/nagios/libexec/check_bl [...]

0
nociSoftware EngineerCommented:
In the service description just use:

check_command     check_bl
(ie without the !...... as you don't use $ARG1$ in the command but $HOSTADDRESS$ (btw hostaddress is the correct way).
The change from $USER1$  to a hardcoded path is unwise and unneeded...

please open the check_bl script in an editor (it's a perl script not a program).
In mine there are the following lines:
---8<---
use strict;
use lib "/usr/lib/nagios/plugins/";
use utils qw($TIMEOUT %ERRORS &print_revision &support);
use Net::DNS;
---8<---
please verify the that the path after "use lib" is the same as where all your plugins (and utils.pm) are stored.
That utils.pm is included after the use lib, but perl needs to be able to find it.
The cwd of the server processes is / not the plugins directory, so the path needs to be correct for check_bl to find the utils.pm

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
freymishAuthor Commented:
OK, I got it.  Turned out to be a dumb spelling issue.  In the check_bl script the path was enumerated as

"/usr/lib/nagios/libexec"

instead of

"/usr/local/nagios/libexec"

When I edited this I looked past the /lib/ part and just saw the /plugins as the only thing that needed to be changed.

Oh well...  apparently attention to detail matters  ;)

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.