summaryrefslogtreecommitdiff
path: root/files/puppet/modules
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2015-01-05 16:10:14 -0500
committerMicah Anderson <micah@riseup.net>2015-01-05 16:10:14 -0500
commita5984dd49ac512f05c522279861ca5b87c5be4a4 (patch)
treec0c1755a35c41c41b9fddde331e1f915ee68c13a /files/puppet/modules
parent9792e035af468e33ec4dd85be3d68f408a41b768 (diff)
fix path to custom init.pp
add custom openvpn module to group graphs
Diffstat (limited to 'files/puppet/modules')
-rw-r--r--files/puppet/modules/custom/manifests/init.pp (renamed from files/puppet/modules/custom/init.pp)0
-rw-r--r--files/puppet/modules/custom_munin_node/files/openvpn118
-rw-r--r--files/puppet/modules/custom_munin_node/manifests/openvpn.pp8
3 files changed, 126 insertions, 0 deletions
diff --git a/files/puppet/modules/custom/init.pp b/files/puppet/modules/custom/manifests/init.pp
index 74a688b..74a688b 100644
--- a/files/puppet/modules/custom/init.pp
+++ b/files/puppet/modules/custom/manifests/init.pp
diff --git a/files/puppet/modules/custom_munin_node/files/openvpn b/files/puppet/modules/custom_munin_node/files/openvpn
new file mode 100644
index 0000000..bd7186b
--- /dev/null
+++ b/files/puppet/modules/custom_munin_node/files/openvpn
@@ -0,0 +1,118 @@
+#!/usr/bin/perl
+# -*- perl -*-
+
+=head1 NAME
+
+openvpn - Plugin to monitor number of users connected to openvpn server
+
+=head1 USAGE
+
+To use this plugin, add the following text to your openvpn server
+configuration file:
+
+ status /var/log/openvpn.status
+ status-version 1
+
+If you change the path to the status file, remember to change
+env.statusfile in the plugin configuration to match the new path.
+
+=head1 CONFIGURATION
+
+This script uses the following configuration variables
+
+ [openvpn]
+ env.statusfile <path to status log file>
+
+=head2 DEFAULT CONFIGURATION
+
+The default configuration is
+
+ [openvpn]
+ env.statusfile /var/log/openvpn.status
+
+=head1 AUTHOR
+
+Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+
+=head1 LICENSE
+
+Gnu GPLv2
+
+=begin comment
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; version 2 dated June,
+1991.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+If you improve this script please send your version to my email address
+with the copyright notice upgrade with your name.
+
+=end comment
+
+=head1 MAGIC MARKERS
+
+ #%# family=contrib
+ #%# capabilities=autoconf
+
+=cut
+
+use strict;
+
+my $statuslogfile = $ENV{'statusfile'} || '/var/log/openvpn.status';
+my $users = 0;
+
+if($ARGV[0] and $ARGV[0] eq "autoconf" ) {
+ if(-f $statuslogfile) {
+ if(-r $statuslogfile) {
+ print "yes\n";
+ exit 0;
+ } else {
+ print "no (logfile not readable)\n";
+ }
+ } else {
+ print "no (logfile not found)\n";
+ }
+ exit 0;
+}
+
+if ($ARGV[0] and $ARGV[0] eq "config" ){
+ print "graph_title OpenVpn\n";
+ print "graph_args --base 1000 -l 0\n";
+ print "graph_scale yes\n";
+ print "graph_vlabel users\n";
+ print "graph_category vpn\n";
+ print "graph_info This graph shows the numbers of users connected to openvpn server.\n";
+ print "users.label users\n";
+ print "users.info The number of users connected to openvpn server\n";
+ exit 0;
+}
+
+if (-f "$statuslogfile") {
+ open(IN, "$statuslogfile") or exit 4;
+ my $flagu = 0;
+ while(<IN>) {
+ if(/^ROUTING TABLE$/) {
+ $flagu = 0;
+ }
+ if ($flagu) {
+ $users = $users + 1;
+ }
+ if(/^Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since$/) {
+ $flagu = 1;
+ }
+ }
+ close(IN);
+}
+
+print "users.value " . $users."\n";
+
diff --git a/files/puppet/modules/custom_munin_node/manifests/openvpn.pp b/files/puppet/modules/custom_munin_node/manifests/openvpn.pp
index 84ce219..133fc87 100644
--- a/files/puppet/modules/custom_munin_node/manifests/openvpn.pp
+++ b/files/puppet/modules/custom_munin_node/manifests/openvpn.pp
@@ -12,6 +12,14 @@ class custom_munin_node::openvpn {
group => 0;
}
+ file {'/usr/share/munin/plugins/openvpn':
+ source => 'puppet:///modules/custom_munin_node/openvpn',
+ before => Package['munin-plugins-core'],
+ mode => '0755',
+ owner => root,
+ group => 0;
+ }
+
file {'/etc/munin/plugins/openvpn':
ensure => 'link',
target => '/usr/share/munin/plugins/openvpn',