[Nagiosplug-help] check_url + return code 127

Duncan Ferguson duncan.ferguson at egg.com
Tue Jan 9 10:04:57 CET 2007


>From a quick scan through the script I can see two problems - 

*) UNKNOWN is return code 3, not -1.  This can lead to a "return code
127 is out of bounds" type error if the script hits its timeout of 20
seconds.  This can be amended on line 13.

*) Assumptions are made that the current directory (where the script is
run from, in your case "/usr/lib/nagios/plugins/contrib/") is writable
by the user running the script, since it tries to create some temporary
files.  This can be fixed by changing all occurances of "tmp_res1",
"tmp_res" and "tmp_html" to include the full path to the tmp directory,
i.e. "/tmp/tmp_res1".  A better fix would be to use File::Temp and
possibly the "tmpnam" function (for security reasons), buts that's
personal preference.

If that does not fix your problem, please repost your current command,
service and macro definitions as the error implies that the url is not
being passed to the command - around line 26 you could add the following
to help catch this

if(!$url) {
    print ("ERROR: no valid url provided\n");
    exit $ERRORS{"UNKNOWN"};
}

  Duncs

On Mon, 2007-01-08 at 19:43 +0000, Prashant N wrote:

> well i in-corporated the change and when i try to execute in command
> line the output is ok but thru the nagios web console, this returns
> errors as 
> [01-08-2007 12:47:02] SERVICE ALERT:
> kmp.mobiapps.biz;URL;UNKNOWN;HARD;15;**ePN /usr/lib/nagios/plugins/contrib/check_url.pl: "Use of uninitialized value in concatenation (.) or string at (eval 4) line 27,"."
> how to solve this ?
> regards
> shann
> 
> 
> On 1/8/07, Duncan Ferguson <duncan.ferguson at egg.com> wrote:
> 
>         That should probably be
>         
>         command_line    $USER1$/check_url.pl $ARG1$
>         
>         
>         
>         On Sat, 2007-01-06 at 12:28 +0530, Prashant N wrote: 
>         
>         > hi,
>         >  
>         > from the command line is used
>         > as : /usr/lib/nagios/plugins/check_url.pl
>         > https://172.16.1.78/blog
>         > and the check_url command in the commands.cfg looks like:
>         > ---------------------------------------------------------------------------------------
>         > # 'check_url' command definition
>         > define command{
>         >         command_name    check_url
>         >         command_line    $USER1$/check_url.pl
>         >         }
>         > ---------------------------------------------------------------------------------------------
>         > the services.cfg file
>         > -----------------------------------------------------------------------------------------------
>         > services.cfg
>         > -------------------------------------------------------------
>         > # URL SERVICES
>         > define service{
>         >         use                             basic-service
>         >         name                            url-service
>         >         service_description             URL
>         >         notification_interval           10
>         >         notification_options            c,r 
>         >         notification_period             24x7
>         >         check_command                   check_url
>         >         register                        0
>         >         }
>         > define service{
>         >         use                             url-service 
>         >         host_name                       kmp.mobiapps.biz
>         >         service_description             URL
>         >         check_command                   check_url!
>         > https://172.16.1.78/blog 
>         >         contact_groups                  einsteins
>         >         }
>         > ----------------------------------------------------------------------------------------------------------------
>         >  
>         > Regards
>         > Shann
>         >  
>         > On 1/6/07, Jason Martin <jhmartin at toger.us> wrote: 
>         > 
>         >         What is the definition of check_url? That is
>         >         probably where the
>         >         problem resides.
>         >         -Jason Martin
>         >         
>         >         On Fri, Jan 05, 2007 at 03:44:07PM +0100, Prashat N
>         >         wrote:
>         >         > Hi list
>         >         >
>         >         > I would like to use check_url to check one of the
>         >         https pages. when i check throug the command line
>         >         the plugin works fine. but does not work through the
>         >         nagios configs. My services.cfg looks like
>         >         >
>         >         ----------------------------------------------------------
>         >         > # URL SERVICES
>         >         > define service{
>         >         > use basic-service
>         >         > name url-service
>         >         > service_description URL
>         >         > notification_interval 10
>         >         > notification_options c,r
>         >         > notification_period 24x7
>         >         > check_command check_url
>         >         > register 0
>         >         > }
>         >         > define service{
>         >         > use url-service
>         >         > host_name kmp.mobiapps.biz
>         >         > service_description URL
>         >         > check_command check_url!https://172.16.1.78/blog
>         >         > contact_groups einsteins
>         >         > }
>         >         >
>         >         ----------------------------------------------------------- 
>         >         > what am i doing wrong ?
>         >         >
>         >         > - Prashat N (massoo)
>         >         >
>         >         > -----------------------
>         >         > The mailing list archive is found here:
>         >         >
>         >         http://www.nagiosexchange.org/nagiosplug-help.32.0.html
>         >         >
>         >         >
>         >         >
>         >         -------------------------------------------------------------------------
>         >         > Take Surveys. Earn Cash. Influence the Future of
>         >         IT
>         >         > Join SourceForge.net's Techsay panel and you'll
>         >         get the chance to share your
>         >         > opinions on IT & business topics through brief
>         >         surveys - and earn cash
>         >         >
>         >         http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>         >         > _______________________________________________
>         >         > Nagiosplug-help mailing list
>         >         > Nagiosplug-help at lists.sourceforge.net
>         >         >
>         >         https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
>         >         > ::: Please include plugins version (-v) and OS
>         >         when reporting any issue. 
>         >         > ::: Messages without supporting info will risk
>         >         being sent to /dev/null
>         >         
>         >         --
>         >         A cat is the universe's way of showing us
>         >         perfection.
>         >         This message is PGP/MIME signed.
>         >         
>         >         
>         > 
>         > 
>         > 
>         > 
>         > -- 
>         > Thanks & Regards
>         > Prashant N  
>         > 
>         > -------------------------------------------------------------------------
>         > Take Surveys. Earn Cash. Influence the Future of IT
>         > Join SourceForge.net's Techsay panel and you'll get the chance to share your
>         > opinions on IT & business topics through brief surveys - and earn cash
>         > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>         > 
>         > _______________________________________________ Nagiosplug-help mailing list 
>         > Nagiosplug-help at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
>         >  ::: Please include plugins version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
>         
>         -- 
>         Duncan Ferguson
>         
>         Senior Technologist
>         Egg PLC
>         Telephone: +44 (0)1384 26 4060
>         Mobbile:  +44 (0)7968 148 748
>         Jabber: duncs
>         
>         ______________________________________________________________
>         
>         
>         
>         Egg is a trading name of the Egg group of companies which
>         includes:
>         Egg plc (reg no 2448340), Egg Financial Intermediation Ltd
>         (reg no
>         3828289), and Egg Banking plc (reg no 2999842). Egg Banking
>         plc and
>         Egg Financial Intermediation Ltd are authorised and regulated
>         by
>         the Financial Services Authority (FSA) and are entered in the
>         FSA
>         register under numbers 205621 and 309551 respectively. These
>         members of the Egg group are registered in England and Wales.
>         Registered office: Laurence Pountney Hill, London EC4R 0HH.
>         
>         
>         This e-mail is confidential and for use by the addressee only.
>         If
>         you are not the intended recipient of this e-mail and have
>         received
>         it in error, please return the message to the sender by
>         replying to
>         it and then delete it from your mailbox. Internet e-mails are
>         not
>         necessarily secure. The Egg group of companies do not accept
>         responsibility for changes made to this message after it was
>         sent.
>         
>         
>         Whilst all reasonable care has been taken to avoid the
>         transmission
>         of viruses, it is the responsibility of the recipient to
>         ensure
>         that the onward transmission, opening or use of this message
>         and
>         any attachments will not adversely affect its systems or data.
>         No
>         responsibility is accepted by the Egg group of companies in
>         this
>         regard and the recipient should carry out such virus and other
>         checks as it considers appropriate.
>         
>         This communication does not create or modify any contract.
>         
>         
>         
> 
> 
> 
> 
> -- 
> Thanks & Regards
> Prashant N

-- 
Duncan Ferguson

Senior Technologist
Egg PLC
Telephone: +44 (0)1384 26 4060
Mobbile:  +44 (0)7968 148 748
Jabber: duncs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/help/attachments/20070109/8b2af041/attachment.html>


More information about the Help mailing list