Watcher mail body formatting

I am trying to get the mail of Container which are down through mail with respective the pod name and the namespaces included. I wanted it to be table but not able to get same.I tried few things,by which i was able to get the data in the body but still not in good format.

"html": "

Please find the Attachment for logs



AlertType:App ALerts {{ctx.metadata._cne-alertType}}
AlertSeverity: High
<
The Errors are observed on . {{#ctx.payload.hits.hits}} {{_source.containername}} {{/ctx.payload.hits.hits}} Container with respective pod {{#ctx.payload.hits.hits}} {{_source.podname}} {{/ctx.payload.hits.hits}}Trigger Time: {{ctx.trigger.triggered_time}}
"

Hi there, it sounds like you're trying to insert an HTML table into your email. Is that correct? If so, could you share you watch action configuration? According to the docs you should be able to specify a body.html attribute for the watch action.

Thanks,
CJ

My action is below:

 "subject": "ALERT!! Containers are Down",
        "body": {
          "html": "<br><br><b>AlertType:App Alert</b> {{ctx.metadata._cne-alertType}}<br><b>AlertSeverity: High</b><b><br><br>  Containers Down: {{#ctx.payload.hits.hits}} {{_source.kubernetes.container.name}}, {{/ctx.payload.hits.hits}}</b><b><br><br>  RESPECTIVE PODS : {{#ctx.payload.hits.hits}} {{_source.kubernetes.pod.name}}, {{/ctx.payload.hits.hits}}</b><b><br><br>  RESPECTIVE NAMESPACES : {{#ctx.payload.hits.hits}} {{_source.kubernetes.namespace}}, {{/ctx.payload.hits.hits}}</b><br><br><br><br><b>Trigger Time:</b> {{ctx.trigger.triggered_time}}<br><p></p>"
        }

output i am getting

**AlertType:App Alert**
<b>AlertSeverity: High

Containers Down: httpd, httpd, httpd, httpd, httpd, httpd,

RESPECTIVE PODS : reverse-proxy-service, reverse-proxy-service, reverse-proxy-service, reverse-proxy-service, reverse-proxy-service, reverse-proxy-service,

RESPECTIVE NAMESPACES : my-namespaces-monitoring, my-namespaces-monitoring, my-namespaces-monitoring, my-namespaces-monitoring, my-namespaces-monitoring, my-namespaces-monitoring,

--- expecting. I wanted to be well formatted(maybe in table format like below)

Containers          PODS                           NAMESPACES

httpd             reverse-proxy-service      my-namespaces-monitoring

i am actual able to get the tabular format required but i am getting duplicate value.can you help with that

Containers Down POD NAMESPACE
httpd reverse-proxy-service-77ccd8dc5b-4wclv ugbu-eap--stg--mt-monitoring--1-4
httpd reverse-proxy-service-66d57d5dd6-ckgfj ugbu-eap--prd--mt-monitoring--1-4
httpd reverse-proxy-service-77ccd8dc5b-4wclv ugbu-eap--stg--mt-monitoring--1-4
httpd reverse-proxy-service-66d57d5dd6-ckgfj ugbu-eap--prd--mt-monitoring--1-4
httpd reverse-proxy-service-66d57d5dd6-ckgfj ugbu-eap--prd--mt-monitoring--1-4
httpd reverse-proxy-service-77ccd8dc5b-4wclv ugbu-eap--stg--mt-monitoring--1-4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.