REST API Commands

new in release v2.24

Thruk offers a rest api to expose various aspects of Thruk itself and livestatus information.

Read more about the REST API itself. This page contains the comprehensive list of all available external commands.

Response

In case the command was successful, a simple json message is returned:

    %> thruk r -d "comment_data=test" /hosts/localhost/cmd/schedule_host_downtime
    {
      "message" : "Command successfully submitted"
    }

However, due to the way external commands are implemented throughout the various cores, this message does not neccessarily mean the command was successful. Only the submission was successful.

If the core supports it (which is currently only Naemon >= 1.0.9) you will get a error response if something did not work like this:

    %> thruk r -d "comment_data=test" -d "triggered_by=xxx" /hosts/localhost/cmd/schedule_host_downtime
    {
      "code" : 400,
      "error" : "400: Couldn't parse ulong argument trigger_id (argument 4): No digits found in ulong 'xxx'\n",
      "message" : "sending command failed"
    }

Arguments and default values

Each command can have required and optional arguments which are listed along with the command itself.

Some of the arguments have default values:

  • comment_author: defaults to the current user and cannot be changed usually

  • fixed: defaults to 1

  • duration: defaults to 0

  • triggered_by: defaults to 0

  • start_time: defaults to now

  • end_time: defaults to now + downtime_duration from the thruk.conf

Relative timestamps

Timestamps, like start_date and end_date can be relative to get more reusable commands.

    %> thruk r -d "end_time=+60m" -d "comment_data='downtime comment'" '/services/<host>/<svc>/cmd/schedule_svc_downtime'

This will create a 1hour downtime. Other suffixes are:

  • y: years

  • w: weeks

  • d: days

  • h: hours

  • m: minutes

Example Usage

All examples can be found on the REST API Examples page.

Endpoints

See examples and detailed description for all available rest api command urls:

POST /hostgroups/<name>/cmd/disable_hostgroup_host_checks

Sends the DISABLE_HOSTGROUP_HOST_CHECKS command.

This command does not require any arguments.

POST /hostgroups/<name>/cmd/disable_hostgroup_host_notifications

Sends the DISABLE_HOSTGROUP_HOST_NOTIFICATIONS command.

This command does not require any arguments.

POST /hostgroups/<name>/cmd/disable_hostgroup_svc_checks

Sends the DISABLE_HOSTGROUP_SVC_CHECKS command.

This command does not require any arguments.

POST /hostgroups/<name>/cmd/disable_hostgroup_svc_notifications

Sends the DISABLE_HOSTGROUP_SVC_NOTIFICATIONS command.

This command does not require any arguments.

POST /hostgroups/<name>/cmd/enable_hostgroup_host_checks

Sends the ENABLE_HOSTGROUP_HOST_CHECKS command.

This command does not require any arguments.

POST /hostgroups/<name>/cmd/enable_hostgroup_host_notifications

Sends the ENABLE_HOSTGROUP_HOST_NOTIFICATIONS command.

This command does not require any arguments.

POST /hostgroups/<name>/cmd/enable_hostgroup_svc_checks

Sends the ENABLE_HOSTGROUP_SVC_CHECKS command.

This command does not require any arguments.

POST /hostgroups/<name>/cmd/enable_hostgroup_svc_notifications

Sends the ENABLE_HOSTGROUP_SVC_NOTIFICATIONS command.

This command does not require any arguments.

POST /hostgroups/<name>/cmd/schedule_hostgroup_host_downtime

Sends the SCHEDULE_HOSTGROUP_HOST_DOWNTIME command.

Required arguments:

  • comment_data

Optional arguments:

  • start_time

  • end_time

  • fixed

  • duration

  • comment_author

POST /hostgroups/<name>/cmd/schedule_hostgroup_svc_downtime

Sends the SCHEDULE_HOSTGROUP_SVC_DOWNTIME command.

Required arguments:

  • comment_data

Optional arguments:

  • start_time

  • end_time

  • fixed

  • duration

  • comment_author

POST /hosts/<name>/cmd/acknowledge_host_problem

Sends the ACKNOWLEDGE_HOST_PROBLEM command.

Required arguments:

  • comment_data

