- edited description
monit reload
after use "monit reload" - service stop working but is active
after use systemd restart everythink is ok
i use unix sock insted port
as reverse proxy nginx
Comments (11)
-
reporter -
reporter - edited description
-
repo owner Please send: 1.) your monit configruation file 2.) your monit log 3.) your systemd's monit service configuration
Recipe for setting up monit inder systemd is here: https://mmonit.com/wiki/Monit/Systemd
-
reporter Config
set daemon 10 set logfile /var/log/monit.log set pidfile /var/run/monit/monit.pid set idfile /var/lib/monit/id set statefile /var/lib/monit/state set eventqueue basedir /var/lib/monit/events slots 100 set httpd unixsocket /var/run/monit/monit.sock allow @admin include /etc/monit/conf-enabled/*
After systemctl restart monit - now works
[CEST Sep 12 09:04:12] info : Monit daemon with pid [24312] stopped [CEST Sep 12 09:04:12] info : 'serwerek' Monit 5.24.0 stopped [CEST Sep 12 09:04:12] info : Starting Monit 5.24.0 daemon with http interface at /var/run/monit/monit.sock [CEST Sep 12 09:04:12] info : 'serwerek' Monit 5.24.0 started
After monit reload - now doesn't work - HTTP Response 502
[CEST Sep 12 09:05:38] info : Reinitializing monit daemon [CEST Sep 12 09:05:38] info : Reinitializing Monit -- control file '/etc/monit/monitrc' [CEST Sep 12 09:05:39] info : 'serwerek' Monit reloaded
init.d
set -e . /lib/lsb/init-functions DAEMON=/usr/local/bin/monit CONFIG=/etc/monit/monitrc NAME=monit DESC="daemon monitor" MONIT_OPTS= PID="/var/run/monit/$NAME.pid" # Check if DAEMON binary exist [ -f $DAEMON ] || exit 0 [ -f "/etc/default/$NAME" ] && . /etc/default/$NAME MONIT_OPTS="-c $CONFIG $MONIT_OPTS" monit_not_configured () { if [ "$1" != "stop" ] then printf "\tplease configure $NAME and then edit /etc/default/$NAME\n" printf "\tand set the \"START\" variable to \"yes\" in order to allow\n" printf "\t$NAME to start\n" fi exit 0 } monit_checks () { # Check if START variable is set to "yes", if not we exit. if [ "$START" != "yes" ] then monit_not_configured $1 fi } case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" monit_checks $1 if start-stop-daemon --start --quiet --oknodo --pidfile $PID --exec $DAEMON -- $MONIT_OPTS 1>/dev/null then log_end_msg 0 else log_end_msg 1 fi chown nginx /var/run/monit/monit.sock ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" if start-stop-daemon --retry TERM/5/KILL/5 --oknodo --stop --quiet --pidfile $PID 1>/dev/null then log_end_msg 0 else log_end_msg 1 fi ;; reload) log_daemon_msg "Reloading $DESC configuration" "$NAME" if start-stop-daemon --stop --signal HUP --quiet --oknodo --pidfile $PID --exec $DAEMON -- $MONIT_OPTS 1>/dev/null then log_end_msg 0 else log_end_msg 1 fi chown nginx /var/run/monit/monit.sock ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" start-stop-daemon --retry TERM/5/KILL/5 --oknodo --stop --quiet --pidfile $PID 1>/dev/null if start-stop-daemon --start --quiet --oknodo --pidfile $PID --exec $DAEMON -- $MONIT_OPTS 1>/dev/null then log_end_msg 0 else log_end_msg 1 fi chown nginx /var/run/monit/monit.sock ;; syntax) $DAEMON $MONIT_OPTS -t ;; status) status_of_proc -p $PID $DAEMON $NAME ;; *) log_action_msg "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|syntax|status}" ;; esac exit 0
-
repo owner Thank you for data. There is nothing in Monit configuration that could explain such behaviour, it is most probably caused by systemd interaction (i.e. systemd configuration issue).
Please can you provide more details about the initial statement?:
after use "monit reload" - service stop working but is active
What exactly doesn't work? Is it the Monit GUI/CLI? What action doesn't work and what error is returned? How this action performed before 'monit reload' and how after reload?
Which platform it is? (exact version) We'll try to reproduce the issue.
-
reporter OK. I found the diferent.
User who user use sock (in my case its nginx) need write permissions. Command monit reload make unwritable for other user then root.
That why in my init file i change owner
chown nginx /var/run/monit/monit.sock
I forgot about this line
-
repo owner - changed status to resolved
-
reporter Will they make changes or remain unchanged?
-
repo owner monit creates the unix socket as the user under which it is running and default permission ... there is a feature request for setting ownership/permissions via monit configuration (
#175), will link this issue to it -
repo owner - changed status to duplicate
Duplicate of
#175. -
repo owner - Log in to comment