diff --git a/munin/sockets b/munin/sockets index 4d1a67e1..3d0d3118 100755 --- a/munin/sockets +++ b/munin/sockets @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # # Parameters: # @@ -13,6 +13,8 @@ myname="connexions" name="${name-\<$myname\>}" REGEX="${regex-\<$name\>}" +services=(http ssh smtp imap nfs ldap) + if [ "$1" = "autoconf" ]; then echo yes @@ -24,37 +26,32 @@ if [ "$1" = "suggest" ]; then fi if [ "$1" = "config" ]; then - - echo graph_title Number of $myname - echo 'graph_args --base 1000 --vertical-label connexions -l 0' - echo 'graph_category network' - echo "imap.label Connexions imap" - echo "ssh.label Connexions ssh" - echo "http.label Connexions web" - echo "other.label Connexions diverses" - echo "in.label Connexions entrantes" - echo "out.label Connexions sortantes" - exit 0 + cat </dev/null" 0 /sbin/ss > $TMP -printf "imap.value " -grep "$ips:imap" $TMP | wc -l - -printf "ssh.value " -grep "$ips:ssh" $TMP | wc -l - -printf "http.value " -grep "$ips:http" $TMP | wc -l +for dmn in ${services[@]}; do +printf "$dmn.value " +grep "$ips:$dmn" $TMP | wc -l +done printf "other.value " -perl -ne "print if ! /$ips:(imap|ssh|http)/" $TMP | wc -l +perl -ne "print if ! /$ips:`echo ${services[@]} | sed 's/ /|/g'`/" $TMP | wc -l printf "in.value " perl -ne "print if ! /$ips:\d{5}/" $TMP | wc -l