Page 1 of 1

Monit for mosquitto

Posted: Sunday 03 December 2017 16:40
by costo
Followed the wiki and installed monit for domoticz, that works perfect.
I have this part in /etc/monit/monitrc for domoticz

Code: Select all

  check process domoticz with pidfile /var/run/domoticz.pid
  start program = "/etc/init.d/domoticz.sh start"
  stop  program = "/etc/init.d/domoticz.sh stop"

  if failed
     url http://127.0.0.1:8080/json.htm?type=command&param=getversion
         and content = '"status" : "OK"'
     for 2 cycles
     then restart
  if 5 restarts within 5 cycles then exec "/sbin/reboot"
Now I like to monitor mosquitto also , so i added this at the end of /etc/monit/monitrc

Code: Select all

  check process mosquitto with pidfile /var/run/mosquitto.pid
  start program = "/etc/init.d/mosquitto start"
  stop  program = "/etc/init.d/mosquitto stop"
I got a new Monit mosquitto page, but it does not work as supposed. After initialising it says: execution failed.
What can I do to make this work ?

Note: I run jessie on a raspberryPi 2b

Re: Monit for mosquitto

Posted: Sunday 03 December 2017 17:44
by SweetPants
mosquitto does not use a PID, look in /var/run

Re: Monit for mosquitto

Posted: Sunday 03 December 2017 18:07
by costo
Thanks for the reply
SweetPants wrote: Sunday 03 December 2017 17:44 mosquitto does not use a PID, look in /var/run

I see a /var/run/mosquitto.pid file , just as domoticz has one, both 6 Bytes in size. In mosquitto.pid there is a number which is different all the time.
The only difference is in the permissions, domoticz.pid = --- and mosquitto.pid = r--

After removing the line "check process mosquitto with pidfile /var/run/mosquitto.pid" from monitrc, monit does no longer have a page named mosquitto.
This is no solution for monitoring mosquitto

Re: Monit for mosquitto

Posted: Sunday 16 April 2023 13:38
by tonbor
here is the answer, for people to help https://rouwette.com/install-monit/

Re: Monit for mosquitto

Posted: Sunday 16 April 2023 14:51
by Kedi
Mine is:

Code: Select all

check process mosquitto matching "mosquitto"
     start program = "/bin/systemctl start mosquitto"
     stop program = "/bin/systemctl stop mosquitto"
     if 4 restarts within 5 cycles then alert
     if 5 restarts within 5 cycles then timeout