Rule execution on remote host

Issue #745 closed
Former user created an issue

I want to execute some commands and shell script on my remote host based on the rule match( configured on M/Monit rule page)

Let me know the way to configure this action in M/Monit rule page.

Also i would like to see the action results or status. Let me know where can we get this information.

Comments (4)

  1. Tildeslash repo owner

    You can use the 'exec' action with "ssh" CLI and pass the command to the remote host. You'll need to setup ssh key based authentication between M/Monit (ssh client) and the target host (ssh server) - you can also restrict the commands that are allowed on the server side. See ssh documentation for more details about ssh setup.

  2. Prem Kumar

    Thanks for the information.

    Also i would like to see the action results or status. Let me know where can we get this information.

  3. Tildeslash repo owner

    The output of the exec/command is not logged by M/Monit ... if you want to log the output, you can add pipe to logger (will log to syslog) directly to the M/Monit exec action, for example:

    /usr/bin/ssh myuser@myhost 'mycommand' | logger
    
  4. Log in to comment