如何通过 RUNDECK 发送自定义输出

How to send Cutomised output through RUNDECK

我已经在我的配置文件夹中设置了 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 工作时,我收到电子邮件通知,但我收到的电子邮件包含所有详细信息、日志、使用的命令,甚至是我不希望 recipent 看到的代码

我想自定义它,只在消息正文中显示输出结果。

示例:检查服务器的运行状况

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

请帮忙,我可能需要添加什么插件或任何东西

提前致谢

你可以使用一个custom template with your 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>

Here the result on Rundeck, and here 在电子邮件收件箱上。

是否可以将捕获的全局日志过滤器变量(如 ${data.app_host} 传递到这样的邮件模板中?

<html>
    <head>
        <title>my template</title>
    </head>
    <body>
        <p>Data: ${data.app_host}</p>
    </body>
</html>