Hi,
I could not find a plugin that does what you need, but you should look at
https://exchange.nagios.org//
to see if anyone else has created one.
If you don't see one there I suggest you leverage the objects/servicestatus which would provide you with the
following output for each service:
Code: Select all
"host_name": "localhost",
"service_description": "Current Load",
"display_name": "Current Load",
"host_object_id": "150",
"host_address": "127.0.0.1",
"host_alias": "localhost",
"icon_image": "",
"icon_image_alt": "",
"notes": "",
"notes_url": "",
"action_url": "",
"servicestatus_id": "1",
"instance_id": "1",
"service_object_id": "152",
"status_update_time": "2021-08-30 09:25:37",
"output": "OK - load average: 1.38, 1.04, 0.76",
"long_output": "",
"perfdata": "load1=1.380;5.000;10.000;0; load5=1.040;4.000;6.000;0; load15=0.760;3.000;4.000;0;",
"current_state": "0",
"has_been_checked": "1",
"should_be_scheduled": "1",
"current_check_attempt": "1",
"max_check_attempts": "4",
"last_check": "2021-08-30 09:25:37",
"next_check": "2021-08-30 09:30:37",
"check_type": "0",
"check_options": "0",
"last_state_change": "2021-06-21 09:59:07",
"last_hard_state_change": "2021-06-21 09:59:07",
"last_hard_state": "0",
"last_time_ok": "2021-08-30 09:25:37",
"last_time_warning": "1969-12-31 18:00:00",
"last_time_unknown": "1969-12-31 18:00:00",
"last_time_critical": "1969-12-31 18:00:00",
"state_type": "1",
"last_notification": "1969-12-31 18:00:00",
"next_notification": "1969-12-31 18:00:00",
"no_more_notifications": "0",
"notifications_enabled": "1",
"problem_has_been_acknowledged": "0",
"acknowledgement_type": "0",
"current_notification_number": "0",
"passive_checks_enabled": "1",
"active_checks_enabled": "1",
"event_handler_enabled": "1",
"flap_detection_enabled": "1",
"is_flapping": "0",
"percent_state_change": "0",
"latency": "0.000838999985717237",
"execution_time": "0.004135",
"scheduled_downtime_depth": "0",
"failure_prediction_enabled": "0",
"process_performance_data": "1",
"obsess_over_service": "1",
"modified_service_attributes": "0",
"event_handler": "",
"check_command": "check_local_load!5.0,4.0,3.0!10.0,6.0,4.0",
"normal_check_interval": "5",
"retry_check_interval": "1",
"check_timeperiod_object_id": "139"
You would need to use the fields "host_name" and "service_description" to identify the particular service and then
monitor the "output" field for a change from the previous check. You could also use the "next_check" field to tell your
plugin when to run next.
Thanks