#------------------------------------------------------------------------------ # RRDtool3 - PlugIn Handler 'cpu' 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_cpu () { local Timeline=$1 local StateList=$2 local LabelList=$3 #--------------------------- : ${StateList:=nice+user+wait+system+softirq+interrupt+steal} cat << __EOF__ "$RRDTOOL3_DIR_GRAPH_IMAGE/cpu-$StateList-$Timeline.png" --title "$_rrdtool3_graph_cpu_header - $(GetDecodedTimeline $Timeline)" --imginfo '$_rrdtool3_graph_cpu_header/$StateList/$TimeLine' --vertical-label "$_rrdtool3_graph_cpu_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 state= local cpu_index=0 for state in `echo $StateList | tr '+' ' '` do local rrd_file=$RRDTOOL3_DIR_DATABASE/cpu-$cpu_index/cpu-$state.rrd if [ -f "$rrd_file" ] then local label=`echo $LabelList | cut -d'+' -f$index` : ${label:=$state} cat << __EOF__ DEF:ds${index}=$rrd_file:value: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_cpu_unit" GPRINT:ds${index}avg:"%6.2lf %S$_rrdtool3_graph_cpu_unit" GPRINT:ds${index}min:"%6.2lf %S$_rrdtool3_graph_cpu_unit" GPRINT:ds${index}last:"%6.2lf %S$_rrdtool3_graph_cpu_unit" LINE1:ds${index}#$(GetLineColour $index CPU):"$label\l" __EOF__ index=`expr $index + 1` fi done } CollectdConfig_cpu () { #------------------ cat << __EOF__ LoadPlugin cpu __EOF__ }