From b771f8b7fdfa425c7a0b320e9ce8dbebd0556de9 Mon Sep 17 00:00:00 2001 From: David Hartley Date: Mon, 6 May 2019 16:16:51 +1000 Subject: [PATCH 1/2] Added conversion parameter to the metric class --- lib/puppet/type/snmpcollector_metric.rb | 8 +++++++- lib/puppet_x/snmpcollector/mapping.rb | 6 ++++-- manifests/metric.pp | 9 ++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/puppet/type/snmpcollector_metric.rb b/lib/puppet/type/snmpcollector_metric.rb index 4203dac..ecd8425 100644 --- a/lib/puppet/type/snmpcollector_metric.rb +++ b/lib/puppet/type/snmpcollector_metric.rb @@ -51,4 +51,10 @@ desc 'Additional Data.' defaultto '' end -end \ No newline at end of file + + newproperty(conversion) do + desc 'Conversion value' + defaultto 0 + end +end + diff --git a/lib/puppet_x/snmpcollector/mapping.rb b/lib/puppet_x/snmpcollector/mapping.rb index 43c6fed..b8424fd 100644 --- a/lib/puppet_x/snmpcollector/mapping.rb +++ b/lib/puppet_x/snmpcollector/mapping.rb @@ -66,7 +66,8 @@ def self.metric 'scale' => 'Scale', 'shift' => 'Shift', 'is_tag' => 'IsTag', - 'extra_data' => 'ExtraData',} + 'extra_data' => 'ExtraData', + 'conversion' => 'Conversion',} end def self.measurement @@ -101,4 +102,5 @@ def self.measurement_filter 'description' => 'Description',} end end -end \ No newline at end of file +end + diff --git a/manifests/metric.pp b/manifests/metric.pp index d535468..6d22670 100644 --- a/manifests/metric.pp +++ b/manifests/metric.pp @@ -8,7 +8,8 @@ Integer $scale = 0, Integer $shift = 0, Boolean $is_tag = false, - String $extra_data = '' + String $extra_data = '', + Integer $conversion = 0 ) { include snmpcollector::reload @@ -25,6 +26,8 @@ scale => $scale, shift => $shift, is_tag => $is_tag, - extra_data => $extra_data + extra_data => $extra_data, + conversion => $conversion } ~> Class['snmpcollector::reload'] -} \ No newline at end of file +} + From 64cdf7716da416c01a8267f42199671c20b61b30 Mon Sep 17 00:00:00 2001 From: hewisaurus Date: Mon, 6 May 2019 17:05:35 +1000 Subject: [PATCH 2/2] Update snmpcollector_metric.rb --- lib/puppet/type/snmpcollector_metric.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/type/snmpcollector_metric.rb b/lib/puppet/type/snmpcollector_metric.rb index ecd8425..45f2cc8 100644 --- a/lib/puppet/type/snmpcollector_metric.rb +++ b/lib/puppet/type/snmpcollector_metric.rb @@ -52,7 +52,7 @@ defaultto '' end - newproperty(conversion) do + newproperty(:conversion) do desc 'Conversion value' defaultto 0 end