Scheduled Downtime

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
vishal313
Posts: 50
Joined: Wed Dec 18, 2019 10:23 pm

Scheduled Downtime

Post by vishal313 »

Hi All,

I need to know how can I find history about which nodes were configured for Scheduled Downtime in last one month or so.
We have Nagios XI 5.8.5.


Regards
Vishal Dhote
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Scheduled Downtime

Post by ssax »

There isn't currently a downtime history in the web interface, I have previously submitted a feature request for this but it hasn't been implemented yet.

You should be able to run this command I constructed for you to get that information, it will show the downtime history for the last month:

Code: Select all

mysql -uroot -pnagiosxi nagios -e "SELECT IF(nagios_downtimehistory.downtime_type = 2, 'host', 'service') as 'downtime_type', IF(nagios_downtimehistory.downtime_type = 2, host_objects.name1, service_objects.name1) AS 'host_name', IF(nagios_downtimehistory.downtime_type = 2, '', service_objects.name2) AS 'service_desc', nagios_downtimehistory.author_name, nagios_downtimehistory.comment_data, nagios_downtimehistory.actual_start_time FROM nagios_downtimehistory LEFT JOIN nagios_objects AS host_objects ON host_objects.object_id = nagios_downtimehistory.object_id AND nagios_downtimehistory.downtime_type = 2 LEFT JOIN nagios_objects AS service_objects ON service_objects.object_id = nagios_downtimehistory.object_id AND nagios_downtimehistory.downtime_type = 1 WHERE nagios_downtimehistory.actual_start_time BETWEEN DATE_FORMAT(NOW() - INTERVAL 1 MONTH, '\%Y-\%m-01 00:00:00') AND NOW() AND nagios_downtimehistory.was_cancelled = 0"
Or if you want it to go to a CSV file:

Code: Select all

mysql -uroot -pnagiosxi nagios -e "SELECT IF(nagios_downtimehistory.downtime_type = 2, 'host', 'service') as 'downtime_type', IF(nagios_downtimehistory.downtime_type = 2, host_objects.name1, service_objects.name1) AS 'host_name', IF(nagios_downtimehistory.downtime_type = 2, '', service_objects.name2) AS 'service_desc', nagios_downtimehistory.author_name, nagios_downtimehistory.comment_data, nagios_downtimehistory.actual_start_time FROM nagios_downtimehistory LEFT JOIN nagios_objects AS host_objects ON host_objects.object_id = nagios_downtimehistory.object_id AND nagios_downtimehistory.downtime_type = 2 LEFT JOIN nagios_objects AS service_objects ON service_objects.object_id = nagios_downtimehistory.object_id AND nagios_downtimehistory.downtime_type = 1 WHERE nagios_downtimehistory.actual_start_time BETWEEN DATE_FORMAT(NOW() - INTERVAL 1 MONTH, '\%Y-\%m-01 00:00:00') AND NOW() AND nagios_downtimehistory.was_cancelled = 0 INTO OUTFILE '/tmp/downtime_for_the_last_month.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n';"
You would find it here:

Code: Select all

/tmp/downtime_for_the_last_month.csv
OR here:

Code: Select all

ls -l /tmp/systemd-private-*-mariadb.service-*/tmp/downtime_for_the_last_month.csv
Locked