Optional arguments:

  • sticky_ack

  • send_notification

  • persistent_comment

  • comment_author

POST /hosts/<name>/cmd/acknowledge_host_problem_expire

Sends the ACKNOWLEDGE_HOST_PROBLEM_EXPIRE command.

Required arguments:

  • comment_data

Optional arguments:

  • sticky_ack

  • send_notification

  • persistent_comment

  • end_time

  • comment_author

POST /hosts/<name>/cmd/add_host_comment

Sends the ADD_HOST_COMMENT command.

Required arguments:

  • comment_data

Optional arguments:

  • persistent_comment

  • comment_author

POST /hosts/<name>/cmd/change_host_modattr

Sends the CHANGE_HOST_MODATTR command.

This command does not require any arguments.

POST /hosts/<name>/cmd/del_all_host_comments

Sends the DEL_ALL_HOST_COMMENTS command.

This command does not require any arguments.

POST /hosts/<name>/cmd/delay_host_notification

Sends the DELAY_HOST_NOTIFICATION command.

Required arguments:

  • notification_time

POST /hosts/<name>/cmd/disable_all_notifications_beyond_host

Sends the DISABLE_ALL_NOTIFICATIONS_BEYOND_HOST command.

This command does not require any arguments.

POST /hosts/<name>/cmd/disable_host_and_child_notifications

Sends the DISABLE_HOST_AND_CHILD_NOTIFICATIONS command.

This command does not require any arguments.

POST /hosts/<name>/cmd/disable_host_check

Sends the DISABLE_HOST_CHECK command.

This command does not require any arguments.

POST /hosts/<name>/cmd/disable_host_event_handler

Sends the DISABLE_HOST_EVENT_HANDLER command.

This command does not require any arguments.

POST /hosts/<name>/cmd/disable_host_flap_detection

Sends the DISABLE_HOST_FLAP_DETECTION command.

This command does not require any arguments.

POST /hosts/<name>/cmd/disable_host_notifications

Sends the DISABLE_HOST_NOTIFICATIONS command.

This command does not require any arguments.

POST /hosts/<name>/cmd/disable_host_svc_checks

Sends the DISABLE_HOST_SVC_CHECKS command.

This command does not require any arguments.

POST /hosts/<name>/cmd/disable_host_svc_notifications

Sends the DISABLE_HOST_SVC_NOTIFICATIONS command.

This command does not require any arguments.

POST /hosts/<name>/cmd/disable_passive_host_checks

Sends the DISABLE_PASSIVE_HOST_CHECKS command.

This command does not require any arguments.

POST /hosts/<name>/cmd/enable_all_notifications_beyond_host

Sends the ENABLE_ALL_NOTIFICATIONS_BEYOND_HOST command.

This command does not require any arguments.

POST /hosts/<name>/cmd/enable_host_and_child_notifications

Sends the ENABLE_HOST_AND_CHILD_NOTIFICATIONS command.

This command does not require any arguments.

POST /hosts/<name>/cmd/enable_host_check

Sends the ENABLE_HOST_CHECK command.

This command does not require any arguments.

POST /hosts/<name>/cmd/enable_host_event_handler

Sends the ENABLE_HOST_EVENT_HANDLER command.

This command does not require any arguments.

POST /hosts/<name>/cmd/enable_host_flap_detection

Sends the ENABLE_HOST_FLAP_DETECTION command.

This command does not require any arguments.

POST /hosts/<name>/cmd/enable_host_notifications

Sends the ENABLE_HOST_NOTIFICATIONS command.

This command does not require any arguments.

POST /hosts/<name>/cmd/enable_host_svc_checks

Sends the ENABLE_HOST_SVC_CHECKS command.

This command does not require any arguments.

POST /hosts/<name>/cmd/enable_host_svc_notifications

Sends the ENABLE_HOST_SVC_NOTIFICATIONS command.

This command does not require any arguments.

POST /hosts/<name>/cmd/enable_passive_host_checks

Sends the ENABLE_PASSIVE_HOST_CHECKS command.

This command does not require any arguments.

POST /hosts/<name>/cmd/process_host_check_result

