Alert History - nagios.log file does not display alert date

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
fialae
Posts: 3
Joined: Wed Jan 02, 2013 2:43 pm

Alert History - nagios.log file does not display alert date

Post by fialae »

Nagios Core v 3.2.2
Is there a file that lists the alert history? I select Reports - Alerts - History. From the display i see the file is /usr/local/nagios/var/nagios.log. When I access the log i do see the alerts - but not the date they occured.

How can i get this information? I need a listing of alerts going back 3 months.

Thank you.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Alert History - nagios.log file does not display alert d

Post by slansing »

The reports menu in core pulls directly from the nagios.log file as you said, but it is parsed before it is dumped to the Web UI, this is where you get the chronological lists/graph from.
fialae
Posts: 3
Joined: Wed Jan 02, 2013 2:43 pm

Re: Alert History - nagios.log file does not display alert d

Post by fialae »

Is there a alert history download that lists the alert as well as the date the alert occured?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Alert History - nagios.log file does not display alert d

Post by abrist »

Additionally, you can run a grep on the archives folder (with wildcard) for "ALERT" to get a full list of alerts.

Code: Select all

root@localhost$  cat /usr/local/nagios/var/archives/* | grep ALERT  >> alerts
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
fialae
Posts: 3
Joined: Wed Jan 02, 2013 2:43 pm

Re: Alert History - nagios.log file does not display alert d

Post by fialae »

How can one get the date to appear next to the alert? Here is an example of what i receive. I need to see the date it occured with it.

[1329144231] SERVICE ALERT: dfw01-is02-006;cpu load maui;WARNING;HARD;4;WARNING - load average: 5.04, 4.67, 5.04
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Alert History - nagios.log file does not display alert d

Post by abrist »

fialae wrote:How can one get the date to appear next to the alert? Here is an example of what i receive. I need to see the date it occured with it.

[1329144231] SERVICE ALERT: dfw01-is02-006;cpu load maui;WARNING;HARD;4;WARNING - load average: 5.04, 4.67, 5.04
You will need to script a solution, or convert all unix time codes to date/time by hand. You can convert a unix time code string in bash with:

Code: Select all

date -d @[unixtime]
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked