Révision ac045a57
Initial version
| plugins/other/packetloss | ||
|---|---|---|
| 1 |
#!/bin/sh |
|
| 2 |
# |
|
| 3 |
# Copyright (c) 2009 Sven-Hendrik Haase |
|
| 4 |
# Copyright (C) 2004 Jimmy Olsen |
|
| 5 |
# |
|
| 6 |
# This program is free software; you can redistribute it and/or |
|
| 7 |
# modify it under the terms of the GNU General Public License |
|
| 8 |
# as published by the Free Software Foundation; version 2 dated June, |
|
| 9 |
# 1991. |
|
| 10 |
# |
|
| 11 |
# This program is distributed in the hope that it will be useful, |
|
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 14 |
# GNU General Public License for more details. |
|
| 15 |
# |
|
| 16 |
# You should have received a copy of the GNU General Public License |
|
| 17 |
# along with this program; if not, write to the Free Software |
|
| 18 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
| 19 |
# |
|
| 20 |
# |
|
| 21 |
# Plugin to monitor packet loss |
|
| 22 |
# |
|
| 23 |
# Please note that sometimes it can take quite long for the plugin to return |
|
| 24 |
# a value on a network with lots of packet loss. |
|
| 25 |
# You therefore need to account for it by appending the following to your |
|
| 26 |
# plugin-conf.d/munin-node. Remember to restart munin-node afterwards. |
|
| 27 |
# Append the next 3 lines to plugin-conf.d/munin-node: |
|
| 28 |
# [packetloss_*] |
|
| 29 |
# timeout 60 |
|
| 30 |
# user root |
|
| 31 |
# |
|
| 32 |
# Parameters: |
|
| 33 |
# |
|
| 34 |
# ping_args - Arguments to ping (default "-c 2") |
|
| 35 |
# ping_args2 - Arguments after the host name (required for Solaris) |
|
| 36 |
# ping - Ping program to use |
|
| 37 |
# host - Host to ping |
|
| 38 |
# |
|
| 39 |
# Arguments for Solaris: |
|
| 40 |
# ping_args -s |
|
| 41 |
# ping_args2 56 2 |
|
| 42 |
# |
|
| 43 |
#%# family=manual |
|
| 44 |
|
|
| 45 |
file_host=`basename $0 | sed 's/^packetloss_//g'` |
|
| 46 |
host=${host:-${file_host:-www.google.com}}
|
|
| 47 |
|
|
| 48 |
if [ "$1" = "config" ]; then |
|
| 49 |
echo "graph_title Packet loss to $host (in %)" |
|
| 50 |
echo 'graph_args --upper-limit 100 -l 0' |
|
| 51 |
echo 'graph_vlabel %' |
|
| 52 |
echo 'graph_category network' |
|
| 53 |
echo 'graph_info This graph shows packet loss statistics.' |
|
| 54 |
echo "packetloss.label $host" |
|
| 55 |
echo "packetloss.info Packet loss statistics for $host." |
|
| 56 |
echo 'packetloss.draw LINE2' |
|
| 57 |
exit 0 |
|
| 58 |
fi |
|
| 59 |
|
|
| 60 |
${ping:-ping} ${ping_args:-'-c 10'} ${host} ${ping_args2} | perl -n -e 'print "packetloss.value $1\n" if /(\d+)% packet loss/;'
|
|
Formats disponibles : Unified diff