An execution module that interacts with the Datadog API

The following parameters are required for all functions.

The datadog API key
The datadog application key

Full argument reference is available on the Datadog API reference page

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' \

Arguments - Either scope or id is required.

  • 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

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

Optional arguments

  • 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' \

Optional arguments

  • 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