Rule execution on remote host
Issue #745
closed
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)
-
repo owner -
repo owner - changed status to closed
-
Thanks for the information.
Also i would like to see the action results or status. Let me know where can we get this information.
-
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
- Log in to comment
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.