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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to