Sends the PROCESS_HOST_CHECK_RESULT command.

Required arguments:

  • plugin_output

Optional arguments:

  • plugin_state

  • performance_data

POST /hosts/<name>/cmd/remove_host_acknowledgement

Sends the REMOVE_HOST_ACKNOWLEDGEMENT command.

This command does not require any arguments.

POST /hosts/<name>/cmd/schedule_and_propagate_host_downtime

Sends the SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME command.

Required arguments:

  • comment_data

Optional arguments:

  • start_time

  • end_time

  • fixed

  • triggered_by

  • duration

  • comment_author

POST /hosts/<name>/cmd/schedule_and_propagate_triggered_host_downtime

Sends the SCHEDULE_AND_PROPAGATE_TRIGGERED_HOST_DOWNTIME command.

Required arguments:

  • comment_data

Optional arguments:

  • start_time

  • end_time

  • fixed

  • triggered_by

  • duration

  • comment_author

POST /hosts/<name>/cmd/schedule_forced_host_check

Sends the SCHEDULE_FORCED_HOST_CHECK command.

Optional arguments:

  • start_time

POST /hosts/<name>/cmd/schedule_forced_host_svc_checks

Sends the SCHEDULE_FORCED_HOST_SVC_CHECKS command.

Optional arguments:

  • start_time

POST /hosts/<name>/cmd/schedule_host_check

Sends the SCHEDULE_HOST_CHECK command.

Optional arguments:

  • start_time

POST /hosts/<name>/cmd/schedule_host_downtime

Sends the SCHEDULE_HOST_DOWNTIME command.

Required arguments:

  • comment_data

Optional arguments:

  • start_time

  • end_time

  • fixed

  • triggered_by

  • duration

  • comment_author

POST /hosts/<name>/cmd/schedule_host_svc_checks

Sends the SCHEDULE_HOST_SVC_CHECKS command.

Optional arguments:

  • start_time

POST /hosts/<name>/cmd/schedule_host_svc_downtime

Sends the SCHEDULE_HOST_SVC_DOWNTIME command.

Required arguments:

  • comment_data

Optional arguments:

  • start_time

  • end_time

  • fixed

  • triggered_by

  • duration

  • comment_author

POST /hosts/<name>/cmd/send_custom_host_notification

Sends the SEND_CUSTOM_HOST_NOTIFICATION command.

Required arguments:

  • comment_data

Optional arguments:

  • options

  • comment_author

POST /hosts/<name>/cmd/start_obsessing_over_host

Sends the START_OBSESSING_OVER_HOST command.

This command does not require any arguments.

POST /hosts/<name>/cmd/stop_obsessing_over_host

Sends the STOP_OBSESSING_OVER_HOST command.

This command does not require any arguments.

POST /servicegroups/<name>/cmd/disable_servicegroup_host_checks

Sends the DISABLE_SERVICEGROUP_HOST_CHECKS command.

This command does not require any arguments.

POST /servicegroups/<name>/cmd/disable_servicegroup_host_notifications

Sends the DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS command.

This command does not require any arguments.

POST /servicegroups/<name>/cmd/disable_servicegroup_svc_checks

Sends the DISABLE_SERVICEGROUP_SVC_CHECKS command.

This command does not require any arguments.

POST /servicegroups/<name>/cmd/disable_servicegroup_svc_notifications

Sends the DISABLE_SERVICEGROUP_SVC_NOTIFICATIONS command.

This command does not require any arguments.

POST /servicegroups/<name>/cmd/enable_servicegroup_host_checks

Sends the ENABLE_SERVICEGROUP_HOST_CHECKS command.

This command does not require any arguments.

POST /servicegroups/<name>/cmd/enable_servicegroup_host_notifications

Sends the ENABLE_SERVICEGROUP_HOST_NOTIFICATIONS command.

This command does not require any arguments.

POST /servicegroups/<name>/cmd/enable_servicegroup_svc_checks

Sends the ENABLE_SERVICEGROUP_SVC_CHECKS command.

This command does not require any arguments.

POST /servicegroups/<name>/cmd/enable_servicegroup_svc_notifications

Sends the ENABLE_SERVICEGROUP_SVC_NOTIFICATIONS command.

