Obsessive Compulsive Problem

Jason Marshall jasonm at kelman.com
Wed Feb 19 16:56:33 CET 2003


> Please also send us the content of the actual submit_check_result script.

Whoops, sorry, I meant to do that, and forgot to hit "paste"!

#!/bin/sh

# Arguments:
#  $1 = host_name (Short name of host that the service is
#       associated with)
#  $2 = svc_description (Description of the service)
#  $3 = state_string (A string representing the status of
#       the given service - "OK", "WARNING", "CRITICAL"
#       or "UNKNOWN")
#  $4 = plugin_output (A text string that should be used
#       as the plugin output for the service checks)
#

touch /tmp/blah

# Convert the state string to the corresponding return code
return_code=-1

case "$3" in
  OK)
    return_code=0
  ;;
  WARNING)
    return_code=1
  ;;
  CRITICAL)
    return_code=2
  ;;
  UNKNOWN)
    return_code=-1
  ;;
esac

# pipe the service check info into the send_nsca program, which
# in turn transmits the data to the nsca daemon on the central
# monitoring server

/bin/echo "$1\t$2\t$return_code\t$4\n" >/tmp/blah

/bin/echo "$1\t$2\t$return_code\t$4\n" | /opt/nagios/bin/send_nsca \
172.29.3.254 -c /opt/nagios/etc/send_nsca.cfg

If I run it on the command line, it works A-OK.  It doesn't get run AT ALL
by nagios -- that's why i put the touch at the top, so I'd see if it was
actually being run.



> 
> Thanks.
> 
> Russell
> 
> Jason Marshall wrote:
> 
> >>First thing to check...file permissions for the submit_check_result 
> >>script.  I had a problem with that once.  Make sure that whatever used 
> >>
> >
> >I just checked, and it was the wrong owner, but mode 755, so it was
> >runnable by whomever.
> >
> >>Nagios runs as can execute that script.  Then double check the command 
> >>you have defined in your misccommands.cfg file to make sure the syntax 
> >>is good (suggestion:  email it to the list).  Rememver to put quotes 
> >>around any $MACRO$ variable that could have spaces in them.
> >>
> >
> >I had quotes around everything, and then removed them, and the results
> >have been the same:
> >
> >define command {
> >        command_name            submit_check_result
> >        command_line            /opt/nagios/libexec/submit_check_result 
> >$HOSTNAME$ $SERVICEDESC$ $SERVICESTATE$ '$OUTPUT$'
> >}
> >
> >The command_line is all one one line, sorry for the wrappage.
> >
> >---
> >Jason Marshall, Unix Geek, Kelman Technologies, Inc., Calgary, AB, Canada.
> >
> >  From a Sun Microsystems bug report (#4102680):
> >    "Workaround: don't pound on the mouse like a wild monkey."
> >
> >  "I have great faith in fools: 
> >     Self confidence my friends call it."  -Edgar Allan Poe
> >
> >
> >
> >
> 
> -- 
> Russell Scibetti
> Quadrix Solutions, Inc.
> http://www.quadrix.com
> (732) 235-2335, ext. 7038
> 
> 
> 

---
Jason Marshall, Unix Geek, Kelman Technologies, Inc., Calgary, AB, Canada.

  From a Sun Microsystems bug report (#4102680):
    "Workaround: don't pound on the mouse like a wild monkey."

  "I have great faith in fools: 
     Self confidence my friends call it."  -Edgar Allan Poe




-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
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