我已经在我的配置文件夹中设置了rundeck-config.groovy
,这也包含在我的配置文件中。
我的Groovy文件:
grails.mail.default.from="pavan@gmail.com" grails { mail {host = "smtp.gmail.com" username = "pavan@gmail.com" port = 587 password = "ghsdkexgbnsowmdsu" props =["mail.smtp.starttls.enable":"true", "mail.smtp.port":587, "mail.smtp.auth":"true"] }}
当我执行RUNDECK
工作时,我正在接收电子邮件通知,但是我收到的电子邮件具有所有详细信息,日志,使用的命令,甚至是我不希望菜谱师看到的代码
我想对其进行自定义,并仅在消息正文中显示输出结果。
示例:检查服务器的运行状况
url = "curl -kv https://vn2-lpgdmt-capp99.rno.vzon.com:8990/health/check"
在输出中我只想显示为
https://vn2-lpgdmt-capp99.rno.vzon.com:8990/health/check = Status:200 ok
请帮忙,我可能要添加什么插件或什么东西
先谢谢您
答案 0 :(得分:0)
您可以将custom template与email notification一起使用,并使用${logouput.data}
打印输出,我举一个例子:
<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='devopsteam@example.net' 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>
使用此HTML模板:
<html>
<head>
<title>my template</title>
</head>
<body>
<p>Data: ${logoutput.data}</p>
</body>
</html>