question about about output from jsonquery.html
Posted: Fri Mar 24, 2017 3:02 pm
Hi ,
I am using the json query generator to export some nagios data to an external reporting system. Inserted is the output from a query, I am just wondering how to translate the state field? its not in the 0,1,2,3 or 4 that I was expecting. I'm assuming object_type of 2 is for service and state_type of 1 is for hard
{
"format_version": 0,
"result": {
"query_time": 1490384843000,
"cgi": "archivejson.cgi",
"user": "nagiosadmin",
"query": "statechangelist",
"query_status": "released",
"program_start": 1490375704000,
"last_data_update": 1488783193000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"selectors": {
"starttime": 1488672000000,
"endtime": 1488758400000,
"hostname": "Service Availability",
"servicedescription": "ITSM",
"statetypes": 1
},
"statechangelist": [
{
"timestamp": 1488672000000,
"object_type": 2,
"host_name": "Service Availability",
"description": "ITSM",
"state_type": 1,
"state": 8,
"plugin_output": "Initial Service Pseudo-State"
},
{
"timestamp": 1488697200000,
"object_type": 2,
"host_name": "Service Availability",
"description": "ITSM",
"state_type": 1,
"state": 8,
"plugin_output": "OK - 2 plugins checked, 2 ok"
},
{
"timestamp": 1488740269000,
"object_type": 2,
"host_name": "Service Availability",
"description": "ITSM",
"state_type": 1,
"state": 32,
"plugin_output": "CRITICAL - 2 plugins checked, 1 critical (login_www_itsmprd_Service_Availability_-_itsm_selenium_login), 1 ok"
},
{
"timestamp": 1488740564000,
"object_type": 2,
"host_name": "Service Availability",
"description": "ITSM",
"state_type": 1,
"state": 8,
"plugin_output": "OK - 2 plugins checked, 2 ok"
}
]
}
}
I am using the json query generator to export some nagios data to an external reporting system. Inserted is the output from a query, I am just wondering how to translate the state field? its not in the 0,1,2,3 or 4 that I was expecting. I'm assuming object_type of 2 is for service and state_type of 1 is for hard
{
"format_version": 0,
"result": {
"query_time": 1490384843000,
"cgi": "archivejson.cgi",
"user": "nagiosadmin",
"query": "statechangelist",
"query_status": "released",
"program_start": 1490375704000,
"last_data_update": 1488783193000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"selectors": {
"starttime": 1488672000000,
"endtime": 1488758400000,
"hostname": "Service Availability",
"servicedescription": "ITSM",
"statetypes": 1
},
"statechangelist": [
{
"timestamp": 1488672000000,
"object_type": 2,
"host_name": "Service Availability",
"description": "ITSM",
"state_type": 1,
"state": 8,
"plugin_output": "Initial Service Pseudo-State"
},
{
"timestamp": 1488697200000,
"object_type": 2,
"host_name": "Service Availability",
"description": "ITSM",
"state_type": 1,
"state": 8,
"plugin_output": "OK - 2 plugins checked, 2 ok"
},
{
"timestamp": 1488740269000,
"object_type": 2,
"host_name": "Service Availability",
"description": "ITSM",
"state_type": 1,
"state": 32,
"plugin_output": "CRITICAL - 2 plugins checked, 1 critical (login_www_itsmprd_Service_Availability_-_itsm_selenium_login), 1 ok"
},
{
"timestamp": 1488740564000,
"object_type": 2,
"host_name": "Service Availability",
"description": "ITSM",
"state_type": 1,
"state": 8,
"plugin_output": "OK - 2 plugins checked, 2 ok"
}
]
}
}