Skip to content

Commit

Permalink
add support for protocols plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Throckmorton committed Jun 1, 2015
1 parent 27c81f6 commit 8c2ad77
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Expand Up @@ -90,6 +90,7 @@ documentation for each plugin for configurable attributes.
* `ping` (see [collectd::plugin::ping](#class-collectdpluginping) below)
* `postgresql` (see [collectd::plugin::postgresql](#class-collectdpluginpostgresql) below)
* `processes` (see [collectd::plugin:processes](#class-collectdpluginprocesses) below)
* `protocols` (see [collectd::plugin:protocols](#class-collectdpluginprotocols) below)
* `python` (see [collectd::plugin::python](#class-collectdpluginpython) below)
* `redis` (see [collectd::plugin::redis](#class-collectdpluginredis) below)
* `rrdcached` (see [collectd::plugin::rrdcached](#class-collectdpluginrrdcached) below)
Expand Down Expand Up @@ -647,6 +648,19 @@ class { 'collectd::plugin::processes':
],
}
```
####Class: `collectd::plugin::protocols`

* `values` is an array of `Protocol` names, `Protocol:ValueName` pairs, or a regex
* see `/proc/net/netstat` and `/proc/net/snmp` for a list of `Protocol` targets

See [collectd.conf documentation] (https://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_protocols) for details

```puppet
class { 'collectd::plugin::protocols':
values => ['/^Tcp:*/', '/^Udp:*/', 'Icmp:InErrors' ],
ignoreselected => false,
}
```

####Class: `collectd::plugin::python`

Expand Down Expand Up @@ -977,4 +991,4 @@ This module shall not use unsupported configuration directives. Look at [templat

Please make use of the search by branch/tags on the collectd github to see when a function has been first released.

Reading the [collectd.conf.pod](https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod) file is good, validating the presence of the code in the .c files is even better.
Reading the [collectd.conf.pod](https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod) file is good, validating the presence of the code in the .c files is even better.
19 changes: 19 additions & 0 deletions manifests/plugin/protocols.pp
@@ -0,0 +1,19 @@
# See http://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_protocols
class collectd::plugin::protocols (
$ensure = present,
$ignoreselected = false,
$values = []
) {

validate_array(
$values,
)
validate_bool(
$ignoreselected,
)

collectd::plugin {'protocols':
ensure => $ensure,
content => template('collectd/plugin/protocols.conf.erb'),
}
}
16 changes: 16 additions & 0 deletions templates/plugin/protocols.conf.erb
@@ -0,0 +1,16 @@
<% if @values -%>
<Plugin "protocols">
<%
if @values
@values.each do |value|
-%>
Value "<%= value %>"
<%
end
end
-%>
<% if @ignore_selected != nil -%>
IgnoreSelected <%= @ignore_selected %>
<% end -%>
</Plugin>
<% end -%>

0 comments on commit 8c2ad77

Please sign in to comment.