If anyone has tried to customize mustache template data with html or any visual representation so we can receive an email as a tabular format. Please suggest.
Hi @sbaniya, Have you found the solution for this mustache extracted data with HTML table and send email. I’m looking for the same solution. Any kind of suggestion would be helpful.
+1 to the question. I’m also interested in setting HTML emails rather than plain/text
Is it possible?
Or do we need to use a custom webhook and setup some Notification API.
Does anyone has a solution for this
Hi,
Alerting email notifications currently only support plain/text
. HTML is not yet supported.
Please feel free to create an issue in the Alerting plugin repo to track this feature enhancement.
Hi All,
Work around Solution:
I was able to do the HTML format for email using custom webhook (destination as jenkins (generic-webhook-trigger)). Below are the steps if someone wants to do it.
Steps:
- Message info in opendistro alerting write your message including painless script and include html tags.
- create a free-style jenkins job → enable the generic webhook trigger-> provide the variable to receive text format from kibana (custom webhook).
- enable/create execute shell in Build, and write the incoming text (variable assigned in generic webhook) to a file with html extention (echo $variable > email.html).
- enable editable email notification in your post build. Follow the steps from the document below.
Jenkins email integration
Hope this helps until we get this feature.
Thanks,
Sam.
Thanks @sam . My index has certain fields with a dot in the name itself . That is host.name itself a field namet. SO the only way to access this field should be something like how we access objects in javascript ie…
object.[‘host.name’]
Can we perform similar things in the message info section with this approach ? … or is it that we can just use html thats all ?
Hello @sam ,
followed the steps but not getting the message in variable . What could be the issue ? Please help.
Hi,
Well, can you please confirm if you are using the jenkins generic webhook trigger that I mentioned? If yes, then the variable comes from webhook as I mentioned in the example above.
Thanks,
Sam
Hello @sam ,
Thanks for your reply. I did the configuration as you mentioned . I have attached the Screenshots of my configuration. Please have a look and help me.
Console Output
Generic Cause
Running as SYSTEM
Building on master in workspace e:\jenkins\workspace\SIEBEL\ELKSENDEMAIL
Checking for pre-build
Executing pre-build step
Checking if email needs to be generated
No emails were triggered.
GenericWebhookEnvironmentContributor
Received:
Monitor name : DEV Component Status
Trigger name : Component Status Trigger
<table style="width:100%">
<tr>
<th>Timestamp</th>
<th>Server</th>
<th>ComponentAlias</th>
<th>ComponentStatus</th>
</tr>
<tr>
<td>2021-05-18T05:40:57.674Z</td>
<td>XXXXX</td>
<td>SFMWfProcMgrPE</td>
<td>Shutdown</td>
</tr>
</table>
Contributing variables:
myParameter =
[ELKSENDEMAIL] $ cmd /c call C:\Users\E122_S_SVCBLD-S\AppData\Local\Temp\jenkins5376760339755622267.bat
e:\jenkins\workspace\SIEBEL\ELKSENDEMAIL>echo
ECHO is on.
e:\jenkins\workspace\SIEBEL\ELKSENDEMAIL>exit 0
Checking for post-build
Performing post-build step
Checking if email needs to be generated
Email was triggered for: Success
Sending email for trigger: Success
Sending mail from default account using custom from address XXXX@XX.com
messageContentType = text/html; charset=UTF-8
Adding recipients from project recipient list
Analyzing: XXXX@XXX.com
Looking for: XXXX@XXX.com
starting at: 0
firstFoundIdx: 0
firstFoundIdx-substring: XXXX@XXX.com
=> found type: 0
Analyzing: XXXX@XXX.com
Looking for: XXXX@XXX.com
starting at: 0
firstFoundIdx: 0
firstFoundIdx-substring: XXXX@XXX.com
=> found type: 0
Analyzing: XXXX@XXX.com
Looking for: XXXX@XXX.com
starting at: 0
firstFoundIdx: 0
firstFoundIdx-substring: XXXX@XXX.com
=> found type: 0
Adding recipients from trigger recipient list
Analyzing: XXXX@XXX.com
Looking for: XXXX@XXX.com
starting at: 0
firstFoundIdx: 0
firstFoundIdx-substring: XXXX@XXX.com
=> found type: 0
Analyzing: XXXX@XXX.com
Looking for: XXXX@XXX.com
starting at: 0
firstFoundIdx: 0
firstFoundIdx-substring: XXXX@XXX.com
=> found type: 0
Successfully created MimeMessage
Sending email to: XXXX@XXX.com
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "XXX.net", port 25, isSSL false
220 S122V117A.cac.XXXchrysler.com Microsoft ESMTP MAIL Service ready at Tue, 18 May 2021 07:43:51 +0200
DEBUG SMTP: connected to host "XXX.net", port: 25
EHLO XXXX.net
250-XXXXXXX.com Hello [53.248.79.134]
250-SIZE 524288000
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-AUTH
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250-XEXCH50
250 XSHADOW
DEBUG SMTP: Found extension "SIZE", arg "524288000"
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "DSN", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "AUTH", arg ""
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "BINARYMIME", arg ""
DEBUG SMTP: Found extension "CHUNKING", arg ""
DEBUG SMTP: Found extension "XEXCH50", arg ""
DEBUG SMTP: Found extension "XSHADOW", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<]XXX.com>
250 2.1.0 Sender OK
DEBUG SMTP: sendPartial set
RCPT TO:<XXXX@XXX.com>
250 2.1.5 Recipient OK
DEBUG SMTP: Verified Addresses
DEBUG SMTP: XXXX@XXX.com
DATA
354 Start mail input; end with <CRLF>.<CRLF>
Date: Tue, 18 May 2021 07:43:51 +0200 (CEST)
From: XXXXX.com
Reply-To: XXXX@XXX.com
To: XXXXX.XXXX@XXX.com
Message-ID: <22183187.406.1621316631710@S1220001072A.nl122.corpintra.net>
Subject: ELK alert
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_405_18996517.1621316631687"
X-Jenkins-Job: ELKSENDEMAIL
X-Jenkins-Result: SUCCESS
List-ID:
------=_Part_405_18996517.1621316631687
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
ECHO is on.
------=_Part_405_18996517.1621316631687--
.
250 2.6.0 <22183187.406.1621316631710@S1220001072A.nl122.corpintra.net> [InternalId=24766622] Queued mail for delivery
DEBUG SMTP: message successfully delivered to mail server
QUIT
221 2.0.0 Service closing transmission channel
Finished: SUCCESS
Trigger Info
Email output coming as
Thanks and Regards
Saravana S