Page 1 of 1

Host Duration shows as N/A

Posted: Tue Nov 26, 2019 2:41 pm
by nagwindmon
team, just a qq: Everything seems to be working correctly except I noticed on the host that the state duration is showing N/A for some reason even though it was changed it least once a few months back:

Re: Host Duration shows as N/A

Posted: Tue Nov 26, 2019 3:08 pm
by scottwilkerson
Generally, the only way this would happen would be, since the state change you show on 7/4/2019 have you disabled and then re-enabled this host? OR, have you removed the retention.dat file and restarted NAgios at any point?

The duration is held in Nagios (memory and retention.dat), whereas the state hostory you are showing is pulled from the database.

Re: Host Duration shows as N/A

Posted: Wed Nov 27, 2019 8:01 am
by nagwindmon
Host was not disabled and then re-enabled and no one touched retention.dat file but not sure if Nagios was restarted between those dates. On other hand if it was then all hosts duration should have been "resettled" but as I looked further I see mix of both.
Any way what my options are for those hosts to begin display duration times again?

Re: Host Duration shows as N/A

Posted: Wed Nov 27, 2019 3:42 pm
by scottwilkerson
Probably the easiest way is to set the initial_state parameter on your templates for hosts to be Up and Services to be Ok on the Check Settings Tab in the CCM for each template used.

Re: Host Duration shows as N/A

Posted: Tue Dec 03, 2019 10:25 am
by nagwindmon
we don't use templates any longer, all hosts/services being added/updated by APIs now, I could passed it in as a parameter &initial_state=up& but host is up now so that would not change anything?

Re: Host Duration shows as N/A

Posted: Tue Dec 03, 2019 10:29 am
by scottwilkerson
You can also set these on the services/hosts directly.

To do them all at once you can go to
CCM -> Tools -> Bulk Modifications Tool
Click Change a Single Config Option
Select Initial State from drop down
select "u" next to hosts and services

Select all your hosts/services
Click Save Changes
Apply Configuration

Re: Host Duration shows as N/A

Posted: Wed Dec 04, 2019 11:39 am
by nagwindmon
it appears what you've suggested makes no difference...
This is not affecting previously created hosts where they were up to start with. With that said, let me try to follow the logic: by default Nagios will assume that all hosts are in UP states when it starts so if its staying UP then Duration remains as N/A till state is change (host went down and come back up)?
So resolving N/A issue going forward would be to set log_initial_states to 1 in /usr/local/nagios/etc/nagios.cfg?

Re: Host Duration shows as N/A

Posted: Wed Dec 04, 2019 4:16 pm
by scottwilkerson
nagwindmon wrote:So resolving N/A issue going forward would be to set log_initial_states to 1 in /usr/local/nagios/etc/nagios.cfg?
yes