Command line options

Lewis Getschel lgetschel at denver.westerngeco.slb.com
Wed Jul 6 20:20:29 CEST 2005


Ed-
   Is it possible? Yes!     anything is possible ;-)
   Is is Easy? Well... it's not a one-liner.

I have an event handler that automatically acknowledges my disk warnings 
when they go below 10% free. (And emails the users...)
Here is that portion of the script to create the proper format of the 
acknowledgment and service comment to  place into the nagios "command pipe"
 # This is not a complete script here, just a snippet
# echo Passed Parameters are:
#echo 1 -$1 -SERVICESTATE  >> /tmp/nagios_event_debug.txt
#echo 2 -$2 -STATETYPE  >> /tmp/nagios_event_debug.txt
#echo 3 -$3 -SERVICEATTEMPT  >> /tmp/nagios_event_debug.txt
#echo 4 -$4 -HOSTNAME  >> /tmp/nagios_event_debug.txt
#echo 5 -$5 -SERVICEDESC >> /tmp/nagios_event_debug.txt
 # Now put the acknowledgment into Nagios so it doesn't continue to show 
warning/critical state
   echocmd="/bin/echo"
   CommandFile="/usr/local/nagios/var/rw/nagios.cmd"
   # get the current date/time in seconds since UNIX epoch
   datetime=`date +%s`
   # create the command lines to add to the command file
   # In next line, the 4th parameter is 0=non-persistant, 1=persistant
   cmdline1="[$datetime] 
ADD_SVC_COMMENT;$4;$5;1;Nagios_script;ACKNOWLEDGEMENT:FS $freediskspace 
free disk,mail sent to $numberofmailsent users"
   # Comment appears as:      06-14-2005 09:41:30 Nagios_script 
ACKNOWLEDGEMENT:FS 10% free disk,mail sent to 23 users 1412 Yes
   cmdline2="[$datetime] ACKNOWLEDGE_SVC_PROBLEM;$4;$5;0;FS 
$freediskspace freedisk, mail sent to $numberofmailsent users"
   `$echocmd $cmdline1 >> $CommandFile`
   `$echocmd $cmdline2 >> $CommandFile`


Ed Smith wrote:

>hello,
>
>Does anyone know if there is a way to acknowledge something from the command line, or by editing a file.  We have nagios setup in a place where we cannot access the web interface, but we need to acknowledge a service alert (for the web server, ironically).  Is there a way to do this from the os lever?  Thanks.
>
>Ed  Smith
>
>------------------------
>Edward Smith
>Systems Application Engineer
>DemandTec, Inc
>esmith at demandtec.com
>650-226-4609
>
>
><html>
><body>
>  <span style="font-size:8.0pt;font-family:Arial">---------------------------------------------------------------------------------------------------------------------------------------------</span>
>  <span style="font-size:8.0pt;font-family:Arial">DEMANDTEC EMAIL NOTICE:</span>
>  <p><span style="font-size:8.0pt;font-family:Arial">NOTICE: This email transmission and all attached files contain information intended for the designated individual or entity to whom it is addressed and may contain information that is proprietary, privileged and/or exempt from disclosure under applicable law.  If you are not the intended recipient or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, copying,  or other use of this email or its attachments is strictly prohibited.  If you have received this email in error, please notify the sender immediately by replying to this message and please delete the original message without making any copies.</span>
>  <p><span style="font-size:8.0pt;font-family:Arial">WARNING: Computer viruses can be transmitted via email.  The recipient should check this email and any attachments for the presence of viruses.  Although we have taken reasonable precautions to ensure that this email and all attachments are free from viruses, we accept no liability for any loss or damage arising from the use of this email or its attachments.</span>
></body>
></html>
>
>
>-------------------------------------------------------
>SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
>from IBM. Find simple to follow Roadmaps, straightforward articles,
>informative Webcasts and more! Get everything you need to get up to
>speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&opclick
>_______________________________________________
>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
>
>  
>

-- 
Lewis Getschel             | Today is done...
WesternGeco                |     Today was fun...
1625 Broadway              |         Tomorrow is another one.
Denver, CO 80202           |
Direct Phone - 303-389-4407|        -- Dr. Seuss --



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
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