Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / network / sockstat @ dd4afac8

Historique | Voir | Annoter | Télécharger (754 octets)

1
#!/bin/sh
2
#
3

    
4
PATH=/bin:/usr/bin
5

    
6
if [ "$1" = "autoconf" ]; then
7
  echo yes
8
  exit 0
9
fi
10

    
11
DAEMONS=`sockstat | awk '{print substr($0, 1, 8)}' | sort | uniq`
12

    
13
if [ "$1" = "config" ]; then
14
  echo 'graph_title Connections'
15
  echo 'graph_vlabel Connections'
16
  echo 'graph_noscale true'
17
  echo 'graph_category network'
18
  echo 'graph_info This graph shows connections load.'
19

    
20
  for D in $DAEMONS
21
  do
22
      echo "_$D.label $D"
23
  done
24

    
25
  echo "_TOTAL.label TOTAL"
26

    
27
  exit 0
28
fi
29

    
30
VALUES=`sockstat | awk '{print substr($0, 1, 8)}' | sort | uniq -c`
31
NUM=1
32

    
33
for D in $DAEMONS
34
do
35
    echo -n "_$D.value "
36
    VAL=`echo $VALUES | cut -d ' ' -f $NUM`
37
    echo $VAL
38
NUM=$(($NUM + 2))
39
done
40

    
41
echo -n "_TOTAL.value "
42
sockstat | wc -l