Skip to content

Commit

Permalink
Begin adding support for multiple openvpn 'statusfile' parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
tbielawa committed Jul 20, 2015
1 parent 85e230c commit fbda2f1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,32 @@ class { 'collectd::plugin::ntpd':

####Class: `collectd::plugin::openvpn`

* `statusfile` (String or Array) Status file(s) to collect data from. (Default `/etc/openvpn/openvpn-status.log`)
* `improvednamingschema` (Bool) When enabled, the filename of the status file will be used as plugin instance and the client's "common name" will be used as type instance. This is required when reading multiple status files. (Default: `false`)
* `collectcompression` Sets whether or not statistics about the compression used by OpenVPN should be collected. This information is only available in single mode. (Default `true`)
* `collectindividualusers` Sets whether or not traffic information is collected for each connected client individually. If set to false, currently no traffic data is collected at all because aggregating this data in a save manner is tricky. (Default `true`)
* `collectusercount` When enabled, the number of currently connected clients or users is collected. This is especially interesting when CollectIndividualUsers is disabled, but can be configured independently from that option. (Default `false`)

Watch multiple `statusfile`s:

```puppet
class { 'collectd::plugin::openvpn':
statusfile => [ '/etc/openvpn/openvpn-status-tcp.log', '/etc/openvpn/openvpn-status-udp.log' ],
collectindividualusers => false,
collectusercount => true,
}
```

Watch the single default `statusfile`:

```puppet
class { 'collectd::plugin::openvpn':
collectindividualusers => false,
collectusercount => true,
}
```


####Class: `collectd::plugin::perl`

This class has no parameters and will load the actual perl plugin.
Expand Down
10 changes: 9 additions & 1 deletion manifests/plugin/openvpn.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@
$collectusercount = false,
$interval = undef,
) {
validate_absolute_path($statusfile)
if is_string($statusfile) {
validate_absolute_path($statusfile)
$statusfiles = [ $statusfile ]
} elsif is_array($statusfile) {
$statusfiles = $statusfile
} else {
fail("statusfile must be either array or string: ${statusfile}")
}

validate_bool(
$improvednamingschema,
$collectcompression,
Expand Down
4 changes: 3 additions & 1 deletion templates/plugin/openvpn.conf.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Plugin openvpn>
StatusFile "<%= @statusfile %>"
<% @statusfiles.each do |sf| -%>
StatusFile "<%= sf %>"
<% end -%>
ImprovedNamingSchema <%= @improvednamingschema %>
CollectCompression <%= @collectcompression %>
CollectIndividualUsers <%= @collectindividualusers %>
Expand Down

0 comments on commit fbda2f1

Please sign in to comment.