This command does not require any arguments.

POST /servicegroups/<name>/cmd/schedule_servicegroup_host_downtime

Sends the SCHEDULE_SERVICEGROUP_HOST_DOWNTIME command.

Required arguments:

  • comment_data

Optional arguments:

  • start_time

  • end_time

  • fixed

  • duration

  • comment_author

POST /servicegroups/<name>/cmd/schedule_servicegroup_svc_downtime

Sends the SCHEDULE_SERVICEGROUP_SVC_DOWNTIME command.

Required arguments:

  • comment_data

Optional arguments:

  • start_time

  • end_time

  • fixed

  • duration

  • comment_author

POST /services/<host>/<service>/cmd/acknowledge_svc_problem

Sends the ACKNOWLEDGE_SVC_PROBLEM command.

Required arguments:

  • comment_data

Optional arguments:

  • sticky_ack

  • send_notification

  • persistent_comment

  • comment_author

POST /services/<host>/<service>/cmd/acknowledge_svc_problem_expire

Sends the ACKNOWLEDGE_SVC_PROBLEM_EXPIRE command.

Required arguments:

  • comment_data

Optional arguments:

  • sticky_ack

  • send_notification

  • persistent_comment

  • end_time

  • comment_author

POST /services/<host>/<service>/cmd/add_svc_comment

Sends the ADD_SVC_COMMENT command.

Required arguments:

  • comment_data

Optional arguments:

  • persistent_comment

  • comment_author

POST /services/<host>/<service>/cmd/change_svc_modattr

Sends the CHANGE_SVC_MODATTR command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/del_all_svc_comments

Sends the DEL_ALL_SVC_COMMENTS command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/delay_svc_notification

Sends the DELAY_SVC_NOTIFICATION command.

Required arguments:

  • notification_time

POST /services/<host>/<service>/cmd/disable_passive_svc_checks

Sends the DISABLE_PASSIVE_SVC_CHECKS command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/disable_svc_check

Sends the DISABLE_SVC_CHECK command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/disable_svc_event_handler

Sends the DISABLE_SVC_EVENT_HANDLER command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/disable_svc_flap_detection

Sends the DISABLE_SVC_FLAP_DETECTION command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/disable_svc_notifications

Sends the DISABLE_SVC_NOTIFICATIONS command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/enable_passive_svc_checks

Sends the ENABLE_PASSIVE_SVC_CHECKS command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/enable_svc_check

Sends the ENABLE_SVC_CHECK command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/enable_svc_event_handler

Sends the ENABLE_SVC_EVENT_HANDLER command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/enable_svc_flap_detection

Sends the ENABLE_SVC_FLAP_DETECTION command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/enable_svc_notifications

Sends the ENABLE_SVC_NOTIFICATIONS command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/process_service_check_result

Sends the PROCESS_SERVICE_CHECK_RESULT command.

Required arguments:

  • plugin_output

Optional arguments:

  • plugin_state

  • performance_data

POST /services/<host>/<service>/cmd/remove_svc_acknowledgement

Sends the REMOVE_SVC_ACKNOWLEDGEMENT command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/schedule_forced_svc_check

Sends the SCHEDULE_FORCED_SVC_CHECK command.

Optional arguments:

  • start_time

POST /services/<host>/<service>/cmd/schedule_svc_check

Sends the SCHEDULE_SVC_CHECK command.

Optional arguments:

  • start_time

POST /services/<host>/<service>/cmd/schedule_svc_downtime

Sends the SCHEDULE_SVC_DOWNTIME command.

Required arguments:

  • comment_data

Optional arguments:

  • start_time

  • end_time

  • fixed

  • triggered_by

  • duration

  • comment_author

POST /services/<host>/<service>/cmd/send_custom_svc_notification

Sends the SEND_CUSTOM_SVC_NOTIFICATION command.

Required arguments:

  • comment_data

Optional arguments:

  • options

  • comment_author

POST /services/<host>/<service>/cmd/start_obsessing_over_svc

Sends the START_OBSESSING_OVER_SVC command.

This command does not require any arguments.

POST /services/<host>/<service>/cmd/stop_obsessing_over_svc

