Capturing output from an exec

Issue #977 duplicate
Phil Schwartz created an issue

I’ve seen this subject come up on the web but not sure if there has been a formal request for this functionality. I’d like to be able to capture the output of the exec’ed script such that it could be referenced in the mail-format (or appended to $DESCRIPTION). I know I could have the script send a separate email but it would be desirable to have included in the monit email. This would make it easier to view more details of what the script did without having to examine a log on the $HOST.

Comments (2)

  1. Tildeslash repo owner

    we have just implemented a content match test for program output, which sends the program output on match.

    Syntax:

    if content [!]= <regex> then <action>
    

    Example:

    check program disk0_smart with path "/usr/sbin/nvme smart-log /dev/nvme0"
                if content != "critical_warning[ ]+: 0" then alert
    

  2. Log in to comment