From 4e0c60d125777a34e614aebc7ad4cbeff1828dd8 Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Wed, 6 Apr 2016 13:10:22 +0430 Subject: [PATCH 01/14] update copyright message --- LICENSE | 2 +- intr_ | 2 +- ip_ | 2 +- multiping_ | 2 +- netirq_ | 2 +- netisr_ | 2 +- netmem_ | 2 +- pf_ | 2 +- udp_ | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/LICENSE b/LICENSE index 2d1052b..53024e6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015, Babak Farrokhi +Copyright (c) 2016, Babak Farrokhi All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/intr_ b/intr_ index 6df0588..fac22ce 100755 --- a/intr_ +++ b/intr_ @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2015 Babak Farrokhi. All rights reserved. +# Copyright (c) 2016 Babak Farrokhi. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/ip_ b/ip_ index dadaa4f..fd164d8 100755 --- a/ip_ +++ b/ip_ @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2015 Babak Farrokhi. All rights reserved. +# Copyright (c) 2016 Babak Farrokhi. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/multiping_ b/multiping_ index eb952ff..edb9adc 100755 --- a/multiping_ +++ b/multiping_ @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2015 Babak Farrokhi. All rights reserved. +# Copyright (c) 2016 Babak Farrokhi. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/netirq_ b/netirq_ index 2ea9f63..c95e1c3 100755 --- a/netirq_ +++ b/netirq_ @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2015 Babak Farrokhi. All rights reserved. +# Copyright (c) 2016 Babak Farrokhi. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/netisr_ b/netisr_ index 15ed699..5b4779d 100755 --- a/netisr_ +++ b/netisr_ @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2015 Babak Farrokhi. All rights reserved. +# Copyright (c) 2016 Babak Farrokhi. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/netmem_ b/netmem_ index 1badbfe..7e8aad9 100755 --- a/netmem_ +++ b/netmem_ @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2015 Babak Farrokhi. All rights reserved. +# Copyright (c) 2016 Babak Farrokhi. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/pf_ b/pf_ index 591d00b..e1f00b3 100755 --- a/pf_ +++ b/pf_ @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2015 Babak Farrokhi. All rights reserved. +# Copyright (c) 2016 Babak Farrokhi. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/udp_ b/udp_ index e5f54aa..a47fc2f 100755 --- a/udp_ +++ b/udp_ @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2015 Babak Farrokhi. All rights reserved. +# Copyright (c) 2016 Babak Farrokhi. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions From 785dbdd68022869d8aeccbfa0d451ce164ea9466 Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Wed, 11 May 2016 13:34:13 +0430 Subject: [PATCH 02/14] fix conditions checking --- multiping_ | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/multiping_ b/multiping_ index edb9adc..f08706f 100755 --- a/multiping_ +++ b/multiping_ @@ -1,5 +1,5 @@ -#!/bin/sh -# +#!/bin/sh +# # Copyright (c) 2016 Babak Farrokhi. All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -8,6 +8,17 @@ # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. +root@CGN:~/freebsd-munin-plugins # cat ip_ | head -30 +#!/bin/sh +# +# Copyright (c) 2016 Babak Farrokhi. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. @@ -48,7 +59,7 @@ IPS=`ifconfig ${interface} | awk '/inet /{print $2}' | grep -Ev '^(10|192)\.'` if [ $# -lt 1 ]; then - if [ x${SRC} == x ]; then + if [ "x${SRC}" == "x" ]; then echo "should run from symlink" exit 1 fi @@ -82,14 +93,14 @@ elif [ "$1" == "suggest" ]; then elif [ "$1" == "autoconf" ]; then - if [ x${hosts} == x ]; then + if [ "x${hosts}" == "x" ]; then echo "no (env.hosts is not defined)" - exit 0 + exit 1 fi - if [ x${interface} == x ]; then + if [ "x${interface}" == "x" ]; then echo "no (env.interface is not defined)" - exit 0 + exit 1 fi ### check env vars and return no if not set properly @@ -98,7 +109,7 @@ elif [ "$1" == "autoconf" ]; then elif [ "$1" == "config" ]; then - if [ x${SRC} == x ]; then + if [ "x${SRC}" == "x" ]; then exit 1 fi From c1f246bad88466e5f559b4a846c539129b47be5a Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Wed, 11 May 2016 13:49:57 +0430 Subject: [PATCH 03/14] fix garbage in previous commit --- multiping_ | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/multiping_ b/multiping_ index f08706f..f1bb698 100755 --- a/multiping_ +++ b/multiping_ @@ -1,15 +1,4 @@ -#!/bin/sh -# -# Copyright (c) 2016 Babak Farrokhi. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -root@CGN:~/freebsd-munin-plugins # cat ip_ | head -30 -#!/bin/sh +#!/bin/sh # # Copyright (c) 2016 Babak Farrokhi. All rights reserved. # From 5ee398302fdd06327308696c170dfedc5bea4f7f Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Wed, 11 May 2016 14:16:48 +0430 Subject: [PATCH 04/14] use fping instead of ping to reduce processing time --- multiping_ | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/multiping_ b/multiping_ index f1bb698..ab58351 100755 --- a/multiping_ +++ b/multiping_ @@ -42,7 +42,7 @@ SCRIPT_NAME=$(basename $0) SRC=`echo $SCRIPT_NAME | sed -n s/multiping_//p` -PING=`which ping` || exit 1 +FPING=`which fping` || exit 1 FSRC=`echo ${SRC} | sed 's/\./_/g'` IPS=`ifconfig ${interface} | awk '/inet /{print $2}' | grep -Ev '^(10|192)\.'` @@ -55,19 +55,15 @@ if [ $# -lt 1 ]; then TMPFILE=`mktemp -t multiping` - for DST in `echo ${hosts} | tr , " "`; do - fname=`echo ${DST} | sed 's/\./_/g'` - ping -q -W1 -i0.1 -c10 -S ${SRC} ${DST} | sed 's/\// /g' | awk ' -/^round-trip/ { - print "rtt_'${fname}'.value " $7; -} -/ packet loss/ { - loss=$7; - gsub(/\%/, "", loss); - print "loss_'${fname}'.value " loss; + DST=`echo ${hosts} | tr , " "` + fname=`echo ${DST} | sed 's/\./_/g'` + ${FPING} -A -q -s -i10 -c50 -p 25 -S ${SRC} -t1000 ${DST} 2>&1 | grep ':' | tr '%/,' ' ' | awk ' +/xmt/ { + printf "rtt_%s.value %0.0f\n", $1, $15; + printf "loss_%s.value %0.0f\n", $1, $9; } ' >> ${TMPFILE} - done + echo "multigraph rtt_${FSRC}" grep ^rtt ${TMPFILE} From 6a95742ee93f70fc2eeb0f10bbb29b6d919ee68f Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Fri, 13 May 2016 18:53:07 +0430 Subject: [PATCH 05/14] fix an substring replacement --- multiping_ | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/multiping_ b/multiping_ index ab58351..e56d6c6 100755 --- a/multiping_ +++ b/multiping_ @@ -59,8 +59,10 @@ if [ $# -lt 1 ]; then fname=`echo ${DST} | sed 's/\./_/g'` ${FPING} -A -q -s -i10 -c50 -p 25 -S ${SRC} -t1000 ${DST} 2>&1 | grep ':' | tr '%/,' ' ' | awk ' /xmt/ { - printf "rtt_%s.value %0.0f\n", $1, $15; - printf "loss_%s.value %0.0f\n", $1, $9; + name = $1; + gsub(/\./, "_", name); + printf "rtt_%s.value %0.0f\n", name, $15; + printf "loss_%s.value %0.0f\n", name, $9; } ' >> ${TMPFILE} From 776df521e71be46660d8e5148188c6ad5b121313 Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Sat, 6 Aug 2016 12:11:04 +0430 Subject: [PATCH 06/14] Improve error message --- multiping_ | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multiping_ b/multiping_ index e56d6c6..4e6aaf6 100755 --- a/multiping_ +++ b/multiping_ @@ -42,7 +42,7 @@ SCRIPT_NAME=$(basename $0) SRC=`echo $SCRIPT_NAME | sed -n s/multiping_//p` -FPING=`which fping` || exit 1 +FPING=`which fping` || ( echo "fping required but not found"; exit 1) FSRC=`echo ${SRC} | sed 's/\./_/g'` IPS=`ifconfig ${interface} | awk '/inet /{print $2}' | grep -Ev '^(10|192)\.'` From 0a841546d9d96e49be516e82fbb71174ac92426f Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Sat, 6 Aug 2016 12:14:38 +0430 Subject: [PATCH 07/14] Improve condition checks --- multiping_ | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/multiping_ b/multiping_ index 4e6aaf6..f62ef32 100755 --- a/multiping_ +++ b/multiping_ @@ -48,7 +48,7 @@ IPS=`ifconfig ${interface} | awk '/inet /{print $2}' | grep -Ev '^(10|192)\.'` if [ $# -lt 1 ]; then - if [ "x${SRC}" == "x" ]; then + if [ -z ${SRC} ]; then echo "should run from symlink" exit 1 fi @@ -80,12 +80,12 @@ elif [ "$1" == "suggest" ]; then elif [ "$1" == "autoconf" ]; then - if [ "x${hosts}" == "x" ]; then + if [ -z ${hosts} ]; then echo "no (env.hosts is not defined)" exit 1 fi - if [ "x${interface}" == "x" ]; then + if [ -z ${interface} ]; then echo "no (env.interface is not defined)" exit 1 fi @@ -96,7 +96,7 @@ elif [ "$1" == "autoconf" ]; then elif [ "$1" == "config" ]; then - if [ "x${SRC}" == "x" ]; then + if [ -z ${SRC} ]; then exit 1 fi From afb62ead1b66b922854dae97f388373c4cc1e899 Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Wed, 8 Feb 2017 12:30:20 +0330 Subject: [PATCH 08/14] Import updates from NetOS --- multiping_ | 2 +- netirq_ | 3 ++- netisr_ | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/multiping_ b/multiping_ index f62ef32..d2072c1 100755 --- a/multiping_ +++ b/multiping_ @@ -44,7 +44,7 @@ SCRIPT_NAME=$(basename $0) SRC=`echo $SCRIPT_NAME | sed -n s/multiping_//p` FPING=`which fping` || ( echo "fping required but not found"; exit 1) FSRC=`echo ${SRC} | sed 's/\./_/g'` -IPS=`ifconfig ${interface} | awk '/inet /{print $2}' | grep -Ev '^(10|192)\.'` +IPS=`ifconfig ${interface} | grep -v tunnel | awk '/inet /{print $2}' | grep -Ev '^(10|192|127)\.'` if [ $# -lt 1 ]; then diff --git a/netirq_ b/netirq_ index c95e1c3..7bdd910 100755 --- a/netirq_ +++ b/netirq_ @@ -88,7 +88,8 @@ BEGIN { /'${STAT_TYPE}'/ { split($1,name,":"); - print name[1]".label "$1; + gsub(/ /,"", $1); + print name[1]".label " $1; print name[1]".type DERIVE"; print name[1]".min 0"; print name[1]".draw LINE2"; diff --git a/netisr_ b/netisr_ index 5b4779d..0b60fbd 100755 --- a/netisr_ +++ b/netisr_ @@ -58,7 +58,7 @@ if [ $# -lt 1 ]; then elif [ "$1" == "suggest" ]; then - awk '/---/{print $1}' ${STATFILE} + awk '/--$/{print $1}' ${STATFILE} elif [ "$1" == "autoconf" ]; then ${NETSTAT} -Q >/dev/null 2>&1 && echo yes || echo no From 1f11daadbb0d1210ca689565087b797dc85056a3 Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Wed, 8 Mar 2017 15:15:33 +0330 Subject: [PATCH 09/14] add "ipinput" plugin to monitor buffer overrun on IP Input queue --- ipinput | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 ipinput diff --git a/ipinput b/ipinput new file mode 100755 index 0000000..d60a3e9 --- /dev/null +++ b/ipinput @@ -0,0 +1,65 @@ +#!/bin/sh +# +# Copyright (c) 2015 Babak Farrokhi. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# +# March-2017 @farrokhi +# This plugin extracts "ip input" buffer overruns using sysctl and feeds +# to munin (or any other compatible agent) for graphing +# +# Buffer overrung on IP Input happens when CPU is not fast enough +# to pick ip packet from queue. This can be observed by seeing a +# CPU hogging "task queue" process in top. +# +# Magic markers: +#%# family=auto +#%# capabilities=autoconf + + +SCRIPT_NAME=$(basename $0) + +if [ $# -lt 1 ]; then + + DROPS=`sysctl -n net.inet.ip.intr_queue_drops` + echo ip_idrops.value ${DROPS} + + +elif [ "$1" == "autoconf" ]; then + echo yes + exit 0 + +elif [ "$1" == "config" ]; then + + echo "graph_title IP Input Drops" + echo "graph_args --lower-limit 0 --base 1000" + echo "graph_vlabel packets / second" + echo "graph_category system" + + echo ip_idrops.label "Input Drops" + echo ip_idrops.type DERIVE + echo ip_idrops.min 0 + +fi + From 3a46a7dd9d9131281ffe650ce1e2e1270ce9fa92 Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Tue, 16 May 2017 17:01:40 +0430 Subject: [PATCH 10/14] Add support for multiple interfaces --- multiping_ | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/multiping_ b/multiping_ index d2072c1..439cb5d 100755 --- a/multiping_ +++ b/multiping_ @@ -44,7 +44,12 @@ SCRIPT_NAME=$(basename $0) SRC=`echo $SCRIPT_NAME | sed -n s/multiping_//p` FPING=`which fping` || ( echo "fping required but not found"; exit 1) FSRC=`echo ${SRC} | sed 's/\./_/g'` -IPS=`ifconfig ${interface} | grep -v tunnel | awk '/inet /{print $2}' | grep -Ev '^(10|192|127)\.'` + +IPS="" +for int in ${interface}; do + IPTEMP=`ifconfig ${int} | grep -v tunnel | awk '/inet /{print $2}' | grep -Ev '^(10|192|127)\.'` + IPS="${IPS} ${IPTEMP}" +done if [ $# -lt 1 ]; then From 55b320fe365e17b74d6200e9a505277d489a1f97 Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Tue, 16 May 2017 18:53:16 +0430 Subject: [PATCH 11/14] Add support for multiple fibs --- multiping_ | 52 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/multiping_ b/multiping_ index 439cb5d..13f1979 100755 --- a/multiping_ +++ b/multiping_ @@ -32,37 +32,46 @@ # Configuration sample: # [multiping_*] # user root -# env.interface igb0 +# env.interface igb0:1 igb1:2 # env.hosts "4.2.2.4, ripe.net, 192.168.0.5, 8.8.4.4" # +# +# with env.interface variable, every interface should be suffixed with +# its fib number. In a normal environment, fib should always be 0. If +# you are using multiple routing tables you should use correct fib +# number (e.g. igb1 on fib 4 will be igb1:4). +# +# # Magic markers: #%# family=auto #%# capabilities=autoconf suggest SCRIPT_NAME=$(basename $0) -SRC=`echo $SCRIPT_NAME | sed -n s/multiping_//p` +SRC=`echo $SCRIPT_NAME | sed -n s/multiping_//p | cut -f1 -d_` +FIB=`echo $SCRIPT_NAME | sed -n s/multiping_//p | cut -f2 -d_` FPING=`which fping` || ( echo "fping required but not found"; exit 1) FSRC=`echo ${SRC} | sed 's/\./_/g'` - -IPS="" -for int in ${interface}; do - IPTEMP=`ifconfig ${int} | grep -v tunnel | awk '/inet /{print $2}' | grep -Ev '^(10|192|127)\.'` - IPS="${IPS} ${IPTEMP}" -done +SETFIB="/usr/sbin/setfib ${FIB}" if [ $# -lt 1 ]; then - if [ -z ${SRC} ]; then + if [ -z "${SRC}" ]; then echo "should run from symlink" exit 1 fi + if [ -z "${hosts}" ]; then + echo "Unknown destination address" + exit 1 + fi + TMPFILE=`mktemp -t multiping` DST=`echo ${hosts} | tr , " "` fname=`echo ${DST} | sed 's/\./_/g'` - ${FPING} -A -q -s -i10 -c50 -p 25 -S ${SRC} -t1000 ${DST} 2>&1 | grep ':' | tr '%/,' ' ' | awk ' + + ${SETFIB} ${FPING} -A -q -s -i10 -c50 -p 25 -S ${SRC} -t1000 ${DST} 2>&1 | grep ':' | tr '%/,' ' ' | awk ' /xmt/ { name = $1; gsub(/\./, "_", name); @@ -71,7 +80,6 @@ if [ $# -lt 1 ]; then } ' >> ${TMPFILE} - echo "multigraph rtt_${FSRC}" grep ^rtt ${TMPFILE} echo "multigraph loss_${FSRC}" @@ -79,18 +87,26 @@ if [ $# -lt 1 ]; then rm ${TMPFILE} elif [ "$1" == "suggest" ]; then - for DST in ${IPS}; do - echo ${DST} + + # interface name format is igb0:2 - number after colon is fib number + for int in ${interface}; do + FIB=`echo ${int} | cut -f2 -d:` + NAME=`echo ${int} | cut -f1 -d:` + IPS=`ifconfig ${NAME} | grep -v tunnel | awk '/inet /{print $2}' | grep -Ev '^(10|192|127)\.'` + for DST in ${IPS}; do + echo ${DST}_${FIB} + done done + elif [ "$1" == "autoconf" ]; then - if [ -z ${hosts} ]; then + if [ -z "${hosts}" ]; then echo "no (env.hosts is not defined)" exit 1 fi - if [ -z ${interface} ]; then + if [ -z "${interface}" ]; then echo "no (env.interface is not defined)" exit 1 fi @@ -101,7 +117,7 @@ elif [ "$1" == "autoconf" ]; then elif [ "$1" == "config" ]; then - if [ -z ${SRC} ]; then + if [ -z "${SRC}" ]; then exit 1 fi @@ -110,7 +126,7 @@ elif [ "$1" == "config" ]; then echo "graph_args --lower-limit 0 --base 1000" echo "graph_vlabel milliseconds" echo "graph_category connectivity" - echo "graph_info This graph shows ICMP RTT for {$SRC} on interface ${interface} toward multiple destination hosts" + echo "graph_info This graph shows ICMP RTT for {$SRC} on FIB ${FIB} toward multiple destination hosts" COLOR=7 for DST in `echo ${hosts} | tr , " "`; do @@ -129,7 +145,7 @@ elif [ "$1" == "config" ]; then echo "graph_scale no" echo "graph_vlabel percent" echo "graph_category connectivity" - echo "graph_info This graph shows ICMP Packet Loss for source address ${SRC} on interface ${interface} toward multiple destination hosts" + echo "graph_info This graph shows ICMP Packet Loss for source address ${SRC} on FIB ${FIB} toward multiple destination hosts" COLOR=7 for DST in `echo ${hosts} | tr , " "`; do From 758988ebeea7d559518c6c5d9da68c1e00c426c4 Mon Sep 17 00:00:00 2001 From: Moritz Hoffmann Date: Wed, 21 Jun 2017 17:34:14 +0200 Subject: [PATCH 12/14] Add documentation to run specific plugins as root Signed-off-by: Moritz Hoffmann --- LICENSE | 2 +- README.md | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 53024e6..dcce9de 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016, Babak Farrokhi +Copyright (c) 2017, Babak Farrokhi, Moritz Hoffmann All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 5519352..02aa8ab 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,11 @@ A set of FreeBSD specific plugins for Munin - You need to install `lang/gawk` in order to run `intr_` plugin. - You need to install `sysutils/ipmitool` in order to run `ipmi_` plugin. - These are wildcard plugins, and should be installed using `munin-node-configure` program -- Some plugins such as `ipmi_` and `multiping_` need to have root access to run. +- Some plugins such as `pf_`, `ipmi_` and `multiping_` need to have root access to run. To tell Munin to run a plugin as root, adapt the following snippet and add it to `/usr/local/etc/munin/plugin-conf.d/plugins.conf`: +``` +[pf_*] +user root +``` ## Setup 1. Make sure `sysutils/munin-node` is installed From b2817094202be512877d861a4763e6dc430ad556 Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Sat, 2 Sep 2017 18:52:21 +0430 Subject: [PATCH 13/14] Display sum of all netisr threads instead of displaying separate value for each thread --- netisr_ | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/netisr_ b/netisr_ index 0b60fbd..24031c6 100755 --- a/netisr_ +++ b/netisr_ @@ -46,15 +46,32 @@ if [ $# -lt 1 ]; then echo "Should run from symlink" exit 1 fi - awk ' +BEGIN { + OFS=""; + qed=0; + handled=0; + dropped=0; + hdised=0; + dised=0; + st=""; +} / ('${STAT_TYPE}') / { - print "t"$2 "_"$3"_queued.value "$9; - print "t"$2 "_"$3"_handled.value "$10; - print "t"$2 "_"$3"_dropped.value "$8; - print "t"$2 "_"$3"_hdispatched.value "$7; - print "t"$2 "_"$3"_dispatched.value "$6; -} ' ${STATFILE} + st=$3; + qed=qed+$9; + handled=handled+$10; + dropped=dropped+$8; + hdised=hdised+$7; + dised=dised+$6; +} +END { + print st, "_queued.value ", qed; + print st, "_handled.value ", handled; + print st, "_dropped.value ", dropped; + print st, "_hdispatched.value ", hdised; + print st, "_dispatched.value ", dised; +} +' ${STATFILE} elif [ "$1" == "suggest" ]; then From 5ddd8aef7790cd79345947a98e9ff41c62036902 Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Sat, 2 Sep 2017 19:04:55 +0430 Subject: [PATCH 14/14] Get rid of thread information in config output (we do sum) --- netisr_ | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/netisr_ b/netisr_ index 24031c6..dd73a0e 100755 --- a/netisr_ +++ b/netisr_ @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2016 Babak Farrokhi. All rights reserved. +# Copyright (c) 2017 Babak Farrokhi. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -94,21 +94,21 @@ elif [ "$1" == "config" ]; then awk ' / ('${STAT_TYPE}') / { - print "t"$2 "_"$3"_queued.label Thread "$2 " Queued"; - print "t"$2 "_"$3"_handled.label Thread "$2 " Handled"; - print "t"$2 "_"$3"_dropped.label Thread "$2 " Dropped"; - print "t"$2 "_"$3"_hdispatched.label Thread "$2 " Hybrid-Dispatched"; - print "t"$2 "_"$3"_dispatched.label Thread "$2" Dispatched"; - print "t"$2 "_"$3"_queued.type DERIVE"; - print "t"$2 "_"$3"_handled.type DERIVE"; - print "t"$2 "_"$3"_dropped.type DERIVE"; - print "t"$2 "_"$3"_hdispatched.type DERIVE"; - print "t"$2 "_"$3"_dispatched.type DERIVE"; - print "t"$2 "_"$3"_queued.min 0"; - print "t"$2 "_"$3"_handled.min 0"; - print "t"$2 "_"$3"_dropped.min 0"; - print "t"$2 "_"$3"_hdispatched.min 0"; - print "t"$2 "_"$3"_dispatched.min 0"; + print $3"_queued.label Queued"; + print $3"_handled.label Handled"; + print $3"_dropped.label Dropped"; + print $3"_hdispatched.label Hybrid-Dispatched"; + print $3"_dispatched.label Dispatched"; + print $3"_queued.type DERIVE"; + print $3"_handled.type DERIVE"; + print $3"_dropped.type DERIVE"; + print $3"_hdispatched.type DERIVE"; + print $3"_dispatched.type DERIVE"; + print $3"_queued.min 0"; + print $3"_handled.min 0"; + print $3"_dropped.min 0"; + print $3"_hdispatched.min 0"; + print $3"_dispatched.min 0"; }' ${STATFILE} fi