2011年(6)
分类: LINUX
2011-08-17 11:35:29
- virtual_server 10.7.1.1 80 {
- delay_loop 6
- lb_algo wlc
- lb_kind DR
- persistence_timeout 3600
- protocol TCP
- real_server 10.7.1.10 80 {
- weight 100
- MISC_CHECK {
- misc_path "/etc/keepalived/script/check_http_ip 10.11.1.11 0.5 5 8 / 200"
- misc_timeout 5
- misc_dynamic
- }
- }
- real_server 10.7.1.11 80 {
- weight 100
- MISC_CHECK {
- misc_path "/etc/keepalived/script/check_http_ip 10.11.1.12 0.5 5 8 / 200"
- misc_timeout 5
- misc_dynamic
- }
- }
- }
- #!/bin/sh
- if [ -n "$1" ];then
- realip="-I $1"
- else
- echo "Usage: check_http_ip [IPaddress] [warningtime] [criticaltime] [timeout] [url] [expect]"
- fi
- if [ -n "$2" ];then
- warning_time="-w $2"
- fi
- if [ -n "$3" ];then
- criti_time="-c $3"
- fi
- if [ -n "$4" ];then
- timeout="-t $4"
- fi
- if [ -n "$5" ];then
- url="-u $5"
- fi
- if [ -n "$6" ];then
- expect="-e $6"
- fi
- time=`/usr/lib/nagios/plugins/check_http $realip $warning_time $criti_time $timeout $url $expect`
- #/usr/lib/nagios/plugins/check_http $realip $warning_time $criti_time $url $expect
- stat=`echo $?`
- if [ $stat == "0" ];then
- exit 102
- #awk '{if($time<$nomal_time){print "well";exit 52} else {exit 102;print "oh,no!"}}'
- else
- if [ $stat == "1" ];then
- exit 52
- else
- exit 1
- fi
- fi