Page 2 of 2
Re: no Host duration : N/A (no Host Uptime)
Posted: Thu Feb 19, 2015 2:48 pm
by tgriep
Here is the definition of the Initial State setting.
initial_state: By default Nagios will assume that all hosts are in UP states when it starts. You can override the initial state for a host by using this directive. Valid options are: o = UP, d = DOWN, and u = UNREACHABLE.
So if you set the initial state to "o" which is up and the host never goes to a hard state of down, the Duration time will not be correct. So by changing it to "d", Down and the first check it is in a UP state, the Duration time will start at that point.
Re: no Host duration : N/A (no Host Uptime)
Posted: Thu Feb 19, 2015 2:49 pm
by abrist
As Scott stated, change:
To:
log_initial_states=1
Apply config.
questrad wrote:I changed to have initial state in host = "d" instead of "o" and added new host - everything goes perfect and I get uptime duration right away.
The only issue with this is the initial state will be DOWN until the first check. This may skew your availability reports.
Re: no Host duration : N/A (no Host Uptime)
Posted: Thu Feb 19, 2015 5:33 pm
by questrad
Thanks for getting back, I have already read all of that.
But how I understand - It can be some bug or we need to have documented it - how to add host
Please make clear now, what we need to use - changing global in nagios.cfg or on host/template for host level?
I like the host/template level
Thanks
Re: no Host duration : N/A (no Host Uptime)
Posted: Thu Feb 19, 2015 5:40 pm
by scottwilkerson
This config option is only global, so in nagios.cfg
Re: no Host duration : N/A (no Host Uptime)
Posted: Thu Feb 19, 2015 10:08 pm
by questrad
Thanks Scott,
But question - why it did not happened until this last time?
We have about 270 hosts on that Nagios and I hit this issue first time.
I have host which is already 106 day in uptime (this is new setup of Nagios server) and they went never down from start day of adding in Nagios - it is our Production environment.
Re: no Host duration : N/A (no Host Uptime)
Posted: Fri Feb 20, 2015 1:42 pm
by scottwilkerson
questrad wrote:But question - why it did not happened until this last time?
It could be because, as you said the initial state was down. You are comparing it to something that has always been up
Re: no Host duration : N/A (no Host Uptime)
Posted: Fri Feb 20, 2015 1:47 pm
by questrad
No, the initial state I have started to play when I saw issue.
I mostly dont change the default settings - they are matching my expectation for now.
It is bug I think and needs to be fixed.
Re: no Host duration : N/A (no Host Uptime)
Posted: Fri Feb 20, 2015 3:33 pm
by cmerchant
We'll look into it further. Thanks.