#------------------------------------------------------------------------------ # RRDtool3 - PlugIn Handler 'disk' 3.5.0 # # Creation: 2010-08-29 Tiger # Last Update: $Id: rc240.rrdtool3$ # # Copyright (c) 2010 Fli4L Team # # This OPT package is licensed under Free Software Foundation, Inc., # General Public License Version 2, June 1991 #------------------------------------------------------------------------------ GetGraphParams_disk () { local Timeline=$1 local DiskList=$2 local LabelList=$3 #--------------------------- : ${DiskList:=`ls -1d $RRDTOOL3_DIR_DATABASE/disk-* | sed 's|^'$RRDTOOL3_DIR_DATABASE'/disk-||' | tr '\n' '+'`} if [ -n "$DiskList" ] then cat << __EOF__ "$RRDTOOL3_DIR_GRAPH_IMAGE/disk-$DiskList-$Timeline.png" --title "$_rrdtool3_graph_disk_header - $(GetDecodedTimeline $Timeline)" --imginfo '$_rrdtool3_graph_disk_header/$DiskList/$TimeLine' --vertical-label "$_rrdtool3_graph_disk_y_axis" COMMENT:"$_rrdtool3_graph_label_maximum" COMMENT:"$_rrdtool3_graph_label_average" COMMENT:"$_rrdtool3_graph_label_minimum" COMMENT:"$_rrdtool3_graph_label_last\l" __EOF__ local index=1 local disk= for disk in `echo $DiskList | tr '+' ' '` do local rrd_file=$RRDTOOL3_DIR_DATABASE/disk-$disk/disk_octets.rrd if [ -f "$rrd_file" ] then local label=`echo $LabelList | cut -d'+' -f$index` : ${label:=$disk} local direction= for direction in write read do eval local this_label='"$label - $_rrdtool3_graph_disk_'$direction'"' cat << __EOF__ DEF:ds${index}=$rrd_file:$direction:AVERAGE VDEF:ds${index}max=ds${index},MAXIMUM VDEF:ds${index}avg=ds${index},AVERAGE VDEF:ds${index}min=ds${index},MINIMUM VDEF:ds${index}last=ds${index},LAST GPRINT:ds${index}max:"%6.2lf %S$_rrdtool3_graph_disk_unit" GPRINT:ds${index}avg:"%6.2lf %S$_rrdtool3_graph_disk_unit" GPRINT:ds${index}min:"%6.2lf %S$_rrdtool3_graph_disk_unit" GPRINT:ds${index}last:"%6.2lf %S$_rrdtool3_graph_disk_unit" LINE1:ds${index}#$(GetLineColour $index DISK):"$this_label\l" __EOF__ index=`expr $index + 1` done fi done fi } CollectdConfig_disk () { local disks=$1 #------------------ local disk_list=`echo $disks | sed 's|^[^:]*:||;s|^|Disk "|;s|+|"\n Disk "|g;s|$|"|;\| ""$|d'` cat << __EOF__ LoadPlugin disk $disk_list ${RRDTOOL3_DISK_IGNORESELECTED:+IgnoreSelected $RRDTOOL3_DISK_IGNORESELECTED} __EOF__ }