Path : /proc/2/root/var/lib/zabbix/ |
Current File : //proc/2/root/var/lib/zabbix/ipvscheck.sh |
#!/bin/bash RULE=$1 RIP=$2 RESULT=0 SVC_FLG=0 IFS=$'\n' for LINE in $(sudo /sbin/ipvsadm -Ln |sed -n '4,$p' |awk '{print $1" "$2" "$3}') do TYPE=`echo ${LINE} | awk '{print $1}'` IP=`echo ${LINE} | awk '{print $2}'` if [ "${TYPE}" = "->" -a ${SVC_FLG} = 1 ] ; then if [ "${IP}" = "${RIP}" ] ; then RESULT="1" fi else SVC_FLG=0 if [ "${LINE}" = "$RULE" ] ; then SVC_FLG=1 fi fi done echo "$RESULT"