salt.modules.datadog_api

An execution module that interacts with the Datadog API

The following parameters are required for all functions.

api_key
The datadog API key
app_key
The datadog application key

Full argument reference is available on the Datadog API reference page https://docs.datadoghq.com/api/

salt.modules.datadog_api.cancel_downtime(api_key=None, app_key=None, scope=None, id=None)

Cancel a downtime by id or by scope.

CLI Example:

salt-call datadog.cancel_downtime scope='host:app01' \
                                  api_key='0123456789' \
                                  app_key='9876543210'`

Arguments - Either scope or id is required.

Parameters:
  • id – The downtime ID
  • scope – The downtime scope
salt.modules.datadog_api.post_event(api_key=None, app_key=None, title=None, text=None, date_happened=None, priority=None, host=None, tags=None, alert_type=None, aggregation_key=None, source_type_name=None)

Post an event to the Datadog stream.

CLI Example

salt-call datadog.post_event api_key='0123456789' \
                             app_key='9876543210' \
                             title='Salt Highstate' \
                             text="Salt highstate was run on $(salt-call grains.get id)" \
                             tags='["service:salt", "event:highstate"]'

Required arguments

Parameters:
  • title – The event title. Limited to 100 characters.
  • text – The body of the event. Limited to 4000 characters. The text supports markdown.

Optional arguments

Parameters:
  • date_happened – POSIX timestamp of the event.
  • priority – The priority of the event (‘normal’ or ‘low’).
  • host – Host name to associate with the event.
  • tags – A list of tags to apply to the event.
  • alert_type – “error”, “warning”, “info” or “success”.
  • aggregation_key – An arbitrary string to use for aggregation, max length of 100 characters.
  • source_type_name – The type of event being posted.
salt.modules.datadog_api.schedule_downtime(scope, api_key=None, app_key=None, monitor_id=None, start=None, end=None, message=None, recurrence=None, timezone=None, test=False)

Schedule downtime for a scope of monitors.

CLI Example:

salt-call datadog.schedule_downtime 'host:app2' \
                                    stop=$(date --date='30 minutes' +%s) \
                                    app_key='0123456789' \
                                    api_key='9876543210'

Optional arguments

Parameters:
  • monitor_id – The ID of the monitor
  • start – Start time in seconds since the epoch
  • end – End time in seconds since the epoch
  • message – A message to send in a notification for this downtime
  • recurrence – Repeat this downtime periodically
  • timezone – Specify the timezone

Docs for previous releases are available on readthedocs.org.

Latest Salt release: 2018.3.3

Previous topic

salt.modules.data

Next topic

salt.modules.ddns