Comments only Dashboard
Re: Comments only Dashboard
One more question. Is there a way to purge acknowledgements weekly?
Re: Comments only Dashboard
You could delete all acknowledgements and comments by setting up a bash script, for example "delete_acks.sh".
Make the script executable:
Set up a cron job to run weekly, for example at midnight, each Sunday:
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.
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 nagiosCode: Select all
chmod +x /usr/local/nagiosxi/scripts/delete_acks.shCode: Select all
0 0 * * 0 /usr/local/nagiosxi/scripts/delete_acks.shImportant: 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!
Re: Comments only Dashboard
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
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:
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.
Code: Select all
select * from nagios_comments WHERE comment_data NOT LIKE "%fixed downtime%";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
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.
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
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
@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:
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 startAs of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Comments only Dashboard
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
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.
Re: Comments only Dashboard
That wouldn't work because it also includes scheduled downtime.