Hello,

I would configure 3 nodes.For the moment I start with just 2.
I would like check :
                 * Server up or down
                 * Iptables service ok or ko
                 * Squid service ok or ko.

For that I have create :
               * authkeys
               * ha.cf with that :
use_logd on
keepalive 500ms
deadtime 2
warntime 1
initdead 8
udpport 694
#My gateway
ping 172.16.16.1
bcast eth3
auto_failback on
node poolmail.test.local
node poolmail1.test.local
crm yes
autojoin any


             * cib.xml
 <cib generated="false" admin_epoch="0" have_quorum="false"
ignore_dtd="false" num_peers="2" cib_feature_revision="1.3" num_updates="1"
epoch="203" cib-last-written="Tue May 13 15:30:03 2008">
   <configuration>
     <crm_config>
       <cluster_property_set id="cib-bootstrap-options">
         <attributes>
           <nvpair id="cib-bootstrap-options-dc-version" name="dc-version"
value="2.1.3-node: 552305612591183b1628baa5bc6e903e0f1e26a3"/>
           <nvpair id="cib-bootstrap-options-last-lrm-refresh"
name="last-lrm-refresh" value="1210157110"/>
         </attributes>
       </cluster_property_set>
     </crm_config>
     <nodes>
       <node id="5db1da47-ff05-44b3-8314-1628461b9abd"
uname="poolmail1.test.local" type="normal">
         <instance_attributes
id="nodes-5db1da47-ff05-44b3-8314-1628461b9abd">
           <attributes>
             <nvpair id="standby-5db1da47-ff05-44b3-8314-1628461b9abd"
name="standby" value="false"/>
           </attributes>
         </instance_attributes>
       </node>
       <node id="cb12f5eb-e71e-43c7-a974-81962ac45665"
uname="poolmail.test.local" type="normal">
         <instance_attributes
id="nodes-cb12f5eb-e71e-43c7-a974-81962ac45665">
           <attributes>
             <nvpair name="standby"
id="standby-cb12f5eb-e71e-43c7-a974-81962ac45665" value="false"/>
           </attributes>
</instance_attributes>
       </node>
     </nodes>
     <resources>
       <group id="Proxy_group">
         <primitive class="ocf" id="proxy_ip" provider="heartbeat"
type="IPaddr">
           <instance_attributes id="Proxy_inst">
             <attributes>
               <nvpair id="IPaddr_IPaddr:172_16_16_80_attr_0" name="ip"
value="172.16.16.80"/>
               <nvpair id="IPaddr_IPaddr:172_16_16_80_attr_1" name="netmask"
value="20"/>
               <nvpair id="IPaddr_IPaddr:172_16_16_80_attr_2" name="nic"
value="eth3"/>
             </attributes>
           </instance_attributes>
         </primitive>
         <primitive id="resource_squid" class="ocf" type="Squid3"
provider="heartbeat">
           <meta_attributes id="resource_squid_meta_attrs">
             <attributes/>
           </meta_attributes>
           <operations>
             <op id="1" name="start" timeout="5s" start_delay="0"
disabled="false" role="Started" on_fail="restart"/>
             <op id="2" name="stop" timeout="5s" start_delay="0"
disabled="false" role="Started"/>
             <op id="3" name="monitor" interval="10s" timeout="3s"
start_delay="5s" disabled="false" role="Started">
               <instance_attributes id="monitor_10s">
                 <attributes>
                   <nvpair id="OCF_CHECK_LEVEL_MON_10SEC"
name="OCF_CHECK_LEVEL" value="0"/>
                 </attributes>
               </instance_attributes>
             </op>
             <op id="4" name="monitor" interval="1min" timeout="5s"
start_delay="0" disabled="false" role="Started">
               <instance_attributes id="monitor_1min">
                 <attributes>
                   <nvpair id="OCF_CHECK_LEVEL_MON_1MIN"
name="OCF_CHECK_LEVEL" value="10"/>
                 </attributes>
               </instance_attributes>
             </op>
             <op id="5" name="monitor" interval="30min" timeout="20s"
start_delay="0" disabled="false" role="Started">
               <instance_attributes id="monitor_30min">
                 <attributes>
                   <nvpair id="OCF_CHECK_LEVEL_MON_30MIN"
