Re: Duplicate Monit Process

Abhishek Patti <[email protected]>
Newsgroups gmane.comp.monitoring.monit.general
Message-ID <CAH=o+=0fLS1T=pOssKgkDprM1Fao42usdU36ARgADt8J7A6GyA@mail.gmail.com>
Hi

Here is my configuration

init.d

#!/bin/sh

### BEGIN INIT INFO
# Provides:          monit
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Should-Start:      $all
# Should-Stop:       $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: service and resource monitoring daemon
# Description:       monit is a utility for managing and monitoring
#                    processes, programs, files, directories and filesystems
#                    on a Unix system. Monit conducts automatic maintenance
#                    and repair and can execute meaningful causal actions
#                    in error situations.
### END INIT INFO

set -e

. /lib/lsb/init-functions

DAEMON=/usr/bin/monit
CONFIG=/etc/monit/monitrc
NAME=monit
DESC="daemon monitor"
MONIT_OPTS=
PID="/run/$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
    ;;
  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
    ;;
  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
    ;;
  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




On Tue, Jul 14, 2020 at 9:01 AM <[email protected]> wrote:

> Send monit-general mailing list submissions to
>         [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.nongnu.org/mailman/listinfo/monit-general
> or, via email, send a message with subject or body 'help' to
>         [email protected]
>
> You can reach the person managing the list at
>         [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of monit-general digest..."
>
>
> Today's Topics:
>
>    1. Duplicate Monit Process (Abhishek Patti)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 13 Jul 2020 15:56:11 -0700
> From: Abhishek Patti <[email protected]>
> To: [email protected]
> Subject: Duplicate Monit Process
> Message-ID:
>         <CAH=o+=
> [email protected]>
> Content-Type: text/plain; charset="utf-8"
>
> Hi everyone
>
> I have noticed that whenever system experiences high load, we see two monit
> process
>
> root     12303     1  0 Jun03 ?        00:19:14 /usr/bin/monit -c
> /etc/monit/monitrc
> root     23446 22694  0 21:40 pts/0    00:00:00 grep monit
> root     31792 31493  0 21:22 ?        00:00:00 /usr/bin/monit -c
> /etc/monit/monitrc
>
> Once the load reduces on the machine, it goes back to a single process.
>
> The version of monit is This is Monit version 5.25.1
>
>
> Thank You
>
> Abhi
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://lists.nongnu.org/archive/html/monit-general/attachments/20200713/a613c3fe/attachment.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> monit-general mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/monit-general
>
>
> ------------------------------
>
> End of monit-general Digest, Vol 207, Issue 5
> *********************************************
>


-- 
abhishek
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.