1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Use UNIX line breaks

This commit is contained in:
Stig Sandbeck Mathisen 2014-10-04 21:45:45 +02:00
parent 977d987f35
commit abe9f3b6ee

View file

@ -1,60 +1,60 @@
#!/bin/sh #!/bin/sh
# #
# Copyright (c) 2009 Sven-Hendrik Haase # Copyright (c) 2009 Sven-Hendrik Haase
# Copyright (C) 2004 Jimmy Olsen # Copyright (C) 2004 Jimmy Olsen
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 dated June, # as published by the Free Software Foundation; version 2 dated June,
# 1991. # 1991.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
# #
# Plugin to monitor packet loss # Plugin to monitor packet loss
# #
# Please note that sometimes it can take quite long for the plugin to return # Please note that sometimes it can take quite long for the plugin to return
# a value on a network with lots of packet loss. # a value on a network with lots of packet loss.
# You therefore need to account for it by appending the following to your # You therefore need to account for it by appending the following to your
# plugin-conf.d/munin-node. Remember to restart munin-node afterwards. # plugin-conf.d/munin-node. Remember to restart munin-node afterwards.
# Append the next 3 lines to plugin-conf.d/munin-node: # Append the next 3 lines to plugin-conf.d/munin-node:
# [packetloss_*] # [packetloss_*]
# timeout 60 # timeout 60
# user root # user root
# #
# Parameters: # Parameters:
# #
# ping_args - Arguments to ping (default "-c 2") # ping_args - Arguments to ping (default "-c 2")
# ping_args2 - Arguments after the host name (required for Solaris) # ping_args2 - Arguments after the host name (required for Solaris)
# ping - Ping program to use # ping - Ping program to use
# host - Host to ping # host - Host to ping
# #
# Arguments for Solaris: # Arguments for Solaris:
# ping_args -s # ping_args -s
# ping_args2 56 2 # ping_args2 56 2
# #
#%# family=manual #%# family=manual
file_host=`basename $0 | sed 's/^packetloss_//g'` file_host=`basename $0 | sed 's/^packetloss_//g'`
host=${host:-${file_host:-www.google.com}} host=${host:-${file_host:-www.google.com}}
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo "graph_title Packet loss to $host (in %)" echo "graph_title Packet loss to $host (in %)"
echo 'graph_args --upper-limit 100 -l 0' echo 'graph_args --upper-limit 100 -l 0'
echo 'graph_vlabel %' echo 'graph_vlabel %'
echo 'graph_category network' echo 'graph_category network'
echo 'graph_info This graph shows packet loss statistics.' echo 'graph_info This graph shows packet loss statistics.'
echo "packetloss.label $host" echo "packetloss.label $host"
echo "packetloss.info Packet loss statistics for $host." echo "packetloss.info Packet loss statistics for $host."
echo 'packetloss.draw LINE2' echo 'packetloss.draw LINE2'
exit 0 exit 0
fi fi
${ping:-ping} ${ping_args:-'-c 10'} ${host} ${ping_args2} | perl -n -e 'print "packetloss.value $1\n" if /(\d+)% packet loss/;' ${ping:-ping} ${ping_args:-'-c 10'} ${host} ${ping_args2} | perl -n -e 'print "packetloss.value $1\n" if /(\d+)% packet loss/;'