Log-rotation and availability-report

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.
zulu42
Posts: 17
Joined: Thu Jan 14, 2016 7:11 am

Log-rotation and availability-report

Post by zulu42 »

Hi all,

I have two questions:
1:
I set the log-rotation-method to daily in nagios 3.5.1 and also manually set a different directory (than the default one) to store them.
For some reason nagios isn't rotating the log daily (also not hourly, if I set it to "h"). And also it's not using the directory, I set.
Is this a known problem?

2:
I use the availability-reporting in the following way:
There are two services (in one servicegroup) on 5 nodes and out of this I let nagios calculate the report weekly by the servicegroup.
Where does nagios get it's information for this report from?
On a different server (where I don't have the log-rotation-problem), nagios rotates the files every day at midnight. But during this, nagios just saves the current state of the hosts and their respective checks.
So nagios must use another log-file for this, as this wouldn't be a sufficient statement about the availability, if it's just using the midnight-state (even when the host was down for e.g. 9h on 2 days in the week). Or would nagios write this information to that file?

Thanks all for you help!

BR
zulu42
Posts: 17
Joined: Thu Jan 14, 2016 7:11 am

Re: Log-rotation and availability-report

Post by zulu42 »

Short update:
I could resolve problem one by changing the ownership of the folder, the logrotation should write to.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Log-rotation and availability-report

Post by hsmith »

Since you resolved this before we could post, is there anything else you would like help with in this thread, or should I close it?
Former Nagios Employee.
me.
zulu42
Posts: 17
Joined: Thu Jan 14, 2016 7:11 am

Re: Log-rotation and availability-report

Post by zulu42 »

My second question/problem still needs to be answered:
2:
I use the availability-reporting in the following way:
There are two services (in one servicegroup) on 5 nodes and out of this I let nagios calculate the report weekly by the servicegroup.
Where does nagios get it's information for this report from?
On a different server (where I don't have the log-rotation-problem), nagios rotates the files every day at midnight. But during this, nagios just saves the current state of the hosts and their respective checks.
So nagios must use another log-file for this, as this wouldn't be a sufficient statement about the availability, if it's just using the midnight-state (even when the host was down for e.g. 9h on 2 days in the week). Or would nagios write this information to that file?
I hope someone can help me with this?
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Log-rotation and availability-report

Post by tgriep »

The Availability report does use the nagios.log file and the archives to generate the report.
When you run the report with "Assume Initial States" as yes, if Nagios does not know the initial state of host when the period begins, it will use the object initial state. Otherwise I presume it will be treated as "Unknown"
Be sure to check out our Knowledgebase for helpful articles and solutions!
zulu42
Posts: 17
Joined: Thu Jan 14, 2016 7:11 am

Re: Log-rotation and availability-report

Post by zulu42 »

Sorry, but I'm a bit confused about this sentence:
When you run the report with "Assume Initial States" as yes, if Nagios does not know the initial state of host when the period begins, it will use the object initial state.
Do you mean, if I e.g. let the log rotate every hour, it's just using the states which are known at the moment of the log-rotation and assumes that at any other time the host or the services were fully available?
In this case, this would mean, that these reports are just a nice looking feature, which don't say anything at all (and is getting even worse if you let the log rotate e.g. daily and create monthly reports)???
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Log-rotation and availability-report

Post by tgriep »

The report should look at the data from the rotation at midnight (Current State) at the start of the report and go forward to calculate the Availability if the data is in the logs.
If you set the Assume Initial State to No, and the Nagios system doesn't know the state, it will be shown as unknown.
Be sure to check out our Knowledgebase for helpful articles and solutions!
zulu42
Posts: 17
Joined: Thu Jan 14, 2016 7:11 am

Re: Log-rotation and availability-report

Post by zulu42 »

Sorry for asking again but let me give you an example:
I do hourly rotation of the logs (all the time to the full hour).
One of my server breaks down on the 16.02.2016 at 15:12 and I can fix it by 15:49 and all checks are "OK" again.
So I have the state of 15:00 and 16:00 and in no rotated log this will show up then, right?
If I now go ahaead and create availability reports, this impact/short outage will not be included in the calculation, if I set the "Assume Initial States" to "Yes" and the "First Assumed Host State" to "Host Up" and the "First Assumed Service State" to Serverice Ok", right?
Please correct me if I'm wrong and thanks for the help!
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Log-rotation and availability-report

Post by hsmith »

From some testing that I just did, it looks like the report is going to look at everything in the archives directory, not just the current log. Does that indirectly answer your question, or would you like us to investigate further? This was tested on 4.1.1.
Former Nagios Employee.
me.
zulu42
Posts: 17
Joined: Thu Jan 14, 2016 7:11 am

Re: Log-rotation and availability-report

Post by zulu42 »

Unfortunately no, this doesn't answer my question.
I don't think, that it makes a big difference, if I'm using 3.5.1 (from EPEL-repo).
Just to precise my question:
I know, that the availability-reporting-tool is looking into all files.
My question was more likely, if nagios can include the alerts/outages/problems between two log-rotations (assuming we do hourly log-rotation) into the calculation of the availability.
This question arises, because I noticed that nagios only saves the "current state" of hosts/services at that particular point in time where the rotation happens and "throws away the rest of the last hour/since the last rotation".
If this is the case, nagios only has 24 states per day (assuming we still do hourly rotation) to calculate the availability.
And assuming we switch to daily log-rotation, we would only have 1 state per day and could not include an 3h outage, which started e.g. at 9am.

I hope this explains my problem a bit better.
Thanks a lot for trying to help me! :)
Locked