jablonka.czprosek.czf

crusader

Subversion Repositories:
[/] [trunk/] [statistiky/] [opt/] [statistiky/] [makeobr_system_conntrack.sh] - Rev 2 Go to most recent revision

Compare with Previous - Blame - Download


#!/bin/bash

name=conntrack
timediff=$1
suffix=$2
popis=$3
width=$4

PATH=$PATH:/opt/rrdtool/bin

datadir=/var/statistiky/system
target_img_dir="/var/www/heaven/stat/img"

cd $datadir

xgridstr=""

if [ $timediff -ge 604800 ]
then
    xgridstr="--x-grid HOUR:12:DAY:1:DAY:1:86400:%d.%m."
fi
if [ $timediff -ge 2678400 ]
then
    xgridstr="--x-grid DAY:1:DAY:7:DAY:2:86400:%d.%m."
fi

now=`date +%s`

    rrdtool graph ${target_img_dir}/${name}_tcp_established_${suffix}.png --imgformat PNG --start `expr $now - ${timediff}` --end $now \
        DEF:tcp_est_avg=${name}.rrd:tcp_established:AVERAGE \
        DEF:tcp_est_min=${name}.rrd:tcp_established:MIN \
        DEF:tcp_est_max=${name}.rrd:tcp_established:MAX \
        DEF:syn_sent=${name}.rrd:tcp_syn_sent:MAX \
        DEF:syn_recv=${name}.rrd:tcp_syn_recv:MAX \
        DEF:close=${name}.rrd:tcp_close:MAX \
        DEF:close_wait=${name}.rrd:tcp_close_wait:MAX \
        DEF:fin_wait=${name}.rrd:tcp_fin_wait:MAX \
        DEF:time_wait=${name}.rrd:tcp_time_wait:MAX \
        DEF:udp_max=${name}.rrd:udp:MAX \
        DEF:ip_conntrack_max=${name}.rrd:ip_conntrack_max:MAX \
        CDEF:tcp_all_max=tcp_est_max,syn_sent,syn_recv,close,close_wait,fin_wait,time_wait,+,+,+,+,+,+ \
        CDEF:all_max=udp_max,tcp_all_max,+ \
        LINE2:ip_conntrack_max#e71b1e:"ip_conntrack_max" \
        LINE1:all_max#0000FF:"TCP+UDP (max)" \
        LINE2:tcp_est_avg#00ff00:"established (avg)" \
        LINE1:tcp_est_max#202020:"established (max)" \
        --vertical-label "TCP conntrack" \
        --height 200 \
        --width  ${width} \
        ${xgridstr} \
        --title "Established ${name} ${popis}"


    rrdtool graph ${target_img_dir}/${name}_tcp_other_${suffix}.png --imgformat PNG --start `expr $now - ${timediff}` --end $now \
        DEF:syn_sent=${name}.rrd:tcp_syn_sent:AVERAGE \
        DEF:syn_recv=${name}.rrd:tcp_syn_recv:AVERAGE \
        DEF:close=${name}.rrd:tcp_close:AVERAGE \
        DEF:close_wait=${name}.rrd:tcp_close_wait:AVERAGE \
        DEF:fin_wait=${name}.rrd:tcp_fin_wait:AVERAGE \
        DEF:time_wait=${name}.rrd:tcp_time_wait:AVERAGE \
        DEF:udp=${name}.rrd:udp:AVERAGE \
        AREA:udp#d0d0d0:"UDP" \
        STACK:syn_sent#ff7d7e:"SYN_SENT" \
        STACK:syn_recv#e71b1e:"SYN_RECV" \
        STACK:fin_wait#00ab22:"FIN_WAIT" \
        STACK:close_wait#8598dc:"CLOSE_WAIT" \
        STACK:close#252edc:"CLOSE" \
        STACK:time_wait#909090:"TIME_WAIT" \
        --vertical-label "conntrack" \
        --height 200 \
        --width  ${width} \
        ${xgridstr} \
        --title "Other than established ${name} ${popis}"

Powered by WebSVN 2.2.1