name="OCF_CHECK_LEVEL" value="20"/>
                 </attributes>
               </instance_attributes>
             </op>
           </operations>
         </primitive>
       </group>
     </resources>
     <constraints>
 <rsc_location id="rsc_location_IPaddr_IPaddr:172_16_16_80"
rsc="Proxy_group">
         <rule id="pref_run_proxy" score="100">
           <expression attribute="#uname" id="pref_proxy" operation="eq"
value="poolmail.test.local"/>
         </rule>
       </rsc_location>
     </constraints>
   </configuration>
 </cib>

          * Squid3 (in /usr/...../resource.d/heartbeat/

#!/bin/sh
#
#       High-Availability Apache/IBMhttp control script
#
# apache (aka IBMhttpd)
#
# Description:  starts/stops proxy web servers.
#
# Author:       Stephane Gros
#
# Support:      [email protected]
#
# License:      GNU General Public License (GPL)
#
# Copyright:    (C) 2002-2005 International Business Machines
#
#
#
set -x
if [ -f ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs ]
then
         . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
else
         if [ -f /usr/share/ocf/resource.d/heartbeat/.ocf-shellfuncs ]
         then
                 . /usr/share/ocf/resource.d/heartbeat/.ocf-shellfuncs
         fi
         #exit $OCF_ERR_CONFIGURED
fi

#. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
HA_VARRUNDIR=${HA_VARRUN}
WGET=/usr/bin/wget


#######################################################################
#
#       Configuration options - usually you don't need to change these
#
#######################################################################
#
PidFile=/var/run/squid.pid
WGETOPTS="-T 1 -O"
SQUIDRUN="/usr/sbin/squid"
STATUSURL="http://localhost:3128";
SQUIDOPT="-D"

#       End of Configuration options
#######################################################################

CMD=`basename $0`


#       The config-file-pathname is the pathname to the configuration
#       file for this web server.  Various appropriate defaults are
#       assumed if no config file is specified.  If this command is
#       invoked as *IBM*, then the default config file name is
#       $DEFAULT_IBMCONFIG, otherwise the default config file
#       will be $DEFAULT_NORMCONFIG.
usage() {
  cat <<-!
usage: $0 action

action:
        start   start the proxy server

        stop    stop the proxy server

        status  return the status of proxy server, run or down

        monitor  return TRUE if the proxy server appears to be working.
                 You have to have
                installed $WGET for this to work.

        meta-data       show meta data message

        validate-all    validate the instance parameters
        !
  exit $OCF_ERR_ARGS
}


#
# return TRUE if a process with given PID is running
#
ProcessRunning() {
    SquidPID=$1
    # Use /proc if it looks like it's here...
    if
      [ -d /proc -a -d /proc/1 ]
    then
       [ -d /proc/$SquidPID ]
    else
      #  This assumes we're running as root...
      kill -0 "$SquidPID" >/dev/null 2>&1
    fi
}


silent_status() {
  if
    [ -f $PidFile  ]
  then
    ProcessRunning `cat $PidFile`
  else
    : No pid file
    false
  fi
}

start_squid() {
  if
    silent_status
  then
    ocf_log info "$CMD already running (pid $ApachePID)"
    return $OCF_SUCCESS
  fi
  ocf_run $SQUIDRUN $SQUIDOPT
  tries=0
  while :  # wait until the user set timeout
  do
    monitor_squid
        ec=$?
        echo $ec
        if [ $ec -eq $OCF_NOT_RUNNING ]

        then
                tries=`expr $tries + 1`
                ocf_log info "waiting for squid to come up"
                sleep 1
        else
                if [ $ec -eq $OCF_ERR_GENERIC ] && [ $tries -gt 3 ]
                then
                        ocf_log info "probleme generic.Must stop squid"
                        echo "Pb"
                        stop_squid
                        return $OCF_ERR_GENERIC
                fi
                tries=`expr $tries + 1`
                if [ $tries -gt 4 ]
                then
                        break
                fi
        fi
  done
        return $ec
}


stop_squid() {
  if
    silent_status
  then
    if
      kill $SquidPID
    then
      tries=0
      while
        ProcessRunning $SquidPID &&
        [ $tries -lt 10 ]
      do
        sleep 1
        kill $SquidPID >/dev/null 2>&1
        ocf_log info "Killing squid PID $SquidPID"
        tries=`expr $tries + 1`
      done
    else
      ocf_log warn "Killing squid PID $SquidPID FAILED."
    fi
    if
      ProcessRunning $SquidPID
    then
      ocf_log info "$CMD still running ($SquidPID)."
      false
    else
      ocf_log info "$CMD stopped."
    fi
  else
    ocf_log info "$CMD is not running."
  fi

  for sig in SIGTERM SIGHUP SIGKILL ; do
    if pgrep -f $SQUIDRUN >/dev/null 2>&1 ; then
      pkill -$sig  -f $SQUIDRUN >/dev/null 2>&1
      ocf_log info "squid children were signalled ($sig)"
      sleep 1
    else
      break
    fi
  done
}


status_squid() {
  silent_status
  rc=$?
  if
    [ $rc -eq 0 ]
  then
    ocf_log info "$CMD is running (pid $SquidPID)."
    return $OCF_SUCCESS
  else
    ocf_log info "$CMD is stopped."
    return $OCF_NOT_RUNNING
  fi
}

monitor_squid() {
  if
        ! have_binary $WGET
  then
        ocf_log err "Monitoring not supported by $OCF_RESOURCE_INSTANCE"
        ocf_log info "Please make sure that wget is available"
        return $OCF_ERR_CONFIGURED
  fi

  if
    ! silent_status
  then
        ocf_log info "$CMD not running"
        return $OCF_NOT_RUNNING
  fi

  #TEST="$(wget -O /dev/null http://localhost:3128 2>&1 | grep '400 Bad
Request')"
 Check_Port="$($WGET $WGETOPTS /dev/null $STATUSURL 2>&1 | grep '400 Bad
Request')"
 [ -z "$Check_Port" ] && return $OCF_ERR_GENERIC

  return $OCF_SUCCESS
}


metadata_squid(){
        cat <<END
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
<resource-agent name="squid">
<version>1.0</version>

<longdesc lang="en">
This is the resource agent for the
Squid Proxy.
Thie resource agent operates both version 1.x and version 2.x Apache
servers.
</longdesc>
<shortdesc lang="en">Proxy server</shortdesc>

<parameters>

<parameter name="port" >
<longdesc lang="en">
A port number that we can probe for status information
using the statusurl.
This will default to the port number found in the
configuration file, or 80, if none can be found
in the configuration file.

</longdesc>
<shortdesc lang="en">squid port</shortdesc>
<content type="integer" />
</parameter>

</parameters>

<actions>
<action name="start"   timeout="10" />
<action name="stop"    timeout="10" />
<action name="status"  timeout="10" />
<action name="monitor" depth="0"  timeout="20" interval="10"
start-delay="10" />
<action name="meta-data"  timeout="5" />
<action name="validate-all"  timeout="5" />
</actions>
</resource-agent>
END

        exit $OCF_SUCCESS
}


validate_all_squid() {

  if [ ! -x $SQUIDRUN ]; then
        ocf_log err " $SQUIDRUN not found or is not an executable!"
        exit $OCF_ERR_ARGS
  fi

  return $OCF_SUCCESS
}


case $__OCF_ACTION in
  start)        start_squid;;
  stop)         stop_squid;;
  status)       status_squid;;
  monitor)      monitor_squid;;
  meta-data)    metadata_squid;;
  validate-all) validate_all_squid;;
  *)            usage;;
esac

exit $?




With this configuration it's ok the first time. If I doing after that I have
a problem:
               * 1) Poolmail start IPAddr & Squid
               * 2) On poolmail I drop the 3128 port. IPaddr & Squid start
on Poolmail1
               * 3) If I accept now the 3128 port on Poolmail I don't come
back on this server
                * 4) If I drop the 3128 port on Poolmail1 I have on crm_mon
that

Failed actions:
    resource_squid_start_0 (node=poolmail.ipanema.local, call=11, rc=-2):
Timed
Out
    resource_squid_start_0 (node=poolmail1.ipanema.local, call=11, rc=-2):
Timed
 Out

 How I can do if I want resolve this problem?

Thanks

Stéphane
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to