External Command, scheduled downtime

alex at reseau.nl alex at reseau.nl
Mon Feb 14 10:57:07 CET 2005


Hmm, now a bit edited and send to the group..

Quoting Lewis Getschel <lgetschel at denver.westerngeco.slb.com>:

> OK, I may be off here, but I'll give it a try...
> I'm using 1.2, not the 2.0, but this sounds familiar...
>
> Question, how do you know that your command is getting into the
> nagios.cmd file?
> I ask because I did monitoring with   tail -f var/rw/nagios.cmd
> and found that whenever I did that, I would SEE the command, but it
> would NEVER get processed.
> It was only after 'forgetting' to do the tail command that I
> figured
> that I was actually interfering with it!
> (I didn't realize it wasn't a 'file', but a named pipe until
> Andreas pointed it out.
Yes well, seeing the event being added to the Event Log in Nagios
shows me it is being read by Nagios. But it isn't handled any
further.
>
> I have the following lines in an event handler I'm using (so nagios
> acknowledges this file system service
> is reaching a warning/critical level. This happens after another
> script
> mails out a message to the correct users)
> This builds up the proper format for the nagios.cmd "named pipe" to
> use:
> ---- cut here ----
>  # 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
>    # 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"
>    cmdline2="[$datetime] ACKNOWLEDGE_SVC_PROBLEM;$4;$5;0;FS
> $freediskspace free disk, mail sent to $numberofmailsent users"
>    `$echocmd $cmdline1 >> $CommandFile`
>    `$echocmd $cmdline2 >> $CommandFile`
> ---- cut here ----
>
> I'm not sure this helps, but I thought it might.
> Lewis
Well thanks for replying (3 times ;). That script has some undefined
variables in it, but that isn't too much a problem. That pointed me
to something though.. running that script by itself gave this first
line in the Event Log:

[2005-02-14 09:38:22] EXTERNAL COMMAND:
ADD_SVC_COMMENT;;;1;Nagios_script;ACKNOWLEDGEMENT: FS free disk,mail
sent to users

Even though the host_name and service_description fields are empty, it
is loaded into the logfile. I know Nagios does report it when it finds
an unknown command. But apparently it doesn't check whether the host
or service exists. I guess, to start with, this is a bug. Ofcourse
this check is done at a different level, but still.

In cgi.cfg 'my' user has is in all the user-permission lists, so that
can't be it either (authorized_for_system_information,
authorized_for_configuration_information,
authorized_for_system_commands, authorized_for_all_services,
authorized_for_all_hosts, authorized_for_all_service_commands,
authorized_for_all_host_commands).
I checked all logfiles I could think of, but I don't find an error
message from Nagios anywhere, even though somewhere that command has
to be rejected.

Unfortunately I'm not so much a 'compiler' myself, nor do I really
have the time to check the code myself. So I really hope one of
the developers has an idea here.

Btw, adding te right parameters a service did get a comment, so that
IS working.

Regards,
Alex Haan

>
> alex at reseau.nl wrote:
>
> >I've been investigating Nagios for a while now.
> >
> >I had the last stable, beta1 and now beta2 installed.
> >
> >I have problems scheduling Service and Host downtime using
> external
> >commands. I haven't used it before and started with it in beta1.
> >
> >I have seen that multiple people have had this issue, though they
> >never got a reaction. I hope I will because I don't have much time
> >left for this investigation and using external commands to
> schedule
> >downtime is critical in our system.
> >
> >When I use the Addon nagdtsched i get a message in the Event log:
> >
> >[2005-02-11 11:08:10] EXTERNAL COMMAND:
>
>SCHEDULE_SVC_DOWNTIME;linux1;PING;1108137600;1108195200;1;57600;nagios;Regularly
> >Scheduled Dowtime
> >
> >but nothing shows up in the 'Downtime' page. If I schedule
> downtime
> >via the webinterface then everythign goes ok.
> >
> >I tried echo-ing to var/rw/nagios.cmd myself and that worked like
> >above. And both external commands for host and service downtime
> don't
> >work. I first tried all of this in beta1, but hoping beta2 might
> have
> >it fixed i installed that over 1, but that didn't help either.
> >
> >What I am using this for is to create performance data during
> business
> >hours. But I want those hours defined in nagios, not in the data
> >processing. I found out that I can use a macro that shows the
> >downtime level, so i can easily use that calculating performance
> >myself.
> >It would help if there was a variant to the service&host
> notification
> >hour settings. But this works just as well.
> >
> >Regards,
> >Alex Haan
> >
> >----------------------------------------------------------------
> >This message was sent using IMP, the Internet Messaging Program.
> >
> >
> >-------------------------------------------------------
> >SF email is sponsored by - The IT Product Guide
> >Read honest & candid reviews on hundreds of IT Products from real
> users.
> >Discover which products truly live up to the hype. Start reading
> now.
> >http://ads.osdn.com/?ad_ide95&alloc_id396&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 --
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&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