Nagios script output issue

Jim Avery jim at jimavery.me.uk
Fri Aug 27 09:05:39 CEST 2010


On 27 August 2010 06:26, newme me <allanm78 at gmail.com> wrote:
> Hi Folks,
>
> Nagios is acting a little weird for me, I have this external script which I
> hooked into Nagios, it merely does a curl/wget on a URL and returns the
> status based on string in the content/output. Initially for 2-3 hrs the
> script returns the right status and Nagios reports correctly i.e. OK, WARN,
> ERROR based on the exit from the script. After 2-3 hrs output which was (and
> should be) OK or WARN starts returning CRITICAL and the output line says
> "Application is" and not even "Application is ERROR" or "Application is
> FATAL".
>
> There is nothing in the logs to suggest what could be the problem. Have you
> experienced this before and let me know the corrective action. I am running
> Nagios on Mac OSX.
>
> Here is the script for the curious -
>
> #!/bin/bash
>
> read URL < "$1"
>
> STATUS=`curl -s $URL |grep summary|awk -F\" '{print $2}'`
> echo "Application is $STATUS"
> echo "curl $URL"
>
> case $STATUS in
> OK)
>    exit 0
>    ;;
> WARN)
>   exit 1
>   ;;
> ERROR)
>   exit 2
>   ;;
> FATAL)
>   exit 2
>   ;;
> *)
>   exit 2
>   ;;
> esac


I'm not sure.

The syntax:
  read URL < "$1"

seems a bit unusual.  Maybe I've misunderstood what it's doing, but
wouldn't this do the job more conventionally?:
  URL="$1"

Depending on how your application constructs the web page, it might
not be guaranteed that "summary" and the status will be on the same
line.

A small point, but I would normally use exit 3 rather than exit 2 for
that final *) catch-all case.

hth, but I'm not convinced it will!

I'm told that for this sort of thing webinject is good, but I haven't
tried it myself yet so am not sure how onerous it would be to install
and set up.

Jim

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
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