This commit is contained in:
2024-10-14 00:08:40 +02:00
parent dbfba56f66
commit 1462d52e13
4572 changed files with 2658864 additions and 0 deletions

BIN
Linux PTP RRD/calc.ods Normal file

Binary file not shown.

110
Linux PTP RRD/config.txt Normal file
View File

@@ -0,0 +1,110 @@
rm database.rrd
rrdtool create read.rrd --step 30s \
DS:ds1:GAUGE:60:0:100 \
RRA:MIN:0:2960:2880 \
RRA:MIN:0:1480:2880 \
RRA:MIN:0:124:2880 \
RRA:MIN:0:8:2880 \
RRA:MIN:0:4:2880 \
RRA:MIN:0:1:2880 \
RRA:AVERAGE:0:2960:2880 \
RRA:AVERAGE:0:1480:2880 \
RRA:AVERAGE:0:124:2880 \
RRA:AVERAGE:0:8:2880 \
RRA:AVERAGE:0:4:2880 \
RRA:AVERAGE:0:1:2880 \
RRA:MAX:0:2960:2880 \
RRA:MAX:0:1480:2880 \
RRA:MAX:0:124:2880 \
RRA:MAX:0:8:2880 \
RRA:MAX:0:4:2880 \
RRA:MAX:0:1:2880
rrdtool fetch database.rrd MIN | tail
cd /mnt/syslog/scripts/rrd/
CWD=`pwd`
while [ "1" == "1" ]
do
R1=`tcpping -x 1 -c 10.101.0.230 23 | cut -d" " -f 3`
R2=`tcpping -x 1 -c 10.101.0.230 23 | cut -d" " -f 3`
rrdtool update $CWD/cs1.rrd N:$R1
echo $R1
rrdtool update $CWD/cs2.rrd N:$R2
echo $R2
echo ""
sleep 29
done
# Grafik Updaten
#!/bin/bash
cd /mnt/syslog/scripts/rrd/
CWD=`pwd`
ENDE=`date +%s`
START=`expr $ENDE - 3600`
rrdtool graph /var/www/cs1.png -Y --lower-limit 0 --upper-limit 30 --start $START --end $ENDE --width 800 --height 200 -c BACK#EEEEEE00 -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal --font LEGEND:8:'DroidSansMono,DejaVuSansMono' --font AXIS:7:'DroidSansMono,DejaVuSansMono' --font-render-mode normal \
DEF:ping=$CWD/cs1.rrd:ds1:AVERAGE \
LINE1:ping#0000FF:"time (ms)" \
GPRINT:ping:LAST:"Cur\: %5.2lf" \
GPRINT:ping:AVERAGE:"Avg\: %5.2lf" \
GPRINT:ping:MAX:"Max\: %5.2lf" \
GPRINT:ping:MIN:"Min\: %5.2lf\t\t\t" \
COMMENT:"CS1 <IP1> ping"
rrdtool graph /var/www/cs2.png -Y --lower-limit 0 --upper-limit 30 --start $START --end $ENDE --width 800 --height 200 -c BACK#EEEEEE00 -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal --font LEGEND:8:'DroidSansMono,DejaVuSansMono' --font AXIS:7:'DroidSansMono,DejaVuSansMono' --font-render-mode normal \
DEF:ping=$CWD/cs2.rrd:ds1:AVERAGE \
LINE1:ping#0000FF:"time (ms)" \
GPRINT:ping:LAST:"Cur\: %5.2lf" \
GPRINT:ping:AVERAGE:"Avg\: %5.2lf" \
GPRINT:ping:MAX:"Max\: %5.2lf" \
GPRINT:ping:MIN:"Min\: %5.2lf\t\t\t" \
COMMENT:"CS2 <IP2> ping"
################################################################################################################
################################################################################################################
################################################################################################################
cd /mnt/syslog/scripts/rrd/
CWD=`pwd`
while [ "1" == "1" ]
do
W1=`dd if=/dev/zero of=/mnt/syslog/iotest/testfile bs=100M count=1 oflag=dsync 2>&1 | grep kopiert | cut -d" " -f 8 | tr "," "."`
echo $W1
R1=`dd if=/mnt/syslog/iotest/testfile of=/dev/null bs=4k 2>&1 | grep kopiert | cut -d" " -f 8 | tr "," "."`
echo $R1
echo ""
rrdtool update $CWD/read.rrd N:$R1
rrdtool update $CWD/write.rrd N:$W1
sleep 29
done
ENDE=`date +%s`
START=`expr $ENDE - 3600`
cd /mnt/syslog/scripts/rrd/
CWD=`pwd`
rrdtool graph /var/www/rw.png -Y --lower-limit 0 --upper-limit 100 --start $START --end $ENDE --width 800 --height 200 -c BACK#EEEEEE00 -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal --font LEGEND:8:'DroidSansMono,DejaVuSansMono' --font AXIS:7:'DroidSansMono,DejaVuSansMono' --font-render-mode normal \
DEF:read=$CWD/read.rrd:ds1:AVERAGE \
DEF:write=$CWD/write.rrd:ds1:AVERAGE \
LINE1:read#0000FF:"MB/s" \
GPRINT:read:LAST:"Cur\: %5.2lf" \
GPRINT:read:AVERAGE:"Avg\: %5.2lf" \
GPRINT:read:MAX:"Max\: %5.2lf" \
GPRINT:read:MIN:"Min\: %5.2lf" \
COMMENT:"Read\n" \
LINE2:write#FF0000:"MB/s" \
GPRINT:write:LAST:"Cur\: %5.2lf" \
GPRINT:write:AVERAGE:"Avg\: %5.2lf" \
GPRINT:write:MAX:"Max\: %5.2lf" \
GPRINT:write:MIN:"Min\: %5.2lf" \
COMMENT:"Write\n"

