monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

monit+heartbeat and drbd


From: alex
Subject: monit+heartbeat and drbd
Date: Fri, 21 Sep 2007 12:36:10 +0300

   After read 'MONIT WITH HEARTBEAT' section of Monit documentation i make
some little changes for '/etc/init.d/monit-node1' example script:

#!/bin/bash
#
# script for starting/stopping all services for given clusters node
#

prog="/usr/local/bin/monit -g $1"
start()
 {
    echo -n "Starting Monit services for group '$1':"
    $prog start all
    RETVAL=$?
    echo
 }
stop()
 {
    echo -n "Stopping Monit services for group '$1':"
    $prog stop all
    RETVAL=$?
    echo
 }

case "$#" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    *)
        echo "Usage: $0 groupname {start|stop}"
        RETVAL=1
esac
exit $RETVAL


    Now we can use this script on both nodes without any tunes and i called
it 'monit-hb'.
For use this form of script we must change its call from 'heartbeat: /etc/ha.d/haresources' as follow:


node1 IPaddr::172.16.100.1  monit-hb::node1
node2 IPaddr::172.16.100.2  monit-hb::node2

----------

    I not understand why in section 'INIT SUPPORT' you tell that we must
use '-I' parameters:

mo:2345:respawn:/usr/local/bin/monit -Ic /etc/monitrc

    but in section 'MONIT WITH HEARTBEAT' you are start 'monit' in daemon
mode:

mo:2345:respawn:/usr/local/bin/monit -d 10 -c /etc/monitrc -g local

    Yet another question. '-d 10' option means that 'monit' daemon  restart
after 10 seconds or it is daemon poll interval (as 'set daemon' option)?

----------

   I want to use also 'drbd' with 'monit+heartbeat' and found some info
about this configuration in your maillist archive but without content of
'ha-fs' script that mention there. I send to you my variant and think that
not will be bad if you add info about 'monit+heartbeat+drbd' into your
documentation.
   My variant 'monitrc':

check device fs with path /dev/drbd0
    start program  = "/etc/ha.d/resource.d/ha-fs start"
    stop program  = "/etc/ha.d/resource.d/ha-fs stop"
    if failed permission 660 then unmonitor
    if failed uid root then unmonitor
    if failed gid root then unmonitor
    if space usage > 80% then alert
    if space usage > 99% then stop
    mode  manual
    group node1
check process postgresql with pidfile /var/run/postgresql.pid
    start program = "/etc/init.d/postgresql start"
    stop program  = "/etc/init.d/postgresql stop"
    depends fs
    alert address@hidden
    mode  manual
    group node1
check process app-server with pidfile /var/run/app-server.pid
    start program = "/etc/init.d/app-server start"
    stop program  = "/etc/init.d/app-server stop"
    depends postgresql
    alert address@hidden
    mode  manual
    group node1

#
# node2 services
#
check process asterisk with pidfile /var/apache/logs/httpd.pid
    start program = "/etc/init.d/apache start"
    stop program  = "/etc/init.d/apache stop"
    alert address@hidden
    mode  manual
    group node2


   and content of '/etc/ha.d/resource.d/ha-fs' with my values:


#!/bin/bash
#
# script for starting/stopping services underlies of 'fs' device
#

scrd="/etc/ha.d/resource.d"

start()
 {
    echo -n "Starting 'fs' device services:"
    $scrd/drbddisk pgdisk start && \
    $scrd/Filesystem /dev/drbd0 /mnt/cluster reiserfs start
    RETVAL=$?
    echo
 }
stop()
 {
    echo -n "Stopping 'fs' device services:"
    $scrd/Filesystem /dev/drbd0 /mnt/cluster reiserfs stop
    $scrd/drbddisk pgdisk stop
    RETVAL=$?
    echo
 }

case "$#" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    *)
        echo "Usage: $0 {start|stop}"
        RETVAL=1
esac
exit $RETVAL


     I don't test this configuration but will do it at near time.
     I will be much grateful to you for your opinion about my proposal and
any fixes.
     Thank you very much.

     Aleksandr Shubnik
---------
Процесс обучения индивидуален. Курсы иностранных языков 'Streamline' предлагают своим клиентам комфортное и эффективное обучение в группах V.I.P. численностью до 8-ми человек. http://www.str.by/







reply via email to

[Prev in Thread] Current Thread [Next in Thread]