custom metric with labels #13125
Unanswered
michal-sha
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Yes, that should be possible. I'm doing something similar. I also recommend, to keep the expressions as simple as possible. Only make them more complex if you really really have to. - name: hana_defrag_nodes_drain_nodes_total
help: "hana_defrag_nodes_drain_nodes_total help"
labels:
- key: zone
value: "{{outputs.parameters.zone}}"
- key: group
value: "{{outputs.parameters.group}}"
gauge:
realtime: true
value: "{{outputs.parameters.counter}}" If possible, the output parameters could be simple values, like this:
Simple values makes everything easier. But in case you can't avoid having your task outputting a json structure ... lets assume with the name {
"zone": "A",
"group": "AA",
"counter": 123
} ... your metric could look like this: - name: hana_defrag_nodes_drain_nodes_total
help: "hana_defrag_nodes_drain_nodes_total help"
labels:
- key: zone
value: "{{=jsonpath(outputs.parameters.json, '$.zone')}}"
- key: group
value: "{{=jsonpath(outputs.parameters.json, '$.group')}}"
gauge:
realtime: true
value: "{{=jsonpath(outputs.parameters.json, '$.counter')}}" Haven't tested this though, but it should work. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Im trying to create a custom metric with 2 labels. The value for the labels should be taken from an output parameter.
The value of the metric should also taken from an output parameter.
I want to have 1 metric with all the combinations of both of the 2 labels.
For example,
Zone can have values like A, B ...
Group can have values like AA, BB...
I want to get a metric :
How should I do it?
What should be the format of the output parameter for label? txt, csv, json?
What should be the format of the output parameter for the metric value? txt, csv, json?
Is it possible to implement?
Beta Was this translation helpful? Give feedback.
All reactions