Page 1 of 1
Comments and Acknologements
Posted: Fri Sep 01, 2017 3:12 pm
by antorres
Hi.
I've got a situation going on with a Client. They want to export, control and see all the comments and Acknowledgments on all monitored services.
I Found already the location of a file (var/lib/mysql/nagios/nagios_acknowledgements.MYD) where i see the user that has made acknowledgements, and in other location (/usr/local/nagios/var/status.dat) found all the comments, but no time stamps attached.
Where I can find all this informations regarding this subject, such as, user, message, time stamp. etc.
It`s there a location in the DB where i can make a "select * from" to see and exports those data?
Thank you very much in advance.
Re: Comments and Acknologements
Posted: Fri Sep 01, 2017 4:04 pm
by scottwilkerson
antorres wrote:
I Found already the location of a file (var/lib/mysql/nagios/nagios_acknowledgements.MYD) where i see the user that has made acknowledgements
This would not have the comments, only ACK
antorres wrote:and in other location (/usr/local/nagios/var/status.dat) found all the comments, but no time stamps attached.
This is actually where current comments live, and you can get the timestamp as
entry_time field
BUT, the proper place to get these would be through the API under the Help menu in Nagios XI you will
Help -> REST API Docs -> Objects Reference -> objects/comment
Here you can get them all in JSON format
Re: Comments and Acknologements
Posted: Fri Sep 01, 2017 4:11 pm
by bheden
Absolutely!
Using the 'nagios' database, you can issue the following commands to see comments and comment history (this is very basic):
Code: Select all
SELECT author_name, comment_time, is_persistent, comment_data FROM nagios_comments;
SELECT author_name, comment_time, is_persistent, comment_data FROM nagios_commenthistory;
And to see the acknowledgements (also very basic):
Code: Select all
SELECT author_name, entry_time, is_sticky, persisent_comment, comment_data FROM nagios_acknowledgements;
For something a little bit more advanced (I'm only going to show you the one for commenthistory, but I think you'll be able to figure out with this example for the others):
Code: Select all
SELECT t2.name1 AS host_name, t2.name2 AS service_description, t1.author_name AS user, t1.comment_time AS time, t1.comment_data AS comment FROM nagios_commenthistory t1 LEFT JOIN nagios_objects t2 ON t1.object_id = t2.object_id ORDER BY host_name, service_description DESC;
Hope this helps!
Re: Comments and Acknologements
Posted: Tue Sep 05, 2017 8:39 am
by antorres
Thank you very much guys! IT works just fine.
I really appreciate your help.
Best Regards
Re: Comments and Acknologements
Posted: Tue Sep 05, 2017 9:06 am
by bolson
Closing this topic as resolved.
Thank you for visiting the Nagios Support Forum!