%> thruk r -d "comment_data=test" /hosts/localhost/cmd/schedule_host_downtime { "message" : "Command successfully submitted" }
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.
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" }
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
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
More time definition examples can be found on the time definitions page.
To avoid escaping issues, there is a generic command endpoint /cmd
which can be used
to send any command.
%> curl -H "X-Thruk-Auth-Key: ****" \ -d "cmd=acknowledge_svc_problem" \ -d "host=hostname" \ -d "service=servicedescription" \ -d "comment_data=test" \ 'http://localhost/thruk/r/cmd'
All examples can be found on the REST API Examples page.
See examples and detailed description for all available rest api command urls:
Disables host notifications for all contacts in a particular contactgroup.
This command does not require any arguments.
Disables service notifications for all contacts in a particular contactgroup.
This command does not require any arguments.
Enables host notifications for all contacts in a particular contactgroup.
This command does not require any arguments.
Enables service notifications for all contacts in a particular contactgroup.
This command does not require any arguments.
Changes the host notification timeperiod for a particular contact to what is specified by the 'notification_timeperiod' option. The 'notification_timeperiod' option should be the short name of the timeperiod that is to be used as the contact’s host notification timeperiod. The timeperiod must have been configured in Naemon before it was last (re)started.
Required arguments:
timeperiod
Changes the service notification timeperiod for a particular contact to what is specified by the 'notification_timeperiod' option. The 'notification_timeperiod' option should be the short name of the timeperiod that is to be used as the contact’s service notification timeperiod. The timeperiod must have been configured in Naemon before it was last (re)started.
Required arguments:
timeperiod
Changes the value of a custom contact variable.
Required arguments:
name
value
Disables host notifications for a particular contact.
This command does not require any arguments.
Disables service notifications for a particular contact.
This command does not require any arguments.
Enables host notifications for a particular contact.
This command does not require any arguments.
Disables service notifications for a particular contact.
This command does not require any arguments.
Sends the DISABLE_HOSTGROUP_HOST_CHECKS command.
This command does not require any arguments.
Sends the DISABLE_HOSTGROUP_HOST_NOTIFICATIONS command.
This command does not require any arguments.
Disables passive checks for all hosts in a particular hostgroup.
This command does not require any arguments.
Disables passive checks for all services associated with hosts in a particular hostgroup.
This command does not require any arguments.
Sends the DISABLE_HOSTGROUP_SVC_CHECKS command.
This command does not require any arguments.
Sends the DISABLE_HOSTGROUP_SVC_NOTIFICATIONS command.
This command does not require any arguments.
Sends the ENABLE_HOSTGROUP_HOST_CHECKS command.
This command does not require any arguments.
Sends the ENABLE_HOSTGROUP_HOST_NOTIFICATIONS command.
This command does not require any arguments.
Enables passive checks for all hosts in a particular hostgroup.
This command does not require any arguments.
Enables passive checks for all services associated with hosts in a particular hostgroup.
This command does not require any arguments.
Sends the ENABLE_HOSTGROUP_SVC_CHECKS command.
This command does not require any arguments.
Sends the ENABLE_HOSTGROUP_SVC_NOTIFICATIONS command.
This command does not require any arguments.
Sends the SCHEDULE_HOSTGROUP_HOST_DOWNTIME command.
Required arguments:
comment_data
Optional arguments:
start_time
end_time
fixed
triggered_by
duration
comment_author
Sends the SCHEDULE_HOSTGROUP_SVC_DOWNTIME command.
Required arguments:
comment_data
Optional arguments:
start_time
end_time
fixed
triggered_by
duration
comment_author
Sends the ACKNOWLEDGE_HOST_PROBLEM command.
Required arguments:
comment_data
Optional arguments:
sticky_ack
send_notification
persistent_comment
comment_author
Sends the ACKNOWLEDGE_HOST_PROBLEM_EXPIRE command.
Required arguments:
comment_data
Optional arguments:
sticky_ack
send_notification
persistent_comment
end_time
comment_author
Sends the ADD_HOST_COMMENT command.
Required arguments:
comment_data
Optional arguments:
persistent_comment
comment_author
Changes the value of a custom host variable.
Required arguments:
name
value
Changes the valid check period for the specified host.
Required arguments:
timeperiod
Sends the CHANGE_HOST_MODATTR command.
This command does not require any arguments.
Changes the host notification timeperiod to what is specified by the 'notification_timeperiod' option. The 'notification_timeperiod' option should be the short name of the timeperiod that is to be used as the service notification timeperiod. The timeperiod must have been configured in Naemon before it was last (re)started.
Required arguments:
timeperiod
Changes the maximum number of check attempts (retries) for a particular host.
Required arguments:
interval
Changes the normal (regularly scheduled) check interval for a particular host.
Required arguments:
interval
Changes the retry check interval for a particular host.
Required arguments:
interval
Removes all currently active downtimes for this host.
This command does not require any arguments.
Sends the DEL_ALL_HOST_COMMENTS command.
This command does not require any arguments.
Removes downtime by id for this host.
Required arguments:
comment_id
Removes downtime by id for this host.
Required arguments:
downtime_id
Sends the DELAY_HOST_NOTIFICATION command.
Required arguments:
notification_time
Sends the DISABLE_ALL_NOTIFICATIONS_BEYOND_HOST command.
This command does not require any arguments.
Sends the DISABLE_HOST_AND_CHILD_NOTIFICATIONS command.
This command does not require any arguments.
Sends the DISABLE_HOST_CHECK command.
This command does not require any arguments.
Sends the DISABLE_HOST_EVENT_HANDLER command.
This command does not require any arguments.
Sends the DISABLE_HOST_FLAP_DETECTION command.
This command does not require any arguments.
Sends the DISABLE_HOST_NOTIFICATIONS command.
This command does not require any arguments.
Sends the DISABLE_HOST_SVC_CHECKS command.
This command does not require any arguments.
Sends the DISABLE_HOST_SVC_NOTIFICATIONS command.
This command does not require any arguments.
Sends the DISABLE_PASSIVE_HOST_CHECKS command.
This command does not require any arguments.
Sends the ENABLE_ALL_NOTIFICATIONS_BEYOND_HOST command.
This command does not require any arguments.
Sends the ENABLE_HOST_AND_CHILD_NOTIFICATIONS command.
This command does not require any arguments.
Sends the ENABLE_HOST_CHECK command.
This command does not require any arguments.
Sends the ENABLE_HOST_EVENT_HANDLER command.
This command does not require any arguments.
Sends the ENABLE_HOST_FLAP_DETECTION command.
This command does not require any arguments.
Sends the ENABLE_HOST_NOTIFICATIONS command.
This command does not require any arguments.
Sends the ENABLE_HOST_SVC_CHECKS command.
This command does not require any arguments.
Sends the ENABLE_HOST_SVC_NOTIFICATIONS command.
This command does not require any arguments.
Sends the ENABLE_PASSIVE_HOST_CHECKS command.
This command does not require any arguments.
Add host note to core log.
Required arguments:
log
Sends the PROCESS_HOST_CHECK_RESULT command.
Required arguments:
plugin_state
plugin_output
Optional arguments:
performance_data
Sends the REMOVE_HOST_ACKNOWLEDGEMENT command.
This command does not require any arguments.
Sends the SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME command.
Required arguments:
comment_data
Optional arguments:
start_time
end_time
fixed
triggered_by
duration
comment_author
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
Sends the SCHEDULE_FORCED_HOST_CHECK command.
Optional arguments:
start_time
Sends the SCHEDULE_FORCED_HOST_SVC_CHECKS command.
Optional arguments:
start_time
Sends the SCHEDULE_HOST_CHECK command.
Optional arguments:
start_time
Sends the SCHEDULE_HOST_DOWNTIME command.
Required arguments:
comment_data
Optional arguments:
start_time
end_time
fixed
triggered_by
duration
comment_author
Sends the SCHEDULE_HOST_SVC_CHECKS command.
Optional arguments:
start_time
Sends the SCHEDULE_HOST_SVC_DOWNTIME command.
Required arguments:
comment_data
Optional arguments:
start_time
end_time
fixed
triggered_by
duration
comment_author
Sends the SEND_CUSTOM_HOST_NOTIFICATION command.
Required arguments:
comment_data
Optional arguments:
options
comment_author
Sets the current notification number for a particular host. A value of 0 indicates that no notification has yet been sent for the current host problem. Useful for forcing an escalation (based on notification number) or replicating notification information in redundant monitoring environments. Notification numbers greater than zero have no noticeable affect on the notification process if the host is currently in an UP state.
Required arguments:
number
Sends the START_OBSESSING_OVER_HOST command.
This command does not require any arguments.
Sends the STOP_OBSESSING_OVER_HOST command.
This command does not require any arguments.
Sends the DISABLE_SERVICEGROUP_HOST_CHECKS command.
This command does not require any arguments.
Sends the DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS command.
This command does not require any arguments.
Disables the acceptance and processing of passive checks for all hosts that have services that are members of a particular service group.
This command does not require any arguments.
Disables the acceptance and processing of passive checks for all services in a particular servicegroup.
This command does not require any arguments.
Sends the DISABLE_SERVICEGROUP_SVC_CHECKS command.
This command does not require any arguments.
Sends the DISABLE_SERVICEGROUP_SVC_NOTIFICATIONS command.
This command does not require any arguments.
Sends the ENABLE_SERVICEGROUP_HOST_CHECKS command.
This command does not require any arguments.
Sends the ENABLE_SERVICEGROUP_HOST_NOTIFICATIONS command.
This command does not require any arguments.
Enables the acceptance and processing of passive checks for all hosts that have services that are members of a particular service group.
This command does not require any arguments.
Enables the acceptance and processing of passive checks for all services in a particular servicegroup.
This command does not require any arguments.
Sends the ENABLE_SERVICEGROUP_SVC_CHECKS command.
This command does not require any arguments.
Sends the ENABLE_SERVICEGROUP_SVC_NOTIFICATIONS command.
This command does not require any arguments.
Sends the SCHEDULE_SERVICEGROUP_HOST_DOWNTIME command.
Required arguments:
comment_data
Optional arguments:
start_time
end_time
fixed
triggered_by
duration
comment_author
Sends the SCHEDULE_SERVICEGROUP_SVC_DOWNTIME command.
Required arguments:
comment_data
Optional arguments:
start_time
end_time
fixed
triggered_by
duration
comment_author
Sends the ACKNOWLEDGE_SVC_PROBLEM command.
Required arguments:
comment_data
Optional arguments:
sticky_ack
send_notification
persistent_comment
comment_author
Sends the ACKNOWLEDGE_SVC_PROBLEM_EXPIRE command.
Required arguments:
comment_data
Optional arguments:
sticky_ack
send_notification
persistent_comment
end_time
comment_author
Sends the ADD_SVC_COMMENT command.
Required arguments:
comment_data
Optional arguments:
persistent_comment
comment_author
Changes the value of a custom service variable.
Required arguments:
name
value
Changes the maximum number of check attempts (retries) for a particular service.
Required arguments:
attempts
Changes the normal (regularly scheduled) check interval for a particular service
Required arguments:
interval
Changes the retry check interval for a particular service.
Required arguments:
interval
Changes the check timeperiod for a particular service to what is specified by the 'check_timeperiod' option. The 'check_timeperiod' option should be the short name of the timeperod that is to be used as the service check timeperiod. The timeperiod must have been configured in Naemon before it was last (re)started.
Required arguments:
timeperiod
Sends the CHANGE_SVC_MODATTR command.
This command does not require any arguments.
Changes the service notification timeperiod to what is specified by the 'notification_timeperiod' option. The 'notification_timeperiod' option should be the short name of the timeperiod that is to be used as the service notification timeperiod. The timeperiod must have been configured in Naemon before it was last (re)started.
Required arguments:
timeperiod
Removes all currently active downtimes for this service.
This command does not require any arguments.
Sends the DEL_ALL_SVC_COMMENTS command.
This command does not require any arguments.
Removes downtime by id for this service.
Required arguments:
comment_id
Removes downtime by id for this service.
Required arguments:
downtime_id
Sends the DELAY_SVC_NOTIFICATION command.
Required arguments:
notification_time
Sends the DISABLE_PASSIVE_SVC_CHECKS command.
This command does not require any arguments.
Sends the DISABLE_SVC_CHECK command.
This command does not require any arguments.
Sends the DISABLE_SVC_EVENT_HANDLER command.
This command does not require any arguments.
Sends the DISABLE_SVC_FLAP_DETECTION command.
This command does not require any arguments.
Sends the DISABLE_SVC_NOTIFICATIONS command.
This command does not require any arguments.
Sends the ENABLE_PASSIVE_SVC_CHECKS command.
This command does not require any arguments.
Sends the ENABLE_SVC_CHECK command.
This command does not require any arguments.
Sends the ENABLE_SVC_EVENT_HANDLER command.
This command does not require any arguments.
Sends the ENABLE_SVC_FLAP_DETECTION command.
This command does not require any arguments.
Sends the ENABLE_SVC_NOTIFICATIONS command.
This command does not require any arguments.
Add service note to core log.
Required arguments:
log
Sends the PROCESS_SERVICE_CHECK_RESULT command.
Required arguments:
plugin_state
plugin_output
Optional arguments:
performance_data
Sends the REMOVE_SVC_ACKNOWLEDGEMENT command.
This command does not require any arguments.
Sends the SCHEDULE_FORCED_SVC_CHECK command.
Optional arguments:
start_time
Sends the SCHEDULE_SVC_CHECK command.
Optional arguments:
start_time
Sends the SCHEDULE_SVC_DOWNTIME command.
Required arguments:
comment_data
Optional arguments:
start_time
end_time
fixed
triggered_by
duration
comment_author
Sends the SEND_CUSTOM_SVC_NOTIFICATION command.
Required arguments:
comment_data
Optional arguments:
options
comment_author
Sets the current notification number for a particular service. A value of 0 indicates that no notification has yet been sent for the current service problem. Useful for forcing an escalation (based on notification number) or replicating notification information in redundant monitoring environments. Notification numbers greater than zero have no noticeable affect on the notification process if the service is currently in an OK state.
Required arguments:
number
Sends the START_OBSESSING_OVER_SVC command.
This command does not require any arguments.
Sends the STOP_OBSESSING_OVER_SVC command.
This command does not require any arguments.
Changes the global host event handler command to be that specified by the 'event_handler_command' option. The 'event_handler_command' option specifies the short name of the command that should be used as the new host event handler. The command must have been configured in Naemon before it was last (re)started.
Required arguments:
eventhandler
Changes the global service event handler command to be that specified by the 'event_handler_command' option. The 'event_handler_command' option specifies the short name of the command that should be used as the new service event handler. The command must have been configured in Naemon before it was last (re)started.
Required arguments:
eventhandler
This command deletes all downtimes matching the specified filters.
Optional arguments:
hostname
service_desc
start_time
comment
This command deletes all downtimes matching the specified filters.
Optional arguments:
hostgroup_name
hostname
service_desc
start_time
comment
This command deletes all downtimes matching the specified filters.
Optional arguments:
start_time
comment
Sends the DEL_HOST_COMMENT command.
Required arguments:
comment_id
Sends the DEL_HOST_DOWNTIME command.
Required arguments:
downtime_id
Sends the DEL_SVC_COMMENT command.
Required arguments:
comment_id
Sends the DEL_SVC_DOWNTIME command.
Required arguments:
downtime_id
Sends the DISABLE_EVENT_HANDLERS command.
This command does not require any arguments.
Sends the DISABLE_FLAP_DETECTION command.
This command does not require any arguments.
Disables freshness checks of all hosts on a program-wide basis.
This command does not require any arguments.
Sends the DISABLE_NOTIFICATIONS command.
This command does not require any arguments.
Sends the DISABLE_PERFORMANCE_DATA command.
This command does not require any arguments.
Disables freshness checks of all services on a program-wide basis.
This command does not require any arguments.
Sends the ENABLE_EVENT_HANDLERS command.
This command does not require any arguments.
Sends the ENABLE_FLAP_DETECTION command.
This command does not require any arguments.
Enables freshness checks of all services on a program-wide basis. Individual services that have freshness checks disabled will not be checked for freshness.
This command does not require any arguments.
Sends the ENABLE_NOTIFICATIONS command.
This command does not require any arguments.
Sends the ENABLE_PERFORMANCE_DATA command.
This command does not require any arguments.
Enables freshness checks of all services on a program-wide basis. Individual services that have freshness checks disabled will not be checked for freshness.
This command does not require any arguments.
Add custom log entry to core log.
Required arguments:
log
Causes Naemon to load all current monitoring status information from the state retention file. Normally, state retention information is loaded when the Naemon process starts up and before it starts monitoring. WARNING: This command will cause Naemon to discard all current monitoring status information and use the information stored in state retention file! Use with care.
This command does not require any arguments.
Sends the RESTART_PROCESS command.
This command does not require any arguments.
Restarts the Naemon process.
This command does not require any arguments.
Causes Naemon to save all current monitoring status information to the state retention file. Normally, state retention
This command does not require any arguments.
Sends the SHUTDOWN_PROCESS command.
This command does not require any arguments.
Shuts down the Naemon process.
This command does not require any arguments.
Sends the START_ACCEPTING_PASSIVE_HOST_CHECKS command.
This command does not require any arguments.
Sends the START_ACCEPTING_PASSIVE_SVC_CHECKS command.
This command does not require any arguments.
Sends the START_EXECUTING_HOST_CHECKS command.
This command does not require any arguments.
Sends the START_EXECUTING_SVC_CHECKS command.
This command does not require any arguments.
Sends the START_OBSESSING_OVER_HOST_CHECKS command.
This command does not require any arguments.
Sends the START_OBSESSING_OVER_SVC_CHECKS command.
This command does not require any arguments.
Sends the STOP_ACCEPTING_PASSIVE_HOST_CHECKS command.
This command does not require any arguments.
Sends the STOP_ACCEPTING_PASSIVE_SVC_CHECKS command.
This command does not require any arguments.
Sends the STOP_EXECUTING_HOST_CHECKS command.
This command does not require any arguments.
Sends the STOP_EXECUTING_SVC_CHECKS command.
This command does not require any arguments.
Sends the STOP_OBSESSING_OVER_HOST_CHECKS command.
This command does not require any arguments.
Sends the STOP_OBSESSING_OVER_SVC_CHECKS command.
This command does not require any arguments.
lock given thruk user.
unlock given thruk user.