For the API - Object Reference GET objects/statehistory what are all of the potential values ("0", "1", "2", etc) and what do they mean?
{
"recordcount": "2",
"stateentry": [
{
"instance_id": "1",
"state_time": "2015-09-24 03:39:52",
"object_id": "175",
"objecttype_id": "2",
"host_name": "127.0.0.1",
"service_description": "Load",
"state_change": "1",
"state": "2",
"state_type": "0",
"current_check_attempt": "1",
"max_check_attempts": "5",
"last_state": "0",
"last_hard_state": "0",
"output": "awfawfawf"
},
GET objects/statehistory values
Re: GET objects/statehistory values
state_change is 0 or 1. This tells us whether or not the state has changed from the previous check. 0 for no, 1 for yes.
state is 0,1,2,3, representing the typical states. 0 for OK, 1 for WARNING, 2 for CRITICAL, and 3 for UNKNOWN.
state_type is 0 or 1. This tells us whether this is a 0 SOFT, or 1 HARD state.
last_state is 0,1,2,3. Just like the state field, except this tells us what the previous check's state was.
last_hard_state is 0,1,2,3. Just like the state field, except this one tells us what the last HARD state was.
Here's a real world example. It might make more sense to watch as a service goes from WARNING to OK. This service checks the memory on my local XI machine.
It's probably best to read the entries from bottom to top.
state is 0,1,2,3, representing the typical states. 0 for OK, 1 for WARNING, 2 for CRITICAL, and 3 for UNKNOWN.
state_type is 0 or 1. This tells us whether this is a 0 SOFT, or 1 HARD state.
last_state is 0,1,2,3. Just like the state field, except this tells us what the previous check's state was.
last_hard_state is 0,1,2,3. Just like the state field, except this one tells us what the last HARD state was.
Here's a real world example. It might make more sense to watch as a service goes from WARNING to OK. This service checks the memory on my local XI machine.
Code: Select all
{
"instance_id": "1",
"state_time": "2019-12-03 21:50:18",
"object_id": "155",
"objecttype_id": "2",
"host_name": "localhost",
"service_description": "Memory Usage",
"state_change": "1",
"state": "0",
"state_type": "1",
"current_check_attempt": "4",
"max_check_attempts": "4",
"last_state": "1",
"last_hard_state": "1",
"output": "OK - 643 \/ 1993 MB (32%) Free Memory, Used: 1229 MB, Shared: 25 MB, Buffers + Cached: 469 MB"
},
{
"instance_id": "1",
"state_time": "2019-12-03 21:45:18",
"object_id": "155",
"objecttype_id": "2",
"host_name": "localhost",
"service_description": "Memory Usage",
"state_change": "1",
"state": "1",
"state_type": "1",
"current_check_attempt": "4",
"max_check_attempts": "4",
"last_state": "1",
"last_hard_state": "0",
"output": "WARNING - 616 \/ 1993 MB (30%) Free Memory, Used: 1227 MB, Shared: 25 MB, Buffers + Cached: 523 MB"
},
{
"instance_id": "1",
"state_time": "2019-12-03 21:44:21",
"object_id": "155",
"objecttype_id": "2",
"host_name": "localhost",
"service_description": "Memory Usage",
"state_change": "1",
"state": "1",
"state_type": "0",
"current_check_attempt": "3",
"max_check_attempts": "4",
"last_state": "1",
"last_hard_state": "0",
"output": "WARNING - 615 \/ 1993 MB (30%) Free Memory, Used: 1227 MB, Shared: 25 MB, Buffers + Cached: 523 MB"
},
{
"instance_id": "1",
"state_time": "2019-12-03 21:43:21",
"object_id": "155",
"objecttype_id": "2",
"host_name": "localhost",
"service_description": "Memory Usage",
"state_change": "1",
"state": "1",
"state_type": "0",
"current_check_attempt": "2",
"max_check_attempts": "4",
"last_state": "1",
"last_hard_state": "0",
"output": "WARNING - 616 \/ 1993 MB (30%) Free Memory, Used: 1226 MB, Shared: 25 MB, Buffers + Cached: 523 MB"
},
{
"instance_id": "1",
"state_time": "2019-12-03 21:42:21",
"object_id": "155",
"objecttype_id": "2",
"host_name": "localhost",
"service_description": "Memory Usage",
"state_change": "1",
"state": "1",
"state_type": "0",
"current_check_attempt": "1",
"max_check_attempts": "4",
"last_state": "0",
"last_hard_state": "0",
"output": "WARNING - 617 \/ 1993 MB (30%) Free Memory, Used: 1225 MB, Shared: 25 MB, Buffers + Cached: 523 MB"
}
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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
meganwilliford
- Posts: 101
- Joined: Tue Aug 06, 2019 7:49 am
Re: GET objects/statehistory values
Great, thanks! You can lock this post.