Passing argument to exec command

Issue #739 closed
Former user created an issue

Hello,

How to pass arguments to the exec command ?

example: IF <TEST> THEN EXEC <command> $EVENT $SERVICE $ACTION $DESCRIPTION

Regards

Yves

Comments (1)

  1. Tildeslash repo owner

    From the Monit Manual:

    EXEC can be used to execute an arbitrary program and send an alert. If you choose this action you must state the program to be executed and if the program requires arguments you must enclose the program and its arguments in a quoted string. You may optionally specify the uid and gid the executed program should switch to upon start. The program is executed only once if the test fails. You can enable execute repetition if the error persists for a given number of cycles. For instance:

      if failed <test> then exec "/usr/local/bin/sms.sh arg1 arg2"
          as uid "nobody" and gid "nobody"
          repeat every 5 cycles
    

    Remember, if Monit is run by root, then all programs executed by Monit will be started with superuser privileges unless the uid and gid extension is used.

  2. Log in to comment