Mass delete of host/service downtimes.
Páll Guðjón Sigurðsson
palli at ok.is
Wed Feb 20 09:22:58 CET 2013
If you have pynag installed this script might help you along. It will clear all downtimes unless you uncomment some of the filters:
#!/usr/bin/python
import pynag.Parsers
import pynag.Control.Command
livestatus = pynag.Parsers.mk_livestatus()
downtimes = livestatus.query('GET downtimes')
for downtime in downtimes:
# Only remove downtime for a specific host
#if downtime['host_name'] != 'nagios.example.com': continue
# Only remove downtimes if check belongs to a specific hostgroup
#if 'my_hostgroup' not in downtime['hostgroups']: continue
host_name = downtime['host_name']
service_description = downtime['service_description']
downtime_id = downtime['id']
downtime_type = downtime['type']
print "Removing downtime for: %-30s %s" % ( host_name, service_description )
if downtime_type == 1:
# This is a service downtime
pynag.Control.Command.del_svc_downtime(downtime_id)
elif downtime_type == 0:
pynag.Control.Command.del_host_downtime(downtime_id)
Also if you have a recent version of adagios installed you can do more easily via web interface.
Kind regards,
Pall Sigurdsson
----- Original Message -----
From: "Rafał Radecki" <radecki.rafal at gmail.com>
To: nagios-users at lists.sourceforge.net
Sent: Wednesday, February 20, 2013 3:00:39 PM
Subject: [Nagios-users] Mass delete of host/service downtimes.
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?
Best regards,
Rafal Radecki.
------------------------------------------------------------------------------
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