Mass delete of host/service downtimes.

Páll Guðjón Sigurðsson palli at ok.is
Thu Feb 21 12:16:36 CET 2013


The posts inspired me to write downtime support in pynag command-line utility. Works both via livestatus or more traditional writing directly to nagios command pipe.

I dont mean to make this mailing list a pynag announcement one, but considering the questions brought i thought others might enjoy the script as well :)


Example usage:

# List downtimes
pynag downtime --list [where host_name='example.com']

# Schedule new downtimes, works for hosts,services,hostgroups,servicegroups
pynag downtime where host_name=localhost 
pynag downtime where hostgroup_name=webservers --comment "Scheduled maintainance on everything in hostgroup"
pynag downtime where service_description__contains='vmware' --comment 'Downtime on everything that is vmware'

# Remove a single downtime:
pynag downtime --remove where id=100

# Remove all downtimes matching search filter
pynag downtime --remove where comment="Scheduled Maintainance"




----- Original Message -----
From: "Rafał Radecki" <radecki.rafal at gmail.com>
To: "Paul Dubuc" <work at paul.dubuc.org>
Cc: "Nagios Users List" <nagios-users at lists.sourceforge.net>
Sent: Thursday, February 21, 2013 2:46:11 PM
Subject: Re: [Nagios-users] Mass delete of host/service downtimes.

Thank you very much. It works very well :)

Best regards,
Rafal Radecki.

2013/2/20 Paul Dubuc <work at paul.dubuc.org>:
> � wrote:
>>
>> Hi All.
>>
>> I currently try to remove many host/service downtimes. I can do this
>> one by one but it would be time consuming. Is there a way to remove
>> all downtimes at once? Or maybe I should use a special url with some
>> variables?
>> I've noticed that in  /var/log/nagios/status.dat there are all
>> downtimes written but it is generated on nagios start and I think that
>> deleting appropriate sections from this file can be dangerous.
>> I've tried curl
>> 'https://server/nagios/cgi-bin/cmd.cgi?cmd_typ=79&down_id=2139' but
>> with no luck ;)
>> Any tips?
>
>
> If you have Nagios 3.3.1 or newer there are some undocumented external
> commands that can do this easily. See my previous message here for details:
>
> https://sourceforge.net/mailarchive/message.php?msg_id=30453206
>
>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
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

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
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