#------------------------------------------------------------------------------
# RRDtool3 - PlugIn Handler 'ping' 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_ping ()
{
local Timeline=$1
local HostList=$2
local LabelList=$3
#---------------------------
if [ -n "$HostList" ]
then
cat << __EOF__
"$RRDTOOL3_DIR_GRAPH_IMAGE/ping-$HostList-$Timeline.png"
--title "$_rrdtool3_graph_ping_header - $(GetDecodedTimeline $Timeline)"
--imginfo ''
--vertical-label "$_rrdtool3_graph_ping_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 host=
for host in `echo $HostList | tr '+' ' '`
do
local rrd_file=$RRDTOOL3_DIR_DATABASE/ping/ping-$host.rrd
if [ -f "$rrd_file" ]
then
local label=`echo $LabelList | cut -d'+' -f$index`
: ${label:=$host}
cat << __EOF__
DEF:ds$index=$rrd_file:ping: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_ping_unit"
GPRINT:ds${index}avg:"%6.2lf %S$_rrdtool3_graph_ping_unit"
GPRINT:ds${index}min:"%6.2lf %S$_rrdtool3_graph_ping_unit"
GPRINT:ds${index}last:"%6.2lf %S$_rrdtool3_graph_ping_unit"
LINE1:ds$index#$(GetLineColour $index PING):"$label\l"
__EOF__
index=`expr $index + 1`
fi
done
fi
}
CollectdConfig_ping ()
{
local hosts=$1
#------------------
local host_list=`echo $hosts | sed 's|^[^:]*:||;s|^|Host "|;s|+|"\n Host "|g;s|$|"|;\| ""$|d'`
cat << __EOF__
LoadPlugin ping
$host_list
${RRDTOOL3_PING_INTERVAL:+Interval $RRDTOOL3_PING_INTERVAL}
${RRDTOOL3_PING_TIMEOUT:+Timeout $RRDTOOL3_PING_TIMEOUT}
${RRDTOOL3_PING_TTL:+TTL $RRDTOOL3_PING_TTL}
${RRDTOOL3_PING_MAXMISSED:+MaxMissed $RRDTOOL3_PING_MAXMISSED}
${RRDTOOL3_PING_DEVICE:+Device \"$RRDTOOL3_PING_DEVICE\"}
${RRDTOOL3_PING_SOURCE:+SourceAddress \"$RRDTOOL3_PING_SOURCE\"}
__EOF__
}