From c0dabcab0d6072e4dfadcbe8ffba6a63d360d3f3 Mon Sep 17 00:00:00 2001 From: Gilberto Miralla-Flores Date: Fri, 15 Nov 2024 14:33:04 -0500 Subject: [PATCH] Support for output_metric_tags --- plugins/modules/check.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/plugins/modules/check.py b/plugins/modules/check.py index 47f44693..d3e52934 100644 --- a/plugins/modules/check.py +++ b/plugins/modules/check.py @@ -141,9 +141,17 @@ - opentsdb_line output_metric_handlers: description: - - List of handlers which receive check results. I'm not sure why this exists. + - List of handlers which receive check results. type: list elements: str + output_metric_tags: + description: + - Custom tags to enrich metric points produced by check output metric + extraction. + - See check metrics example below for more information on exact mapping + structure. + type: list + elements: dict round_robin: description: - An array of environment variables to use with command execution. @@ -220,6 +228,21 @@ - failing-hook - always-run-this-hook +- name: Check that collects metrics + sensu.sensu_go.check: + name: check + command: check-cpu.sh -w 75 -c 90 + subscriptions: + - checks + interval: 30 + output_metric_format: nagios_perfdata + output_metric_handlers: + - influxdb + output_metric_tags: + - name: sensu_check_name + value: check + publish: yes + - name: Remove check sensu.sensu_go.check: name: my-check @@ -323,6 +346,7 @@ def build_api_payload(params): 'low_flap_threshold', 'output_metric_format', 'output_metric_handlers', + 'output_metric_tags', 'proxy_entity_name', 'publish', 'round_robin', @@ -423,6 +447,10 @@ def main(): output_metric_handlers=dict( type='list', elements='str', ), + output_metric_tags=dict( + type='list', elements='dict', + #type='dict', + ), round_robin=dict( type='bool' )