128
Linux PTP RRD/ptp.txt Normal file
View File

@@ -0,0 +1,128 @@
#Offset from Master : 0.000008097 s
#One-way delay : 0.000126731 s
PAT=/scripts/root/ptp
mkdir -p $PAT/
rrdtool create $PAT/offset.rrd --step 300s \
DS:ds1:GAUGE:300:U:U \
RRA:MIN:0:2960:2880 \
RRA:MIN:0:1480:2880 \
RRA:MIN:0:124:2880 \
RRA:MIN:0:8:2880 \
RRA:MIN:0:4:2880 \
RRA:MIN:0:1:2880 \
RRA:AVERAGE:0:2960:2880 \
RRA:AVERAGE:0:1480:2880 \
RRA:AVERAGE:0:124:2880 \
RRA:AVERAGE:0:8:2880 \
RRA:AVERAGE:0:4:2880 \
RRA:AVERAGE:0:1:2880 \
RRA:MAX:0:2960:2880 \
RRA:MAX:0:1480:2880 \
RRA:MAX:0:124:2880 \
RRA:MAX:0:8:2880 \
RRA:MAX:0:4:2880 \
RRA:MAX:0:1:2880
rrdtool create $PAT/delay.rrd --step 300s \
DS:ds1:GAUGE:300:U:U \
RRA:MIN:0:2960:2880 \
RRA:MIN:0:1480:2880 \
RRA:MIN:0:124:2880 \
RRA:MIN:0:8:2880 \
RRA:MIN:0:4:2880 \
RRA:MIN:0:1:2880 \
RRA:AVERAGE:0:2960:2880 \
RRA:AVERAGE:0:1480:2880 \
RRA:AVERAGE:0:124:2880 \
RRA:AVERAGE:0:8:2880 \
RRA:AVERAGE:0:4:2880 \
RRA:AVERAGE:0:1:2880 \
RRA:MAX:0:2960:2880 \
RRA:MAX:0:1480:2880 \
RRA:MAX:0:124:2880 \
RRA:MAX:0:8:2880 \
RRA:MAX:0:4:2880 \
RRA:MAX:0:1:2880
#rrdtool fetch database.rrd MIN | tail
#!/bin/bash
PAT=/scripts/root/ptp
cd $PAT
CWD=`pwd`
V=`cat /var/log/ptpd/status | grep Offset | grep -oP "([0-9-.]*)"`
R=`echo "$V * 1000000" | bc`
echo "V: $V
R: $R"
rrdtool update $PAT/offset.rrd N:$R
V=`cat /var/log/ptpd/status | grep "One-way" | grep -oP "([0-9.]*)"`
R=`echo "$V * 1000" | bc`
echo "V: $V
R: $R"
rrdtool update $PAT/delay.rrd N:$R
# Grafik Updaten (1h)
#!/bin/bash
PAT=/scripts/root/ptp
cd $PAT
CWD=`pwd`
ENDE=`date +%s`
START=`expr $ENDE - 3600`
rrdtool graph $PAT/offset.png -Y --lower-limit -100 --upper-limit 100 --start $START --end $ENDE --width 800 --height 200 -c BACK#EEEEEE00 -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal --font LEGEND:8:'DroidSansMono,DejaVuSansMono' --font AXIS:7:'DroidSansMono,DejaVuSansMono' --font-render-mode normal \
DEF:ping=$PAT/offset.rrd:ds1:AVERAGE \
LINE1:ping#0000FF:"time (µs)" \
GPRINT:ping:LAST:"Cur\: %5.2lf" \
GPRINT:ping:AVERAGE:"Avg\: %5.2lf" \
GPRINT:ping:MAX:"Max\: %5.2lf" \
GPRINT:ping:MIN:"Min\: %5.2lf\t\t\t" \
COMMENT:"Offset"
rrdtool graph $PAT/delay.png -Y --lower-limit 0 --upper-limit 10 --start $START --end $ENDE --width 800 --height 200 -c BACK#EEEEEE00 -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal --font LEGEND:8:'DroidSansMono,DejaVuSansMono' --font AXIS:7:'DroidSansMono,DejaVuSansMono' --font-render-mode normal \
DEF:ping=$PAT/delay.rrd:ds1:AVERAGE \
LINE1:ping#0000FF:"time (ms)" \
GPRINT:ping:LAST:"Cur\: %5.2lf" \
GPRINT:ping:AVERAGE:"Avg\: %5.2lf" \
GPRINT:ping:MAX:"Max\: %5.2lf" \
GPRINT:ping:MIN:"Min\: %5.2lf\t\t\t" \
COMMENT:"Delay"
# Grafik Updaten (1d)
#!/bin/bash
PAT=/scripts/root/ptp
cd $PAT
CWD=`pwd`
ENDE=`date +%s`
START=`expr $ENDE - 86400`
rrdtool graph $PAT/offset_1d.png -Y --lower-limit -100 --upper-limit 100 --start $START --end $ENDE --width 800 --height 200 -c BACK#EEEEEE00 -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal --font LEGEND:8:'DroidSansMono,DejaVuSansMono' --font AXIS:7:'DroidSansMono,DejaVuSansMono' --font-render-mode normal \
DEF:ping=$PAT/offset.rrd:ds1:AVERAGE \
LINE1:ping#0000FF:"time (µs)" \
GPRINT:ping:LAST:"Cur\: %5.2lf" \
GPRINT:ping:AVERAGE:"Avg\: %5.2lf" \
GPRINT:ping:MAX:"Max\: %5.2lf" \
GPRINT:ping:MIN:"Min\: %5.2lf\t\t\t" \
COMMENT:"Offset"
rrdtool graph $PAT/delay_1d.png -Y --lower-limit 0 --upper-limit 10 --start $START --end $ENDE --width 800 --height 200 -c BACK#EEEEEE00 -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal --font LEGEND:8:'DroidSansMono,DejaVuSansMono' --font AXIS:7:'DroidSansMono,DejaVuSansMono' --font-render-mode normal \
DEF:ping=$PAT/delay.rrd:ds1:AVERAGE \
LINE1:ping#0000FF:"time (ms)" \
GPRINT:ping:LAST:"Cur\: %5.2lf" \
GPRINT:ping:AVERAGE:"Avg\: %5.2lf" \
GPRINT:ping:MAX:"Max\: %5.2lf" \
GPRINT:ping:MIN:"Min\: %5.2lf\t\t\t" \
COMMENT:"Delay"
Als Zeitfenster kann anstatt
--start $START --end $ENDE
auch angegeben werden wie weit der Graph in die Vergangenheit zurück reichen soll
--start [PARAM]
PARAM bspw.
-1y (letztes Jahr)
-4m (letzte 4 Monate)
-33min (letzte 33 Minuten)
-12h (letzten 12 Stunden)