root / plugins / udp / udp-statistics @ d2161137
Historique | Voir | Annoter | Télécharger (2,08 ko)
| 1 |
#!/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 |
sent.label Sent |
| 20 |
sent.draw LINE1 |
| 21 |
sent.type DERIVE |
| 22 |
sent.min 0 |
| 23 |
received.label Received |
| 24 |
received.draw AREA |
| 25 |
received.type DERIVE |
| 26 |
received.min 0 |
| 27 |
unknown_ports.label In Unknown Port |
| 28 |
unknown_ports.draw LINE1 |
| 29 |
unknown_ports.type DERIVE |
| 30 |
unknown_ports.min 0 |
| 31 |
receive_buffer_errors.label Receive Buffer Errors |
| 32 |
receive_buffer_errors.draw LINE1 |
| 33 |
receive_buffer_errors.type DERIVE |
| 34 |
receive_buffer_errors.min 0 |
| 35 |
send_buffer_errors.label Send Buffer Errors |
| 36 |
send_buffer_errors.draw LINE1 |
| 37 |
send_buffer_errors.type DERIVE |
| 38 |
send_buffer_errors.min 0 |
| 39 |
in_csum_errors.label In CSUM Errors |
| 40 |
in_csum_errors.draw LINE1 |
| 41 |
in_csum_errors.type DERIVE |
| 42 |
in_csum_errors.min 0 |
| 43 |
ignored_multis.label In Ignored Multis |
| 44 |
ignored_multis.draw LINE1 |
| 45 |
ignored_multis.type DERIVE |
| 46 |
ignored_multis.min 0 |
| 47 |
receive_errors.label Receive Errors |
| 48 |
receive_errors.draw LINE1 |
| 49 |
receive_errors.type DERIVE |
| 50 |
receive_errors.min 0 |
| 51 |
EOM |
| 52 |
exit 0; |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
@netstat = qx{/bin/netstat -us | grep -A8 '^Udp:' | awk '/packets sent/ \{ print "sent.value " \$1 \}
|
| 57 |
/packets received/ \{ print "received.value " \$1 \}
|
| 58 |
/packets to unknown port received/ \{ print "unknown_ports.value " \$1 \}
|
| 59 |
/receive buffer errors/ \{ print "receive_buffer_errors.value " \$1 \}
|
| 60 |
/send buffer errors/ \{ print "send_buffer_errors.value " \$1 \}
|
| 61 |
/InCsumErrors/ \{ print "in_csum_errors.value " \$2 \}
|
| 62 |
/IgnoredMulti/ \{ print "ignored_multis.value " \$2 \}
|
| 63 |
/packet receive errors/ \{ print "receive_errors.value " \$1 \}'};
|
| 64 |
|
| 65 |
print @netstat; |
