make the status.dat file easier to read

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
JeffreySilverman
Posts: 2
Joined: Fri Apr 01, 2016 6:55 pm

make the status.dat file easier to read

Post by JeffreySilverman »

I looked at the status.dat file, which is located by the status_file directive in nagios.cfg.

In it, I see that nagios logs events and time stamps them with UNIX epochs, which is a counter of seconds since Midnight, January 1st, 1971.

It is very easy to convert from timestamps to real ASCII time strings that can be easily parsed by human beings. For example

Code: Select all

[nagios@nagios-test etc]$ perl -le 'print scalar localtime 1463616608;'
Wed May 18 17:10:08 2016
[nagios@nagios-test etc]$ 
or

Code: Select all

[nagios@nagios-test ~]$ python -c "from datetime import datetime; print datetime.fromtimestamp(1463616608)"
2016-05-18 17:10:08
[nagios@nagios-test ~]$
Could the nagios software to be modified to do that?


Many thanks,

Jeff
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: make the status.dat file easier to read

Post by tmcdonald »

It certainly could, but I don't think this will ever be default behavior. There are a lot of advantages to having logs and files be easily parsed by machines, most notably the speed you get from not having to do a lot of English -> datestamp conversions. This file is also not generally intended to be for human consumption primarily, but there are plenty of tools you can run it through that will do the conversion for you.
Former Nagios employee
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: make the status.dat file easier to read

Post by Box293 »

I hear what you're saying, but from a coding point of view epoch is such an easy number to programatically work with.

However there is no reason why you could not submit a feature request to GitHub so that the real date and time values were also written to the status.dat file in an additional field. Yes it would increase the size of the file, but it would certainly help reading it easier.

https://github.com/NagiosEnterprises/nagioscore
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked