I want to setup a "Monit" on a centralized server to monitor the process on the remote servers. (In My use case, i want to restart the Storm supervisors on servers A,B,C and Kafka brokers on servers D,E,F,G if they get shut down). I could not find an example where monit is used to monitor the remote processes. Is there any way to achieve the same using monit or any alternatives.
First off I am using an Ubuntu Server 16.04, So my syntax and file location may different than yours.
I was able to open the /etc/monit/monitrc
and input the remote server i am trying to monitor This is the syntax I used:
check host host.domain.name with address ip.addy.here.ip
start program = "ssh user@ipaddress /etc/init.d/sshd start"
stop program = "ssh user@ipaddress /etc/init.d/sshd stop"
if failed port 22 protocol ssh
then alert
Of course you would have to use a user with priviledges.