<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.10.3">
</HEAD>
<BODY>
>From a quick scan through the script I can see two problems - <BR>
<BR>
*) 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.<BR>
<BR>
*) Assumptions are made that the current directory (where the script is run from, in your case "<FONT COLOR="#000000">/usr/lib/nagios/plugins/contrib/</FONT>") 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.<BR>
<BR>
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<BR>
<BR>
if(!$url) {<BR>
print ("ERROR: no valid url provided\n");<BR>
exit $ERRORS{"UNKNOWN"};<BR>
}<BR>
<BR>
Duncs<BR>
<BR>
On Mon, 2007-01-08 at 19:43 +0000, Prashant N wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">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 </FONT><BR>
<FONT COLOR="#000000">[01-08-2007 12:47:02] SERVICE ALERT: <A HREF="http://kmp.mobiapps.biz">kmp.mobiapps.biz</A>;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,"."</FONT><BR>
<FONT COLOR="#000000">how to solve this ?</FONT><BR>
<FONT COLOR="#000000">regards</FONT><BR>
<FONT COLOR="#000000">shann</FONT><BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">On 1/8/07, </FONT><FONT COLOR="#000000"><B>Duncan Ferguson</B></FONT><FONT COLOR="#000000"> <<A HREF="mailto:duncan.ferguson@egg.com">duncan.ferguson@egg.com</A>> wrote:</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BLOCKQUOTE>
<FONT COLOR="#000000">That should probably be</FONT><BR>
<BR>
<FONT COLOR="#000000">command_line $USER1$/check_url.pl $ARG1$</FONT>
</BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BLOCKQUOTE>
<BR>
<BR>
<FONT COLOR="#000000">On Sat, 2007-01-06 at 12:28 +0530, Prashant N wrote: </FONT><BR>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">hi,</FONT><BR>
<FONT COLOR="#000000"> </FONT><BR>
<FONT COLOR="#000000">from the command line is used as : /usr/lib/nagios/plugins/check_url.pl <A HREF="https://172.16.1.78/blog">https://172.16.1.78/blog</A></FONT><BR>
<FONT COLOR="#000000">and the check_url command in the commands.cfg looks like:</FONT><BR>
<FONT COLOR="#000000">---------------------------------------------------------------------------------------</FONT><BR>
<FONT COLOR="#000000"># 'check_url' command definition</FONT><BR>
<FONT COLOR="#000000">define command{</FONT><BR>
<FONT COLOR="#000000"> command_name check_url</FONT><BR>
<FONT COLOR="#000000"> command_line $USER1$/check_url.pl</FONT><BR>
<FONT COLOR="#000000"> }</FONT><BR>
<FONT COLOR="#000000">---------------------------------------------------------------------------------------------</FONT><BR>
<FONT COLOR="#000000">the services.cfg file</FONT><BR>
<FONT COLOR="#000000">-----------------------------------------------------------------------------------------------</FONT><BR>
<FONT COLOR="#000000">services.cfg</FONT><BR>
<FONT COLOR="#000000">-------------------------------------------------------------</FONT><BR>
<FONT COLOR="#000000"># URL SERVICES</FONT><BR>
<FONT COLOR="#000000">define service{</FONT><BR>
<FONT COLOR="#000000"> use basic-service</FONT><BR>
<FONT COLOR="#000000"> name url-service</FONT><BR>
<FONT COLOR="#000000"> service_description URL</FONT><BR>
<FONT COLOR="#000000"> notification_interval 10</FONT><BR>
<FONT COLOR="#000000"> notification_options c,r </FONT><BR>
<FONT COLOR="#000000"> notification_period 24x7</FONT><BR>
<FONT COLOR="#000000"> check_command check_url</FONT><BR>
<FONT COLOR="#000000"> register 0</FONT><BR>
<FONT COLOR="#000000"> }</FONT><BR>
<FONT COLOR="#000000">define service{</FONT><BR>
<FONT COLOR="#000000"> use url-service </FONT><BR>
<FONT COLOR="#000000"> host_name <A HREF="http://kmp.mobiapps.biz">kmp.mobiapps.biz</A></FONT><BR>
<FONT COLOR="#000000"> service_description URL</FONT><BR>
<FONT COLOR="#000000"> check_command check_url!https://172.16.1.78/blog </FONT><BR>
<FONT COLOR="#000000"> contact_groups einsteins</FONT><BR>
<FONT COLOR="#000000"> }</FONT><BR>
<FONT COLOR="#000000">----------------------------------------------------------------------------------------------------------------</FONT><BR>
<FONT COLOR="#000000"> </FONT><BR>
<FONT COLOR="#000000">Regards</FONT><BR>
<FONT COLOR="#000000">Shann</FONT><BR>
<FONT COLOR="#000000"> </FONT><BR>
<FONT COLOR="#000000">On 1/6/07, </FONT><FONT COLOR="#000000"><B>Jason Martin</B></FONT><FONT COLOR="#000000"> <<A HREF="mailto:jhmartin@toger.us">jhmartin@toger.us</A>> wrote: </FONT><BR>
<BLOCKQUOTE>
<FONT COLOR="#000000">What is the definition of check_url? That is probably where the</FONT><BR>
<FONT COLOR="#000000">problem resides.</FONT><BR>
<FONT COLOR="#000000">-Jason Martin</FONT><BR>
<BR>
<FONT COLOR="#000000">On Fri, Jan 05, 2007 at 03:44:07PM +0100, Prashat N wrote:</FONT><BR>
<FONT COLOR="#000000">> Hi list</FONT><BR>
<FONT COLOR="#000000">></FONT><BR>
<FONT COLOR="#000000">> 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</FONT><BR>
<FONT COLOR="#000000">> ----------------------------------------------------------</FONT><BR>
<FONT COLOR="#000000">> # URL SERVICES</FONT><BR>
<FONT COLOR="#000000">> define service{</FONT><BR>
<FONT COLOR="#000000">> use basic-service</FONT><BR>
<FONT COLOR="#000000">> name url-service</FONT><BR>
<FONT COLOR="#000000">> service_description URL</FONT><BR>
<FONT COLOR="#000000">> notification_interval 10</FONT><BR>
<FONT COLOR="#000000">> notification_options c,r</FONT><BR>
<FONT COLOR="#000000">> notification_period 24x7</FONT><BR>
<FONT COLOR="#000000">> check_command check_url</FONT><BR>
<FONT COLOR="#000000">> register 0</FONT><BR>
<FONT COLOR="#000000">> }</FONT><BR>
<FONT COLOR="#000000">> define service{</FONT><BR>
<FONT COLOR="#000000">> use url-service</FONT><BR>
<FONT COLOR="#000000">> host_name <A HREF="http://kmp.mobiapps.biz">kmp.mobiapps.biz</A></FONT><BR>
<FONT COLOR="#000000">> service_description URL</FONT><BR>
<FONT COLOR="#000000">> check_command check_url!https://172.16.1.78/blog</FONT><BR>
<FONT COLOR="#000000">> contact_groups einsteins</FONT><BR>
<FONT COLOR="#000000">> }</FONT><BR>
<FONT COLOR="#000000">> ----------------------------------------------------------- </FONT><BR>
<FONT COLOR="#000000">> what am i doing wrong ?</FONT><BR>
<FONT COLOR="#000000">></FONT><BR>
<FONT COLOR="#000000">> - Prashat N (massoo)</FONT><BR>
<FONT COLOR="#000000">></FONT><BR>
<FONT COLOR="#000000">> -----------------------</FONT><BR>
<FONT COLOR="#000000">> The mailing list archive is found here:</FONT><BR>
<FONT COLOR="#000000">> <A HREF="http://www.nagiosexchange.org/nagiosplug-help.32.0.html">http://www.nagiosexchange.org/nagiosplug-help.32.0.html</A></FONT><BR>
<FONT COLOR="#000000">></FONT><BR>
<FONT COLOR="#000000">></FONT><BR>
<FONT COLOR="#000000">> -------------------------------------------------------------------------</FONT><BR>
<FONT COLOR="#000000">> Take Surveys. Earn Cash. Influence the Future of IT</FONT><BR>
<FONT COLOR="#000000">> Join SourceForge.net's Techsay panel and you'll get the chance to share your</FONT><BR>
<FONT COLOR="#000000">> opinions on IT & business topics through brief surveys - and earn cash</FONT><BR>
<FONT COLOR="#000000">> <A HREF="http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV">http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV</A></FONT><BR>
<FONT COLOR="#000000">> _______________________________________________</FONT><BR>
<FONT COLOR="#000000">> Nagiosplug-help mailing list</FONT><BR>
<FONT COLOR="#000000">> <A HREF="mailto:Nagiosplug-help@lists.sourceforge.net">Nagiosplug-help@lists.sourceforge.net</A></FONT><BR>
<FONT COLOR="#000000">> <A HREF="https://lists.sourceforge.net/lists/listinfo/nagiosplug-help">https://lists.sourceforge.net/lists/listinfo/nagiosplug-help</A></FONT><BR>
<FONT COLOR="#000000">> ::: Please include plugins version (-v) and OS when reporting any issue. </FONT><BR>
<FONT COLOR="#000000">> ::: Messages without supporting info will risk being sent to /dev/null</FONT><BR>
<BR>
<FONT COLOR="#000000">--</FONT><BR>
<FONT COLOR="#000000">A cat is the universe's way of showing us perfection.</FONT><BR>
<FONT COLOR="#000000">This message is PGP/MIME signed.</FONT><BR>
<BR>
<BR>
</BLOCKQUOTE>
<BR>
<BR>
<BR>
<FONT COLOR="#000000">-- </FONT><BR>
<FONT COLOR="#000000">Thanks & Regards</FONT><BR>
<FONT COLOR="#000000">Prashant N </FONT>
<PRE>
<FONT COLOR="#000000">-------------------------------------------------------------------------</FONT>
<FONT COLOR="#000000">Take Surveys. Earn Cash. Influence the Future of IT</FONT>
<FONT COLOR="#000000">Join SourceForge.net's Techsay panel and you'll get the chance to share your</FONT>
<FONT COLOR="#000000">opinions on IT & business topics through brief surveys - and earn cash</FONT>
<FONT COLOR="#000000"><A HREF="http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV">http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV</A></FONT>
<FONT COLOR="#000000">_______________________________________________ Nagiosplug-help mailing list </FONT>
<FONT COLOR="#000000"><A HREF="mailto:Nagiosplug-help@lists.sourceforge.net">Nagiosplug-help@lists.sourceforge.net</A> <A HREF="https://lists.sourceforge.net/lists/listinfo/nagiosplug-help">https://lists.sourceforge.net/lists/listinfo/nagiosplug-help</A></FONT>
<FONT COLOR="#000000"> ::: Please include plugins version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null</FONT>
</PRE>
</BLOCKQUOTE>
</BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
-- <BR>
Duncan Ferguson<BR>
<BR>
<FONT COLOR="#808080">Senior Technologist</FONT><BR>
<FONT COLOR="#808080">Egg PLC</FONT><BR>
<FONT COLOR="#808080">Telephone: +44 (0)1384 26 4060</FONT><BR>
<FONT COLOR="#808080">Mobbile: +44 (0)7968 148 748</FONT><BR>
<FONT COLOR="#808080">Jabber: duncs</FONT>
</TD>
</TR>
</TABLE>
</BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BLOCKQUOTE>
<HR SIZE="1">
<BR>
<BR>
<BR>
<BR>
<B><FONT COLOR="#000000">Egg is a trading name of the Egg group of companies which includes:</FONT></B><BR>
<B><FONT COLOR="#000000">Egg plc (reg no 2448340), Egg Financial Intermediation Ltd (reg no</FONT></B><BR>
<B><FONT COLOR="#000000">3828289), and Egg Banking plc (reg no 2999842). Egg Banking plc and</FONT></B><BR>
<B><FONT COLOR="#000000">Egg Financial Intermediation Ltd are authorised and regulated by</FONT></B><BR>
<B><FONT COLOR="#000000">the Financial Services Authority (FSA) and are entered in the FSA</FONT></B><BR>
<B><FONT COLOR="#000000">register under numbers 205621 and 309551 respectively. These</FONT></B><BR>
<B><FONT COLOR="#000000">members of the Egg group are registered in England and Wales.</FONT></B><BR>
<B><FONT COLOR="#000000">Registered office: Laurence Pountney Hill, London EC4R 0HH.</FONT></B><BR>
<BR>
<BR>
<B><FONT COLOR="#000000">This e-mail is confidential and for use by the addressee only. If</FONT></B><BR>
<B><FONT COLOR="#000000">you are not the intended recipient of this e-mail and have received</FONT></B><BR>
<B><FONT COLOR="#000000">it in error, please return the message to the sender by replying to</FONT></B><BR>
<B><FONT COLOR="#000000">it and then delete it from your mailbox. Internet e-mails are not</FONT></B><BR>
<B><FONT COLOR="#000000">necessarily secure. The Egg group of companies do not accept</FONT></B><BR>
<B><FONT COLOR="#000000">responsibility for changes made to this message after it was sent.</FONT></B><BR>
<BR>
<BR>
<B><FONT COLOR="#000000">Whilst all reasonable care has been taken to avoid the transmission</FONT></B><BR>
<B><FONT COLOR="#000000">of viruses, it is the responsibility of the recipient to ensure</FONT></B><BR>
<B><FONT COLOR="#000000">that the onward transmission, opening or use of this message and</FONT></B><BR>
<B><FONT COLOR="#000000">any attachments will not adversely affect its systems or data. No</FONT></B><BR>
<B><FONT COLOR="#000000">responsibility is accepted by the Egg group of companies in this</FONT></B><BR>
<B><FONT COLOR="#000000">regard and the recipient should carry out such virus and other</FONT></B><BR>
<B><FONT COLOR="#000000">checks as it considers appropriate.</FONT></B><BR>
<BR>
<B><FONT COLOR="#000000">This communication does not create or modify any contract.</FONT></B><BR>
<BR>
<BR>
<BR>
</BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
<BR>
<FONT COLOR="#000000">-- </FONT><BR>
<FONT COLOR="#000000">Thanks & Regards</FONT><BR>
<FONT COLOR="#000000">Prashant N</FONT><BR>
</BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
-- <BR>
Duncan Ferguson<BR>
<BR>
<FONT COLOR="#808080">Senior Technologist</FONT><BR>
<FONT COLOR="#808080">Egg PLC</FONT><BR>
<FONT COLOR="#808080">Telephone: +44 (0)1384 26 4060</FONT><BR>
<FONT COLOR="#808080">Mobbile: +44 (0)7968 148 748</FONT><BR>
<FONT COLOR="#808080">Jabber: duncs</FONT>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>