Projet

Général

Profil

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

root / plugins / network / udp-statistics @ dd4afac8

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

1 44ace240 twilliam
#!/usr/bin/perl -w
2
3
if ( $ARGV[0] ) {
4
5
    if ( $ARGV[0] eq 'autoconf' ) {
6
        if ( -r '/bin/netstat') {
7
            print "yes\n";
8
            exit 0;
9
        }
10
        print "no\n";
11
        exit 0;
12
13
    } elsif ( $ARGV[0] eq 'config' ) {
14
        print <<EOM;
15
graph_title UDP Statistics
16
graph_args --base 1000 -l 0
17
graph_vlabel Packets/\${graph_period}
18
graph_category network
19
received.label Received
20
received.draw AREA
21
received.type DERIVE
22
received.min 0
23
errors.label Errors
24
errors.draw LINE1
25
errors.type DERIVE
26
errors.min 0
27
sent.label Sent
28
sent.draw LINE1
29
sent.type DERIVE
30
sent.min 0
31
EOM
32
        exit 0;
33
    }
34
}
35
36
@netstat = qx{/bin/netstat -us | awk '/packets sent/          \{ print "sent.value " \$1 \}
37
                                      /packets received/      \{ print "received.value " \$1 \}
38
                                      /packet receive errors/ \{ print "errors.value " \$1 \}'};
39
40
print @netstat;