[munin/sockets] on ajoute sockets qui compte le nombre de connexions
darcs-hash:20090421161517-bd074-ff1b313d2eb3a23519a6e93da346815d807040a2.gz
This commit is contained in:
parent
ca191d8a27
commit
e36f16cb9a
1 changed files with 63 additions and 0 deletions
63
munin/sockets
Executable file
63
munin/sockets
Executable file
|
@ -0,0 +1,63 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# # Parameters:
|
||||||
|
#
|
||||||
|
# config (required)
|
||||||
|
# autoconf (optional - used by munin-config)
|
||||||
|
# suggest (optional - used by munin-config)
|
||||||
|
#
|
||||||
|
|
||||||
|
#. $MUNIN_LIBDIR/plugins/plugin.sh
|
||||||
|
|
||||||
|
myname="connexions"
|
||||||
|
|
||||||
|
name="${name-\<$myname\>}"
|
||||||
|
REGEX="${regex-\<$name\>}"
|
||||||
|
|
||||||
|
if [ "$1" = "autoconf" ]; then
|
||||||
|
echo yes
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "suggest" ]; then
|
||||||
|
exit 0
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
|
ip=`ifconfig | perl -ne 'print ${^MATCH} if /10\.231\.136\.\d+/p'`
|
||||||
|
ips=${IP/10/}
|
||||||
|
TMP=`mktemp -t sockets.XXXXXX`
|
||||||
|
trap "rm $TMP* 2>/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
|
||||||
|
|
||||||
|
printf "other.label "
|
||||||
|
perl -ne "print if ! /$ips:(imap|ssh|http)/" $TMP | wc -l
|
||||||
|
|
||||||
|
printf "in.label "
|
||||||
|
perl -ne "print if ! /$ips:\d{5}/" $TMP | wc -l
|
||||||
|
|
||||||
|
printf "out.label "
|
||||||
|
perl -ne "print if /$ips:\d{5}/" $TMP | wc -l
|
Loading…
Add table
Add a link
Reference in a new issue