stats interface — VMware Salt API
stats interface
The LoadedMod class allows for the module loaded onto the sub to return custom sequencing, for instance it can be iterated over to return all functions
Get database health status
Get Celery queue size
Example:
client.api.stats.get_queue_sizes() RPCResponse(riq=5, ret={'lr': 0, 'grainscache': 0, 'celery': 0}, error=None, warnings=[])
Get a list of sources for a particular metric. These sources can be passed to get_system_metrics() to filter results.
Parameters
| metric: | Metric name to report sources for. Metric names are available in the RPC API discovery payload as metrics. |
|---|
Example:
client.api.stats.get_system_metric_sources('salt_event_size_bytes') RPCResponse(riq=6, ret=['master1', 'master2'], error=None, warnings=[])
Get system metrics.
Parameters
| daterange: | A dictionary containing up to 2 of the fields start, end, and timedelta. start and end are date strings in ISO-8601 format, and timedelta is a time span in seconds. If end is not specified, it defaults to now. If timedelta is not specified, it defaults to the maximum allowable time span (24 hours). |
|---|---|
| metrics: | Limit results to these metric names. Default behavior is to return all metrics. Metric names are available in the RPC API discovery payload as metrics. |
| sources: | Limit results to metrics from these sources. Call get_system_metric_sources() to get available sources for a particular metric. Default behavior is to return metrics from all sources. |
| reverse: | Sort by metric timestamp in ascending (False) or descending (True) order. Default is ascending order (most recent metrics last). |
In the return payload, metrics are separated by metric name as shown in the truncated example below. Each data point consists of a numeric value and a name timestamp.
Example:
client.api.stats.get_system_metrics() RPCResponse(riq=5, ret={'count': 3018, 'results': [ {'name': 'salt_event_count-master1', 'series': [ {'value': 0.0, 'name': '2020-04-03T17:14:53.879032'}, {'value': 3.0, 'name': '2020-04-03T17:15:53.873155'}, {'value': 7.0, 'name': '2020-04-03T17:16:53.879273'}, # ... ]}, {'name': 'salt_event_size_bytes-master1', 'series': [ {'value': 0.0, 'name': '2020-04-03T17:14:53.879032'}, {'value': 94.0, 'name': '2020-04-03T17:14:53.873155'}, {'value': 135758.857, 'name': '2020-04-03T17:16:53.879273'}, # ... ]}, # ... ]}, error=None, warnings=[])
Null RPC method to test the fastest RPC Api response