Sends the STOP_OBSESSING_OVER_SVC command.

This command does not require any arguments.

POST /system/cmd/del_host_comment

Sends the DEL_HOST_COMMENT command.

Required arguments:

  • comment_id

POST /system/cmd/del_host_downtime

Sends the DEL_HOST_DOWNTIME command.

Required arguments:

  • downtime_id

POST /system/cmd/del_svc_comment

Sends the DEL_SVC_COMMENT command.

Required arguments:

  • comment_id

POST /system/cmd/del_svc_downtime

Sends the DEL_SVC_DOWNTIME command.

Required arguments:

  • downtime_id

POST /system/cmd/disable_event_handlers

Sends the DISABLE_EVENT_HANDLERS command.

This command does not require any arguments.

POST /system/cmd/disable_failure_prediction

Sends the DISABLE_FAILURE_PREDICTION command.

This command does not require any arguments.

POST /system/cmd/disable_flap_detection

Sends the DISABLE_FLAP_DETECTION command.

This command does not require any arguments.

POST /system/cmd/disable_notifications

Sends the DISABLE_NOTIFICATIONS command.

This command does not require any arguments.

POST /system/cmd/disable_performance_data

Sends the DISABLE_PERFORMANCE_DATA command.

This command does not require any arguments.

POST /system/cmd/enable_event_handlers

Sends the ENABLE_EVENT_HANDLERS command.

This command does not require any arguments.

POST /system/cmd/enable_failure_prediction

Sends the ENABLE_FAILURE_PREDICTION command.

This command does not require any arguments.

POST /system/cmd/enable_flap_detection

Sends the ENABLE_FLAP_DETECTION command.

This command does not require any arguments.

POST /system/cmd/enable_notifications

Sends the ENABLE_NOTIFICATIONS command.

This command does not require any arguments.

POST /system/cmd/enable_performance_data

Sends the ENABLE_PERFORMANCE_DATA command.

This command does not require any arguments.

POST /system/cmd/restart_process

Sends the RESTART_PROCESS command.

This command does not require any arguments.

POST /system/cmd/shutdown_process

Sends the SHUTDOWN_PROCESS command.

This command does not require any arguments.

POST /system/cmd/start_accepting_passive_host_checks

Sends the START_ACCEPTING_PASSIVE_HOST_CHECKS command.

This command does not require any arguments.

POST /system/cmd/start_accepting_passive_svc_checks

Sends the START_ACCEPTING_PASSIVE_SVC_CHECKS command.

This command does not require any arguments.

POST /system/cmd/start_executing_host_checks

Sends the START_EXECUTING_HOST_CHECKS command.

This command does not require any arguments.

POST /system/cmd/start_executing_svc_checks

Sends the START_EXECUTING_SVC_CHECKS command.

This command does not require any arguments.

POST /system/cmd/start_obsessing_over_host_checks

Sends the START_OBSESSING_OVER_HOST_CHECKS command.

This command does not require any arguments.

POST /system/cmd/start_obsessing_over_svc_checks

Sends the START_OBSESSING_OVER_SVC_CHECKS command.

This command does not require any arguments.

POST /system/cmd/stop_accepting_passive_host_checks

Sends the STOP_ACCEPTING_PASSIVE_HOST_CHECKS command.

This command does not require any arguments.

POST /system/cmd/stop_accepting_passive_svc_checks

Sends the STOP_ACCEPTING_PASSIVE_SVC_CHECKS command.

This command does not require any arguments.

POST /system/cmd/stop_executing_host_checks

Sends the STOP_EXECUTING_HOST_CHECKS command.

This command does not require any arguments.

POST /system/cmd/stop_executing_svc_checks

Sends the STOP_EXECUTING_SVC_CHECKS command.

This command does not require any arguments.

POST /system/cmd/stop_obsessing_over_host_checks

Sends the STOP_OBSESSING_OVER_HOST_CHECKS command.

This command does not require any arguments.

POST /system/cmd/stop_obsessing_over_svc_checks

Sends the STOP_OBSESSING_OVER_SVC_CHECKS command.

This command does not require any arguments.

Edit page on GitHub