Skip to content

Commit

Permalink
Merge pull request #778 from juniorsysadmin/amqp-datatype
Browse files Browse the repository at this point in the history
collectd::plugin::amqp - Use data types
  • Loading branch information
juniorsysadmin authored Apr 9, 2018
2 parents b0ba67d + 2ccc3df commit 73f8303
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
34 changes: 16 additions & 18 deletions manifests/plugin/amqp.pp
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
# https://collectd.org/wiki/index.php/Plugin:AMQP
class collectd::plugin::amqp (
$ensure = 'present',
$manage_package = undef,
$amqphost = 'localhost',
$amqpport = 5672,
$amqpvhost = 'graphite',
$amqpuser = 'graphite',
$amqppass = 'graphite',
$amqpformat = 'Graphite',
$amqpstorerates = false,
$amqpexchange = 'metrics',
Enum['present', 'absent'] $ensure = 'present',
Boolean $manage_package = $collectd::manage_package,
Stdlib::Host $amqphost = 'localhost',
Stdlib::Port $amqpport = 5672,
String $amqpvhost = 'graphite',
String $amqpuser = 'graphite',
String $amqppass = 'graphite',
Collectd::Amqp::Format $amqpformat = 'Graphite',
Boolean $amqpstorerates = false,
String $amqpexchange = 'metrics',
Boolean $amqppersistent = true,
$amqproutingkey = 'collectd',
$graphiteprefix = 'collectd.',
$escapecharacter = '_',
$interval = undef,
String $amqproutingkey = 'collectd',
String $graphiteprefix = 'collectd.',
String[1] $escapecharacter = '_',
Optional[Integer[1]] $interval = undef,
Boolean $graphiteseparateinstances = false,
Boolean $graphitealwaysappendds = false,
) {

include ::collectd

$_manage_package = pick($manage_package, $::collectd::manage_package)
include collectd

if $facts['os']['family'] == 'RedHat' {
if $_manage_package {
if $manage_package {
package { 'collectd-amqp':
ensure => $ensure,
}
Expand Down
6 changes: 5 additions & 1 deletion spec/classes/collectd_plugin_amqp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
facts
end

let :pre_condition do
'include collectd'
end

options = os_specific_options(facts)
context ':ensure => present' do
let :params do
Expand Down Expand Up @@ -39,7 +43,7 @@
context 'overriding default parameters' do
let(:params) do
{ amqphost: 'myhost',
amqpport: '5666',
amqpport: 5666,
amqpvhost: 'amqp',
amqpuser: 'user',
amqppass: 'pass',
Expand Down
2 changes: 2 additions & 0 deletions types/amqp/format.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_amqp
type Collectd::Amqp::Format = Enum['Command', 'JSON', 'Graphite']

0 comments on commit 73f8303

Please sign in to comment.