Comments only Dashboard

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Comments only Dashboard

Post by emartine »

One more question. Is there a way to purge acknowledgements weekly?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Comments only Dashboard

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Comments only Dashboard

Post by emartine »

Would this also enable notifications to the items where acknowledgements have been removed?
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Comments only Dashboard

Post 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.
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Comments only Dashboard

Post 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.
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Comments only Dashboard

Post 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.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Comments only Dashboard

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Comments only Dashboard

Post 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?
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Comments only Dashboard

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
emartine
Posts: 660
Joined: Thu Dec 29, 2011 10:47 am

Re: Comments only Dashboard

Post by emartine »

That wouldn't work because it also includes scheduled downtime.
Locked