Page 1 of 1

How can I see historic comments

Posted: Mon Feb 21, 2011 7:38 pm
by Box293
When I acknowledge a service I type in a comment.

Later down the track when the service state returns to normal the comment dissapears.

Is it possible to display a report of comments for a service (or host) or are they lost forever?
Comment on Service.png
Comment in Core.png
Nagios XI 2009R1.4B running on a VMware VM on an ESXi 4.1 host.

Re: How can I see historic comments

Posted: Tue Feb 22, 2011 2:51 pm
by tonyyarusso
There are two MySQL tables (in the 'nagios' database) that appear to retain it after the service returns to OK:

Code: Select all

mysql> select * from nagios_acknowledgements\G
*************************** 1. row ***************************
  acknowledgement_id: 1
         instance_id: 1
          entry_time: 2011-01-26 12:14:37
     entry_time_usec: 684438
acknowledgement_type: 1
           object_id: 140
               state: 1
         author_name: Nagios Administrator
        comment_data: asd
           is_sticky: 1
  persistent_comment: 0
     notify_contacts: 1
*************************** 2. row ***************************
  acknowledgement_id: 2
         instance_id: 1
          entry_time: 2011-02-22 07:43:17
     entry_time_usec: 301751
acknowledgement_type: 1
           object_id: 165
               state: 2
         author_name: Nagios Administrator
        comment_data: Testing for Box293
           is_sticky: 1
  persistent_comment: 0
     notify_contacts: 1
2 rows in set (0.00 sec)

mysql> select * from nagios_commenthistory where commenthistory_id=102\G
*************************** 1. row ***************************
  commenthistory_id: 102
        instance_id: 1
         entry_time: 2011-02-22 07:43:17
    entry_time_usec: 482647
       comment_type: 2
         entry_type: 4
          object_id: 165
       comment_time: 2011-02-22 07:43:17
internal_comment_id: 102
        author_name: Nagios Administrator
       comment_data: Testing for Box293
      is_persistent: 0
     comment_source: 0
            expires: 0
    expiration_time: 1969-12-31 18:00:00
      deletion_time: 2011-02-22 07:45:52
 deletion_time_usec: 222997
1 row in set (0.00 sec)

Re: How can I see historic comments

Posted: Tue Feb 22, 2011 2:57 pm
by mguthrie
Hmm...I'm not sure about the purging process for comments, or how to change that. Here's what I know about comment and where they're stored. We don't have a front-end tool for accessing comment history.

DB:
- In MySQL there's the nagios.nagios_comments table which seems to store current active comments
- nagios.nagios_commenthistory which might have what you need. It seems to have non-persistant comments

FILE:
- comments (while in existence) are stored in the status.dat file, defined as "hostcomment" or "servicecomment."