salt.returners.appoptics_return

Salt returner to return highstate stats to AppOptics Metrics

To enable this returner the minion will need the AppOptics Metrics client importable on the Python path and the following values configured in the minion or master config.

The AppOptics python client can be found at:

https://github.com/appoptics/python-appoptics-metrics

appoptics.api_token: abc12345def

An example configuration that returns the total number of successes and failures for your salt highstate runs (the default) would look like this:

return: appoptics
appoptics.api_token: <token string here>

The returner publishes the following metrics to AppOptics:

  • saltstack.failed

  • saltstack.passed

  • saltstack.retcode

  • saltstack.runtime

  • saltstack.total

You can add a tags section to specify which tags should be attached to all metrics created by the returner.

appoptics.tags:
  host_hostname_alias: <the minion ID - matches @host>
  tier: <the tier/etc. of this node>
  cluster: <the cluster name, etc.>

If no tags are explicitly configured, then the tag key host_hostname_alias will be set, with the minion's id grain being the value.

In addition to the requested tags, for a highstate run each of these will be tagged with the key:value of state_type: highstate.

In order to return metrics for state.sls runs (distinct from highstates), you can specify a list of state names to the key appoptics.sls_states like so:

appoptics.sls_states:
  - role_salt_master.netapi
  - role_redis.config
  - role_smarty.dummy

This will report success and failure counts on runs of the role_salt_master.netapi, role_redis.config, and role_smarty.dummy states in addition to highstates.

This will report the same metrics as above, but for these runs the metrics will be tagged with state_type: sls and state_name set to the name of the state that was invoked, e.g. role_salt_master.netapi.

salt.returners.appoptics_return.returner(ret)

Parse the return data and return metrics to AppOptics.

For each state that's provided in the configuration, return tagged metrics for the result of that state if it's present.