Skip to content

Commit fbda2f1

Browse files
author
Tim Bielawa
committed
Begin adding support for multiple openvpn 'statusfile' parameters
1 parent 85e230c commit fbda2f1

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,13 +513,32 @@ class { 'collectd::plugin::ntpd':
513513

514514
####Class: `collectd::plugin::openvpn`
515515

516+
* `statusfile` (String or Array) Status file(s) to collect data from. (Default `/etc/openvpn/openvpn-status.log`)
517+
* `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`)
518+
* `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`)
519+
* `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`)
520+
* `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`)
521+
522+
Watch multiple `statusfile`s:
523+
516524
```puppet
517525
class { 'collectd::plugin::openvpn':
526+
statusfile => [ '/etc/openvpn/openvpn-status-tcp.log', '/etc/openvpn/openvpn-status-udp.log' ],
518527
collectindividualusers => false,
519528
collectusercount => true,
520529
}
521530
```
522531

532+
Watch the single default `statusfile`:
533+
534+
```puppet
535+
class { 'collectd::plugin::openvpn':
536+
collectindividualusers => false,
537+
collectusercount => true,
538+
}
539+
```
540+
541+
523542
####Class: `collectd::plugin::perl`
524543

525544
This class has no parameters and will load the actual perl plugin.

manifests/plugin/openvpn.pp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@
88
$collectusercount = false,
99
$interval = undef,
1010
) {
11-
validate_absolute_path($statusfile)
11+
if is_string($statusfile) {
12+
validate_absolute_path($statusfile)
13+
$statusfiles = [ $statusfile ]
14+
} elsif is_array($statusfile) {
15+
$statusfiles = $statusfile
16+
} else {
17+
fail("statusfile must be either array or string: ${statusfile}")
18+
}
19+
1220
validate_bool(
1321
$improvednamingschema,
1422
$collectcompression,

templates/plugin/openvpn.conf.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<Plugin openvpn>
2-
StatusFile "<%= @statusfile %>"
2+
<% @statusfiles.each do |sf| -%>
3+
StatusFile "<%= sf %>"
4+
<% end -%>
35
ImprovedNamingSchema <%= @improvednamingschema %>
46
CollectCompression <%= @collectcompression %>
57
CollectIndividualUsers <%= @collectindividualusers %>

0 commit comments

Comments
 (0)