Skip to content

Latest commit

 

History

History
243 lines (171 loc) · 9.39 KB

4-actions.md

File metadata and controls

243 lines (171 loc) · 9.39 KB

Actions

actions.process_check_result()

Process a check result for a host or a service.

Parameter Type Description
object_type string Required. The object type to process the check result for, Host or Service.
name string Required. The object`s name.
exit_status int Required. For services: 0=OK, 1=WARNING, 2=CRITICAL, 3=UNKNOWN, for hosts: 0=OK, 1=CRITICAL.
plugin_output string Required. The plugins main output.
performance_data list Optional. The plugins performance data.
check_command list Optional. The first entry should be the check commands path, then one entry for each command line option followed by an entry for each of its argument.
check_source string Optional. Usually the name of the command\_endpoint.

Example:

client.actions.process_check_result(
    'Service',
    'localhost!ping4',
    'exit_status': 2,
    'plugin_output': 'PING CRITICAL - Packet loss = 100%',
    'performance_data': [
        'rta=5000.000000ms;3000.000000;5000.000000;0.000000',
        'pl=100%;80;100;0'],
    'check_source': 'icinga')

actions.reschedule_check()

Reschedule a check.

Parameter Type Description
object_type string Required. The object type to process the check result for, Host or Service.
filter string Required. Filter expression to match the objects.
filter_vars dictionary Optional. Variables which are available to your filter expression.
next_check string Optional. Timestamp to run the check.
force_check bool Optional. Force execution, e.g. ignore period restrictions.

Example:

client.actions.reschedule_check(
    'Host',
    'host.name=="localhost"',
    '1577833200')

actions.send_custom_notification()

Send a custom notification.

Parameter Type Description
object_type string Required. The object type to process the check result for, Host or Service.
filter string Required. Filter expression to match the objects.
filter_vars dictionary Optional. Variables which are available to your filter expression.
author string Required. Name of the author.
comment string Required. Comment text.
force bool Optional. Force execution, e.g. ignore downtimes. Default: False.

Example:

client.actions.send_custom_notification(
    'Host',
    'host.name==localhost',
    'icingaadmin',
    'test comment')

actions.delay_notification()

Delay a notification.

Parameter Type Description
object_type string Required. The object type to process the check result for, Host or Service.
filter string Required. Filter expression to match the objects.
filter_vars dictionary Optional. Variables which are available to your filter expression.
timestamp int Required. Timestamp to delay the notification to.

Example:

client.actions.delay_notification(
    'Host',
    'host.name==localhost',
    '1446389894')

actions.acknowledge_problem()

Acknowledge a problem.

Parameter Type Description
object_type string Required. The object type to process the check result for, Host or Service.
filter string Required. Filter expression to match the objects.
filter_vars dictionary Optional. Variables which are available to your filter expression.
author string Required. Name of the author.
comment string Required. Comment text.
expiry int Optional. If set the acknowledgement will vanish after this timestamp.
sticky bool Optional. If true, the default, the acknowledgement will remain until the service or host fully recovers.
notify bool Optional. If true a notification will be sent out to contacts to indicate this problem has been acknowledged. The default is false.

Example:

client.actions.acknowledge_problem(
    'Host',
    'host.name==localhost',
    'icingaadmin',
    'host is in maintenance')
    1446389894)

actions.remove_acknowledgement()

Remove the acknowledgement for services or hosts.

Parameter Type Description
object_type string Required. The object type to process the check result for, Host or Service.
filter string Required. Filter expression to match the objects.
filter_vars dictionary Optional. Variables which are available to your filter expression.

Example:

client.actions.acknowledge_problem(
    'Service',
    'service.state==2')

actions.add_comment()

Add a comment from an author for services or hosts.

Parameter Type Description
object_type string Required. The object type to process the check result for, Host or Service.
filter string Required. Filter expression to match the objects.
filter_vars dictionary Optional. Variables which are available to your filter expression.
author string Required. Name of the author.
comment string Required. Comment text.

Example:

client.actions.acknowledge_problem(
    'Service',
    'service.name=="ping4"',
    'icingaadmin',
    'Incident ticket #12345 opened.')

actions.remove_comment()

Remove a comment using its name or a filter.

Parameter Type Description
object_type string Required. The object type to process the check result for.
name string Optional. Name of the object.
filter string Optional. Filter expression to match the objects.
filter_vars dictionary Optional. Variables which are available to your filter expression.

Examples:

client.actions.remove_comment(
    'Comment',
    'localhost!localhost-1458202056-25')

client.actions.remove_comment(
    'Service',
    filter='service.name=="ping4"')

actions.schedule_downtime()

Schedule a downtime for services or hosts.

Parameter Type Description
object_type string Required. The object type to process the check result for, Host or Service.
filter string Required. Filter expression to match the objects.
filter_vars dictionary Optional. Variables which are available to your filter expression.
author string Required. Name of the author.
comment string Required. Comment text.
start_time int Required. Timestamp makring the beginning of the downtime.
end_time int Required. Timestamp makring the end of the downtime.
duration int Required. Duration of the downtime in seconds.
fixed bool Optional. Schedule fixed or flexible downtime.
trigger_name bool Optional. Schedule fixed or flexible downtime.

Example:

client.actions.schedule_downtime(
    'Host',
    r'match("*", host.name)',
    'icingaadmin',
    'IPv4 network maintenance',
    1446388806,
    1446389806,
    1000)

actions.remove_downtime()

Remove a downtime using its name or a filter.

Parameter Type Description
object_type string Required. The object type to process the check result for.
name string Optional. Name of the object.
filter string Optional. Filter expression to match the objects.
filter_vars dictionary Optional. Variables which are available to your filter expression.

Examples:

client.actions.remove_downtime(
    'Downtime',
    'localhost!ping4!localhost-1458202056-25')

client.actions.remove_downtime(
    'Service',
    filter='service.name=="ping4"')

actions.shutdown_process()

Shuts down Icinga 2.

Example:

client.actions.shutdown_process()

actions.restart_process()

Restarts Icinga 2.

Example:

client.actions.restart_process()