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 <aditya....@gmail.com> 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 influxdb+unsubscr...@googlegroups.com. > To post to this group, send email to influxdb@googlegroups.com. > 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 the Google Groups "InfluxData" group. To unsubscribe from this group and stop receiving emails from it, send an email to influxdb+unsubscr...@googlegroups.com. To post to this group, send email to influxdb@googlegroups.com. 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. For more options, visit https://groups.google.com/d/optout.