Sorry for the typo. I have tried {{ index .Tags "
com.docker.swarm.service.name" }}.
It's not working.
Thanks,
Aditya C S
On Sat 31 Dec, 2016, 11:25 PM Ross McDonald, <[email protected]> wrote:
Does this not work?
{{ index .Tags "com.docker.swarm.service.name" }}
There is a space between 'index' and '.Tags'. The brackets need to be
together. And it looks like there is a typo with 'sswarm' (should be
'swarm').
On Fri, Dec 30, 2016 at 11:12 PM, Aditya C.S <[email protected]> wrote:
How to write custom message with tag value of "com.docker.swarm.service.name"?.
Below is my script. However, tag value is displayed as null in the alert. I
even tried this way ".message('{{ .Level}}: { {index.Tags "[[
com.docker.sswarm.service.name]]" }} has high cpu usage: {{ index .Fields
"cpu_usage" }}')".
batch
|query('''
select sum(usage_percent) as cpu_usage from
"telegraf"."default"."service_cpu_usage" where "
com.docker.swarm.service.name"='jenkins' order by time desc
''')
.period(15m)
.every(1m)
.groupBy(time(10s), 'com.docker.swarm.service.name')
|alert()
.message('{{ .Level}}: { {index.Tags "com.docker.sswarm.service.name"
}} has high cpu usage: {{ index .Fields "cpu_usage" }}')
.crit(lambda: "cpu_usage" > 80)
.log('/opt/kap/container_cpu_alerts.log')
.exec('/opt/kap/container_cpu_alert.py')
Thanks,
Aditya C S
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups
"InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit
https://groups.google.com/d/msgid/influxdb/309d9300-4191-41d7-b727-8ef81ea8da12%40googlegroups.com
<https://groups.google.com/d/msgid/influxdb/309d9300-4191-41d7-b727-8ef81ea8da12%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Remember to include the version number!
---
You received this message because you are subscribed to a topic in the
Google Groups "InfluxData" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/influxdb/KEy900H4vtE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
[email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit
https://groups.google.com/d/msgid/influxdb/CAD8sRLBFFX_2ADqdNrotROu-kyFpieiXrqh8v9yi97V0dPk1Vg%40mail.gmail.com
<https://groups.google.com/d/msgid/influxdb/CAD8sRLBFFX_2ADqdNrotROu-kyFpieiXrqh8v9yi97V0dPk1Vg%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups
"InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit
https://groups.google.com/d/msgid/influxdb/CAFEGz4maC9HDMYwnO0m2LN2KQKRNO98ZJfFfHnwt-sSW5VgRkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.