watpie, ale moge Ci pomoc.
tworzenie bazy
rrdtool create $RRDTOOL_SCIEZKA/bazy/pingi.rrd \
--step 30 \
DS:host1:GAUGE:600:0:U \
DS:host2:GAUGE:600:0:U \
RRA:AVERAGE:0.5:2:1400 \
RRA:AVERAGE:0.5:10:1008 \
RRA:AVERAGE:0.5:6:744 \
RRA:AVERAGE:0.5:12:744 \
RRA:AVERAGE:0.5:180:372 \
RRA:AVERAGE:0.5:360:744
skrypt zczytujący
#!/bin/bash
HOST_1=www.wp.pl
HOST_2=www.onet.pl
. /etc/rrdtool.conf
host1=`ping -c 5 $HOST_1 | grep "packet loss" | cut -d "," -f 4 | cut -d "%" -f 1 | tr -d " "
`
host2=`ping -c 5 $HOST_2 | grep "packet loss" | cut -d "," -f 4 | cut -d "%" -f 1 | tr -d " "`
rrdtool update $RRDTOOL_SCIEZKA/bazy/pingi.rrd \
--template \
host1:host2 \
N:$host1:$host2 \
Uwazaj na cut -d "," -f 4. Sprawdz czy u siebie po daniu pinga na jakis nieistniejący IP dostajesz "+x errors" jeśli tak to zostaw jak jest, jeśli nie to daj -f 3.
CGI:
#wykres ping
rrdtool graph $WYKRESY_SCIEZKA/pingi1.png \
--height=600 \
--width=800 \
--end now --start "end-1d" \
--title "Pingi utracone" \
--interlaced \
--upper-limit 100 --lower-limit 0 --rigid \
DEF:host1=$RRDTOOL_SCIEZKA/bazy/pingi.rrd:host1:AVERAGE \
DEF:host2=$RRDTOOL_SCIEZKA/bazy/pingi.rrd:host2:AVERAGE \
LINE1:host1$KOLOR_1:$HOST_1 \
VDEF:host1_avg=host1,AVERAGE \
VDEF:host1_min=host1,MINIMUM \
VDEF:host1_max=host1,MAXIMUM \
GPRINT:host1_min:"\tMIN\\: %2.1lfms" \
GPRINT:host1_avg:"AVG\\: %2.1lfms" \
GPRINT:host1_max:"MAX\\: %2.1lfms" \
GPRINT:host1:LAST:"AKT\\: %2.1lf\n" \
LINE1:host2$KOLOR_2:$HOST_2 \
VDEF:host2_avg=host2,AVERAGE \
VDEF:host2_min=host2,MINIMUM \
VDEF:host2_max=host2,MAXIMUM \
GPRINT:host2_min:"\tMIN\\: %2.1lfms" \
GPRINT:host2_avg:"AVG\\: %2.1lfms" \
GPRINT:host2_max:"MAX\\: %2.1lfms" \
GPRINT:host2:LAST:"AKT\\: %2.1lf\n" > /dev/null
Nie zapomnij o podmienieniu zmiennyc $RRDTOOL_SCIEZKA i $WYKRESY_SCIEZKA na odpowiednie katalogi, oraz $KOLOR_1, $KOLOR_2 na odpowie4dnie kolory html np "#0000FF" dla niebieskiego.