Révision 992d1c8d
| ID | 992d1c8d5ccbf4b7ace672b00af0598f6ac7250c |
remove plugin included in main munin distribution
| plugins/network/openvpn_clients | ||
|---|---|---|
| 1 |
#!/usr/bin/perl |
|
| 2 |
# |
|
| 3 |
# Copyright (C) 2005-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> |
|
| 4 |
# |
|
| 5 |
# This program is free software; you can redistribute it and/or |
|
| 6 |
# modify it under the terms of the GNU General Public License |
|
| 7 |
# as published by the Free Software Foundation; version 2 dated June, |
|
| 8 |
# 1991. |
|
| 9 |
# |
|
| 10 |
# This program is distributed in the hope that it will be useful, |
|
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 13 |
# GNU General Public License for more details. |
|
| 14 |
# |
|
| 15 |
# You should have received a copy of the GNU General Public License |
|
| 16 |
# along with this program; if not, write to the Free Software |
|
| 17 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
| 18 |
# |
|
| 19 |
# If you improve this script please send your version to my email address |
|
| 20 |
# with the copyright notice upgrade with your name. |
|
| 21 |
# |
|
| 22 |
# Munin's plugin to monitor number of clients connected to openvpn server |
|
| 23 |
# |
|
| 24 |
# Usage: copy or link into /etc/munin/plugins |
|
| 25 |
# |
|
| 26 |
# Parameters: |
|
| 27 |
# |
|
| 28 |
# config (required) |
|
| 29 |
# autoconf (optional - used by munin-config) |
|
| 30 |
# |
|
| 31 |
# $Log$ |
|
| 32 |
# Revision 1.2 2007/01/17 15:57:19 rodo |
|
| 33 |
# Correct family |
|
| 34 |
# |
|
| 35 |
# Revision 1.1 2005/10/11 14:12:19 Rodolphe Quiedeville |
|
| 36 |
# |
|
| 37 |
# Magic markers (optinal - used by munin-config and some installation |
|
| 38 |
# scripts): |
|
| 39 |
# |
|
| 40 |
#%# family=auto |
|
| 41 |
#%# capabilities=autoconf |
|
| 42 |
|
|
| 43 |
use strict; |
|
| 44 |
|
|
| 45 |
my $statuslogfile = "/etc/openvpn/openvpn-status.log"; |
|
| 46 |
my $clients = 0; |
|
| 47 |
|
|
| 48 |
if($ARGV[0] and $ARGV[0] eq "autoconf" ) {
|
|
| 49 |
if(-f $statuslogfile) {
|
|
| 50 |
if(-r $statuslogfile) {
|
|
| 51 |
print "yes\n"; |
|
| 52 |
exit 0; |
|
| 53 |
} else {
|
|
| 54 |
print "no (logfile not readable)\n"; |
|
| 55 |
} |
|
| 56 |
} else {
|
|
| 57 |
print "no (logfile not found)\n"; |
|
| 58 |
} |
|
| 59 |
exit 1; |
|
| 60 |
} |
|
| 61 |
|
|
| 62 |
if ($ARGV[0] and $ARGV[0] eq "config" ){
|
|
| 63 |
print "graph_title OpenVpn\n"; |
|
| 64 |
print "graph_args --base 1000 -l 0\n"; |
|
| 65 |
print "graph_scale yes\n"; |
|
| 66 |
print "graph_vlabel clients\n"; |
|
| 67 |
print "graph_category network\n"; |
|
| 68 |
print "graph_info This graph shows the numbers of clients connected to openvpn server.\n"; |
|
| 69 |
print "clients.label clients\n"; |
|
| 70 |
print "clients.info The number of clients connected to openvpn server\n"; |
|
| 71 |
exit 0; |
|
| 72 |
} |
|
| 73 |
|
|
| 74 |
if (-f "$statuslogfile") {
|
|
| 75 |
open(IN, "$statuslogfile") or exit 4; |
|
| 76 |
my $flagu = 0; |
|
| 77 |
while(<IN>) {
|
|
| 78 |
if(/^ROUTING TABLE$/) {
|
|
| 79 |
$flagu = 0; |
|
| 80 |
} |
|
| 81 |
if ($flagu) {
|
|
| 82 |
$clients = $clients + 1; |
|
| 83 |
} |
|
| 84 |
if(/^Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since$/) {
|
|
| 85 |
$flagu = 1; |
|
| 86 |
} |
|
| 87 |
} |
|
| 88 |
close(IN); |
|
| 89 |
} |
|
| 90 |
|
|
| 91 |
print "clients.value " . $clients."\n"; |
|
Formats disponibles : Unified diff