last_hard_state vs state_type

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

last_hard_state vs state_type

Post by nagwindmon »

team, please help me understand state_type value. when I executing API to check on host status I'm looking for last_hard_state and if its = 1, fire alert excluding 2 which mean host unreachable. But state_type is always = 1 regardless as far as I can see.
Please advise.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: last_hard_state vs state_type

Post by lmiltchev »

This is what "state_type" means:
state_type = 0 is SOFT
state_type = 1 is HARD
Are you saying that your host is in a SOFT state, but you see:

Code: Select all

state_type = 1
in the REST API?
Be sure to check out our Knowledgebase for helpful articles and solutions!
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

Re: last_hard_state vs state_type

Post by nagwindmon »

what state_type value suppose to be when a new host being added and it is up running to start with?
yes, running REST API
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: last_hard_state vs state_type

Post by lmiltchev »

It should be:

Code: Select all

state_type = 1
provided the newly added host is in a HARD state.
Be sure to check out our Knowledgebase for helpful articles and solutions!
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

Re: last_hard_state vs state_type

Post by nagwindmon »

ok, got it. its still a bit confusing since it starts with 1 (hard state) then once issue has been detected it changes to 0 (soft) after x number of retires it goes back to 1 (hard) and stays so till another host state change occurs.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: last_hard_state vs state_type

Post by lmiltchev »

This is by design. Let us know if you have any further questions or it's ok to close this topic. Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

Re: last_hard_state vs state_type

Post by nagwindmon »

I'm good, thank you, go ahead lock it.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: last_hard_state vs state_type

Post by mbellerue »

Good to get that cleared up. Locking thread.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked