ユーザ用ツール

サイト用ツール


ganglia:script-ip_conntrack
#! /bin/bash

declare -r GMETRIC=/usr/bin/gmetric

declare -r GMETRIC_TYPE="ip_conntrack"
declare -r IPCONNMAX5="/proc/sys/net/ipv4/ip_conntrack_max"
declare -r IPCONNMAX6="/proc/sys/net/netfilter/nf_conntrack_max"

declare -r IPCONN5="/proc/sys/net/ipv4/netfilter/ip_conntrack_count"
declare -r IPCONN6="/proc/sys/net/netfilter/nf_conntrack_count"

if [ -e ${IPCONNMAX5} ]; then
    IPCONNMAX=`cat ${IPCONNMAX5}`
    IPCONN=`cat ${IPCONN5}`
else
    IPCONNMAX=`cat ${IPCONNMAX6}`
    IPCONN=`cat ${IPCONN6}`
fi

IPCONNRATE=`echo "scale=5; $IPCONN/$IPCONNMAX*100" | bc`

#echo "ip_conntrack_max="${IPCONNMAX}
#echo "ip_conntrack="${IPCONN}
#echo "RATE="${IPCONNRATE}

$GMETRIC -g ${GMETRIC_TYPE} -n "ip_conntrack" -v ${IPCONN} -t float -u "cnt"
$GMETRIC -g ${GMETRIC_TYPE} -n "ip_conntrack_rate" -v ${IPCONNRATE} -t float -u "%"
ganglia/script-ip_conntrack.txt · 最終更新: 2013/05/22 06:00 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki