root / plugins / network / dar_vpnd @ 31412baa
Historique | Voir | Annoter | Télécharger (925 octets)
| 1 | d38174c6 | phl | #!/usr/bin/env perl |
|---|---|---|---|
| 2 | # -*- perl -*- |
||
| 3 | |||
| 4 | =head1 NAME |
||
| 5 | |||
| 6 | dar_vpnd a Plugin for displaying VPN Stats for the Darwin (MacOS) vpnd Service. |
||
| 7 | |||
| 8 | =head1 INTERPRETATION |
||
| 9 | |||
| 10 | The Plugin displays the number of active VPN connections. |
||
| 11 | |||
| 12 | =head1 CONFIGURATION |
||
| 13 | |||
| 14 | No Configuration necessary! |
||
| 15 | |||
| 16 | =head1 AUTHOR |
||
| 17 | |||
| 18 | Philipp Haussleiter <philipp@haussleiter.de> (email) |
||
| 19 | |||
| 20 | =head1 LICENSE |
||
| 21 | |||
| 22 | GPLv2 |
||
| 23 | |||
| 24 | =cut |
||
| 25 | |||
| 26 | # MAIN |
||
| 27 | use warnings; |
||
| 28 | use strict; |
||
| 29 | |||
| 30 | |||
| 31 | my $cmd = "ps -ef | awk '/[p]ppd/ {print substr(\$NF,2);}' | wc -l";
|
||
| 32 | |||
| 33 | if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
|
||
| 34 | print "graph_category VPN\n"; |
||
| 35 | print "graph_args --base 1024 -r --lower-limit 0\n"; |
||
| 36 | print "graph_title Number of VPN Connections\n"; |
||
| 37 | print "graph_vlabel VPN Connections\n"; |
||
| 38 | print "graph_info The Graph shows the Number of VPN Connections\n"; |
||
| 39 | print "connections.label Number of VPN Connections\n"; |
||
| 40 | print "connections.type GAUGE\n"; |
||
| 41 | } else {
|
||
| 42 | my $output = `$cmd`; |
||
| 43 | print "connections.value $output"; |
||
| 44 | } |
