Reputation: 35
I have set my rundeck-config.groovy
in my config folder and this is included in my profile file as well.
My Groovy file:
grails.mail.default.from="[email protected]" grails { mail {host = "smtp.gmail.com" username = "[email protected]" port = 587 password = "ghsdkexgbnsowmdsu" props =["mail.smtp.starttls.enable":"true", "mail.smtp.port":587, "mail.smtp.auth":"true"] }}
when i run my RUNDECK
job i am recieving email notification, but the email i recieve has all the details, logs, commands used, even code which i dont want the recipent to see
i want to customise it and show only the output result in message body.
example: Checking Health of a server
url = "curl -kv https://vn2-lpgdmt-capp99.rno.vzon.com:8990/health/check"
in the output i only want to show as
https://vn2-lpgdmt-capp99.rno.vzon.com:8990/health/check = Status:200 ok
kindly help, what plugins i might have to add or anything
thank you in advance
Upvotes: 0
Views: 2062
Reputation: 61
Is it possible to pass a captured Global Log Filters variable like ${data.app_host} into a mail template like this?
<html>
<head>
<title>my template</title>
</head>
<body>
<p>Data: ${data.app_host}</p>
</body>
</html>
Upvotes: 1
Reputation: 4325
You can use a custom template with your email notification that prints the output using ${logouput.data}
to print the output, I leave an example:
<joblist>
<job>
<context>
<options preserveOrder='true'>
<option name='myurl' value='http://www.google.com' />
</options>
</context>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>322beb61-c701-4758-b58f-55da63953dee</id>
<loglevel>INFO</loglevel>
<name>CheckStatusExample</name>
<nodeFilterEditable>false</nodeFilterEditable>
<notification>
<onsuccess>
<email attachLog='true' attachLogInline='true' recipients='[email protected]' subject='Success!' />
</onsuccess>
</notification>
<notifyAvgDurationThreshold />
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<fileExtension>.sh</fileExtension>
<script><![CDATA[echo "@option.myurl@=$(curl --write-out %{http_code} --silent --output /dev/null @option.myurl@)"]]></script>
<scriptargs />
<scriptinterpreter>/bin/bash</scriptinterpreter>
</command>
</sequence>
<uuid>322beb61-c701-4758-b58f-55da63953dee</uuid>
</job>
</joblist>
With this HTML template:
<html>
<head>
<title>my template</title>
</head>
<body>
<p>Data: ${logoutput.data}</p>
</body>
</html>
Here the result on Rundeck, and here on the email inbox.
Upvotes: 1