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.
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"
}
It's probably best to read the entries from bottom to top.