I am using email handler plugin and installed using below command.
sensuctl asset add sensu/sensu-email-handler -r email-handler
below is the check definition
{
“api_version”:“core/v2”,
“type”:“Check”,
“metadata”:{
“namespace”:“default”,
“name”:“app-gw-health-check”,
“labels”:{}
},
“spec”:{
“command”:“python3.6 /etc/sensu/plugins/app-gw-health-check.py”,
“subscriptions”:[
“roundrobin:worker”
],
“publish”:true,
“round_robin”:true,
“interval”:3600,
“handlers”:[
“alert_handler”,
“resolve_handler”
],
“proxy_entity_name”:“proxyclient”,
“timeout”:590
}
}
Script Output in HTML format:
<table class="tg">
<tbody>
<tr>
<th>#</th>
<th>Instance Name</th>
<th>Status</th>
</tr>
<tr>
<td>1</td>
<td>engg_ss_-1</td>
<td>Unhealthy</td>
</tr>
</tbody>
</table>
<table class="tg">
<tbody>
<tr>
<th>#</th>
<th>Instance Name</th>
<th>Status</th>
</tr>
<tr>
<td>1</td>
<td>engg-ss_0</td>
<td>Unhealthy</td>
</tr>
</tbody>
</table>
Handler template:
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:13px;padding:7px 5px;border-style:solid;border-
width:1px;overflow:hidden;word-break:normal;border-color:black;}
.tg th{font-family:Arial, sans-serif;font-size:13px;font-weight:normal;padding:7px
5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-
color:black;}
.tg .tg-ydru{font-family:Arial, Geneva, sans-serif !important;;background-
color:#efefef;border-color:#9b9b9b;vertical-align:top}
.tg .tg-greenbg{font-family:Arial, Geneva, sans-serif !important;;background-
color:#a4ff48;border-color:#9b9b9b;vertical-align:top}
.tg .tg-amberbg{font-family:Arial, Geneva, sans-serif !important;;background-
color:#e5b73b;border-color:#9b9b9b;vertical-align:top}
.tg .tg-redbg{font-family:Arial, Geneva, sans-serif !important;;background-color:
#ff6347;border-color:#9b9b9b;vertical-align:top}
.tg .tg-rb8b{background-color:#efefef;border-color:#9b9b9b;vertical-align:top}
.verinfo {color:Gray;font-family:Arial, sans-serif;font-size:9px}
<table class="tg">
<tr>
<td class="tg-ydru">Check Name</td>
<td class="tg-ydru">{{ .Check.Name }}</td>
</tr>
<tr>
<td class="tg-ydru">Check Status</td>
<td class="tg-redbg">CRITICAL</td>
</tr>
<tr>
<td class="tg-ydru">Check Output</td>
<td class="tg-ydru">{{ .Check.Output }}</td>
</tr>
<tr>
<td class="tg-ydru">Timestamp</td>
<td class="tg-ydru">{{(UnixTime .Check.Executed)}}</td>
</tr>
</table>
Output:
Check Output is not getting formatted.
At the same time if I manually paste the output into the template then it works fine. Not sure if any extra character is getting added when loading into the template using {{.Check.Output}}
The same HTML Output appears on Web UI but as per me Web UI should show output after formatting the html
Please let me know, if you need more details.