Révision 331d5a43
remove plugin existing in main munin repository
| plugins/network/tcp | ||
|---|---|---|
| 1 |
#!/bin/sh |
|
| 2 |
|
|
| 3 |
: <<EOF |
|
| 4 |
|
|
| 5 |
=head1 NAME |
|
| 6 |
|
|
| 7 |
tcp - Plugin to monitor IPV4/6 TCP socket status on a Linux host. |
|
| 8 |
|
|
| 9 |
=head1 AUTHOR |
|
| 10 |
|
|
| 11 |
Copyright 2009 Tim Small <tim@seoss.co.uk> |
|
| 12 |
|
|
| 13 |
=head1 LICENSE |
|
| 14 |
|
|
| 15 |
GPLv2 |
|
| 16 |
|
|
| 17 |
=begin comment |
|
| 18 |
|
|
| 19 |
This program is free software; you can redistribute it and/or modify |
|
| 20 |
it under the terms of the GNU General Public License as published by |
|
| 21 |
the Free Software Foundation; version 2 dated June, 1991. |
|
| 22 |
|
|
| 23 |
This program is distributed in the hope that it will be useful, but |
|
| 24 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 25 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 26 |
General Public License for more details. |
|
| 27 |
|
|
| 28 |
You should have received a copy of the GNU General Public License |
|
| 29 |
along with this program; if not, write to the Free Software |
|
| 30 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
| 31 |
USA. |
|
| 32 |
|
|
| 33 |
=end comment |
|
| 34 |
|
|
| 35 |
=head1 MAGIC MARKERS |
|
| 36 |
|
|
| 37 |
#%# family=manual |
|
| 38 |
#%# capabilities=autoconf |
|
| 39 |
|
|
| 40 |
=cut |
|
| 41 |
|
|
| 42 |
EOF |
|
| 43 |
|
|
| 44 |
case $1 in |
|
| 45 |
config) |
|
| 46 |
cat <<EOF |
|
| 47 |
graph_title TCP |
|
| 48 |
graph_vlabel TCP Sockets |
|
| 49 |
graph_category network |
|
| 50 |
graph_args -l 0 |
|
| 51 |
graph_info TCP socket states for the local machine |
|
| 52 |
EOF |
|
| 53 |
|
|
| 54 |
for i in established syn_sent syn_recv fin_wait1 \ |
|
| 55 |
fin_wait2 time_wait close close_wait last_ack \ |
|
| 56 |
listen closing |
|
| 57 |
do |
|
| 58 |
echo ${i}.label $i
|
|
| 59 |
echo ${i}.draw LINE2
|
|
| 60 |
echo ${i}.info Sockets in state $i
|
|
| 61 |
done |
|
| 62 |
|
|
| 63 |
exit 0 |
|
| 64 |
;; |
|
| 65 |
autoconf) |
|
| 66 |
if [ -f /proc/net/tcp -o -f /proc/net/tcp6 ] |
|
| 67 |
then |
|
| 68 |
echo yes |
|
| 69 |
exit 0 |
|
| 70 |
else |
|
| 71 |
echo no |
|
| 72 |
exit 1 |
|
| 73 |
fi |
|
| 74 |
esac |
|
| 75 |
|
|
| 76 |
# See #include <netinet/tcp.h> |
|
| 77 |
|
|
| 78 |
cat /proc/net/tcp* | awk ' |
|
| 79 |
|
|
| 80 |
match ($4, /0[0-9A-B]/) {
|
|
| 81 |
STATE[$4]++; |
|
| 82 |
} |
|
| 83 |
|
|
| 84 |
END {
|
|
| 85 |
printf "established.value %d\n", STATE["01"]; |
|
| 86 |
printf "syn_sent.value %d\n", STATE["02"]; |
|
| 87 |
printf "syn_recv.value %d\n", STATE["03"]; |
|
| 88 |
printf "fin_wait1.value %d\n", STATE["04"]; |
|
| 89 |
printf "fin_wait2.value %d\n", STATE["05"]; |
|
| 90 |
printf "time_wait.value %d\n", STATE["06"]; |
|
| 91 |
printf "close.value %d\n", STATE["07"]; |
|
| 92 |
printf "close_wait.value %d\n", STATE["08"]; |
|
| 93 |
printf "last_ack.value %d\n", STATE["09"]; |
|
| 94 |
printf "listen.value %d\n", STATE["0A"]; |
|
| 95 |
printf "closing.value %d\n", STATE["0B"]; |
|
| 96 |
}' |
|
Formats disponibles : Unified diff