Revision 1c3acb76
Added by Seth Mos about 17 years ago
etc/inc/pfsense-utils.inc | ||
---|---|---|
3114 | 3114 |
$numpings = 5; |
3115 | 3115 |
$monitorip = lookup_gateway_monitor_ip_by_name($config['interfaces'][$ifname]['gateway']); |
3116 | 3116 |
/* the ping test function. We call this on the last line */ |
3117 |
$rrdupdatesh .= "\n"; |
|
3118 |
$rrdupdatesh .= "# Quality collector for {$ifname}\n"; |
|
3117 | 3119 |
$rrdupdatesh .= "get_quality_stats_{$ifname} () {\n"; |
3118 | 3120 |
$rrdupdatesh .= " packetloss_{$ifname}=100\n"; |
3119 | 3121 |
$rrdupdatesh .= " roundtrip_{$ifname}=0\n"; |
3120 | 3122 |
$rrdupdatesh .= " local out_{$ifname}\n"; |
3121 |
$rrdupdatesh .= " out_{$ifname}=\`ping -c $numpings -q $monitorip\`\n";
|
|
3123 |
$rrdupdatesh .= " out_{$ifname}=`ping -c $numpings -q $monitorip`\n";
|
|
3122 | 3124 |
$rrdupdatesh .= " if [ $? -eq 0 ]; then\n"; |
3123 |
$rrdupdatesh .= " packetloss_{$ifname}=\`echo \$out_{$ifname} | cut -f18 -d' ' | cut -c -1\`\n";
|
|
3124 |
$rrdupdatesh .= " roundtrip_{$ifname}=\`echo \$out_{$ifname} | cut -f24 -d' ' | cut -f2 -d'/'\`\n";
|
|
3125 |
$rrdupdatesh .= " packetloss_{$ifname}=`echo \$out_{$ifname} | cut -f18 -d' ' | cut -c -1`\n";
|
|
3126 |
$rrdupdatesh .= " roundtrip_{$ifname}=`echo \$out_{$ifname} | cut -f24 -d' ' | cut -f2 -d'/'`\n";
|
|
3125 | 3127 |
$rrdupdatesh .= " fi\n"; |
3126 | 3128 |
$rrdupdatesh .= " $rrdtool update $rrddbpath$ifname$quality N:\$packetloss_{$ifname}:\$roundtrip_{$ifname}\n"; |
3127 | 3129 |
$rrdupdatesh .= "}\n\n"; |
Also available in: Unified diff
Remove escape slashes so our quality stats gathering works again.