On Mon, 20 Jan 2014, Franc wrote:
There is a simple solution to export to .csv the "Service Log Entries"
table in the "Service Availability Report" page?
Or example of related query to the DB?
I see no way to get that out of the CGIs, but there is a way to get
what you're after out of the database so long as you populate the
icinga_logentries file. Here's a look at live data for today for the
virus-scanner in my lab at home:
mysql> SELECT logentry_time,logentry_data FROM icinga_logentries
-> WHERE logentry_data LIKE '%t1;ClamAV%'
-> AND logentry_time >= '2014-01-19'
-> ORDER BY logentry_time ASC;
+---------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| logentry_time | logentry_data
|
+---------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| 2014-01-19 00:00:00 | CURRENT SERVICE STATE: t1;ClamAV;OK;HARD;1;TCP OK -
0.002 second response time on port 3310 [ClamAV 0.98/18370/Sat Jan 18 20:16:28
2014] |
| 2014-01-19 15:49:51 | SERVICE ALERT: t1;ClamAV;CRITICAL;SOFT;1;CRITICAL -
Socket timeout after 10 seconds
|
| 2014-01-19 15:51:51 | SERVICE ALERT: t1;ClamAV;CRITICAL;SOFT;2;CRITICAL -
Socket timeout after 10 seconds
|
| 2014-01-19 15:53:41 | SERVICE ALERT: t1;ClamAV;OK;SOFT;3;TCP OK - 0.002
second response time on port 3310 [ClamAV 0.98/18371/Sun Jan 19 14:20:55 2014]
|
| 2014-01-20 00:00:00 | CURRENT SERVICE STATE: t1;ClamAV;OK;HARD;1;TCP OK -
0.002 second response time on port 3310 [ClamAV 0.98/18372/Sun Jan 19 20:45:15
2014] |
+---------------------+------------------------------------------------------------------------------------------------------------------------------------------+
5 rows in set (0.02 sec)
mysql>
In that, the hostname is "t1" and the service is "ClamAV". The
timeperiod for the search is the WHERE clause; yesterday could have
been looked for with " WHERE logentry_time < '2014-01-19' AND
logentry_time >= '2014-01-18' ". The ORDER BY clause lets you set
the sort direction.
Cheers!
+------------------------------------------------+---------------------+
| Carl Richard Friend (UNIX Sysadmin) | West Boylston |
| Minicomputer Collector / Enthusiast | Massachusetts, USA |
| mailto:[email protected] +---------------------+
| http://users.rcn.com/crfriend/museum | ICBM: 42:22N 71:47W |
+------------------------------------------------+---------------------+
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users