monit monitoring solution

Added by Mark Petryk about 1 year ago

Hi Koen, et al.

Do you happen to have a 'sample' monit file that I can reference for how you've used it to monitor wt servers?

Also, you mentioned in one of the threads here on this forum, that you've been 'marginally satisfied' (paraphrasing) with monit, and that you needed a monit for monit. Where do you stand on this?


Replies (3)

RE: monit monitoring solution - Added by Koen Deforche about 1 year ago

Hey Mark,

Yes, see below:

Monit lines (for process charts.wt listening on port 1417):

check process charts.wt
  with pidfile /home/wt/project/wt-deployed/run/charts.wt.pid
  start program = "/home/wt/project/wthttpd.sh start /home/wt/project/wt-deployed/charts/charts.wt /charts.wt 1417" 
  stop program  = "/home/wt/project/wthttpd.sh stop  /home/wt/project/wt-deployed/charts/charts.wt" 
  if failed port 1417 protocol http request /monittoken then restart

wthttpd.sh script:

#!/bin/bash

if [ $# '<' "2" ]; then
    echo $"Usage: wthttpd.sh {start|stop} /path/to/app.wt ..." 
    exit 1
fi

if [ ! -f $2 ]; then
   echo $"Could not locate application: $2"; 
   exit 1
fi

exe=`basename $2`
dir=`dirname $2`
exname=`basename $dir`

export APPROOT=/home/wt/project/approot
export LD_LIBRARY_PATH=/usr/local/lib
export PATH=/usr/local/bin:$PATH
#export MALLOC_CHECK_=2

case "$1" in
  start)
    if [ $# != "4" ]; then
      echo $"Usage: wthttpd.sh start /path/to/app.wt path port" 
      exit 1
    fi

    cd $dir;
    touch docroot/monittoken;
    ulimit -c unlimited;
    ulimit -s 1024;
    ./$exe -p ../run/$exe.pid --deploy-path $3 --http-port $4 \
    --docroot 'docroot;/css,/resources,/icons,/favicon.ico' \
    --approot $APPROOT/$exname `cat argv` >> ../run/$exe.log 2>&1 &
    sleep 1;
    ;;
  stop)
    if [ $# != "2" ]; then
      echo $"Usage: wthttpd.sh stop /path/to/app.wt" 
      exit 1
    fi

    cd $dir;
    pid=`cat ../run/$exe.pid`;
    kill $pid;
    sleep 3;
    kill -9 $pid;
    sleep 1;
    ;;
  *)
    echo $"Usage: wthttpd.sh {start|stop} /path/to/app.wt ..." 
    exit 1
esac

Indeed we are not satisfied with monit and have started using systemd directly in new deployments.

Regards,
koen

RE: monit monitoring solution - Added by Mark Petryk about 1 year ago

Thank you, Koen.

(1-3/3)