Page 2 of 3

Re: Comments only Dashboard

Posted: Tue Dec 19, 2017 11:23 am
by emartine
One more question. Is there a way to purge acknowledgements weekly?

Re: Comments only Dashboard

Posted: Tue Dec 19, 2017 1:00 pm
by lmiltchev
You could delete all acknowledgements and comments by setting up a bash script, for example "delete_acks.sh".

Code: Select all

#!/bin/bash
echo 'DELETE FROM nagios_acknowledgements;' | mysql -uroot -pnagiosxi nagios
echo 'DELETE FROM nagios_comments;' | mysql -uroot -pnagiosxi nagios
echo 'delete from nagios_hoststatus where problem_has_been_acknowledged=1;' | mysql -uroot -pnagiosxi nagios
echo 'delete from nagios_servicestatus where problem_has_been_acknowledged=1;' | mysql -uroot -pnagiosxi nagios
Make the script executable:

Code: Select all

chmod +x /usr/local/nagiosxi/scripts/delete_acks.sh
Set up a cron job to run weekly, for example at midnight, each Sunday:

Code: Select all

0 0 * * 0 /usr/local/nagiosxi/scripts/delete_acks.sh
Note: If you place the script in a different directory, modify the above commands accordingly.

Important: Do your backups, snapshots, etc. and try this in a test environment first!

Let us know if this helped.

Re: Comments only Dashboard

Posted: Tue Dec 19, 2017 2:32 pm
by emartine
Would this also enable notifications to the items where acknowledgements have been removed?

Re: Comments only Dashboard

Posted: Tue Dec 19, 2017 5:11 pm
by dwhitfield
I would assume so, but that's not what you want. You just want to remove them as comments, right? You could do that anyway, but you could form a dashboard around this query:

Code: Select all

select * from nagios_comments WHERE comment_data NOT LIKE "%fixed downtime%";
That's only going to work for fixed, not flexible, of course. You could try "downtime" instead but it seems more likely to catch a user-entered comment.

It looks like you could also use the comment_type and entry_type fields, but although these differ between the two, I am not sure what might also be caught in the net. You'll likely just need to play with it on a test server.

Re: Comments only Dashboard

Posted: Tue Dec 19, 2017 6:16 pm
by emartine
I actually would absolutely like them to go away as well. Them being the supression of acknowledged items but not the fixed scheduled downtimes. (edited)

The reason for this is due to folks acknowledging, supressing and forgetting about critical items and they don't ever get taken care of. I want them to become active again weekly. I do not want to do that to items that have a set downtime schedule however.


As for a dashboard I was looking for something similar to:

https://server/nagiosxi/includes/compon ... viceattr=4

which I can add to the Custom URL dashlet but I would need to have the users name that acknowledged it.

Similar to

https://server/nagios/cgi-bin/extinfo.cgi?type=3

but with the removal of items that have Scheduled Downtime.

Ideally it would be best to have it under https://server/nagiosxi/ so that folks didn't have to authenticate again.

Re: Comments only Dashboard

Posted: Tue Dec 19, 2017 9:46 pm
by emartine
By the way. I ran these lines on our test server and it removed all acknowledgements and comments from the acknowledgements page but the tactical overview still showed host and services still acknowledged.

Re: Comments only Dashboard

Posted: Wed Dec 20, 2017 1:53 pm
by npolovenko
@emartine, Here's a way to remove acknowledgments without mysql:
1. Stop the nagios service with service nagios stop
2. Open this file nano /usr/local/nagios/var/retention.dat
3. Search for problem_has_been_acknowledged=1 and change all occurrences of it to problem_has_been_acknowledged=0
4.Start the nagios service with service nagios start

You could write a shell script that will do this algorithm for you and put it inside a cron file:

Code: Select all

service nagios stop
sed -i 's/problem_has_been_acknowledged=1/problem_has_been_acknowledged=0/g' /usr/local/nagios/var/retention.dat
service nagios start

Re: Comments only Dashboard

Posted: Fri Dec 22, 2017 5:04 pm
by emartine
Thanks. I will try this in our test environment. Dashboard wise any way to get a dashboard that has user acknowledgements with user names?

Re: Comments only Dashboard

Posted: Wed Dec 27, 2017 10:26 am
by npolovenko
Hello, @emartine. You could right-click on the "acknowledgments" menu, and select "Copy Link address". Then you'd create a new dashboard, then under available dashlets, you'd add a "Custom URL dashlet" with the URL you just copied. Let me know if that's what you wanted.

Re: Comments only Dashboard

Posted: Wed Jan 03, 2018 1:57 pm
by emartine
That wouldn't work because it also includes scheduled downtime.