Created
August 30, 2018 14:19
-
-
Save SimonHoenscheid/ea3eec0673ebc277cdfa58d3ee38cd64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hiera: | |
site_module::hit::telegraf::inputs: | |
'influxdb-dc': | |
plugin_type: 'influxdb' | |
input_options: | |
- 'urls': | |
- 'http://remote-dc:8086' | |
class site_module::hit::telegraf ( | |
$inputs = hiera('site_module::hit::telegraf::inputs', undef), | |
){ | |
# The module is documented very well so we use it like proposed (see README.md) | |
include ::telegraf | |
$inputs.each|$key, $value|{ | |
$input_name = $key | |
$plugin_type = $value['plugin_type'] | |
$input_options = $value['input_options'] | |
notify{"The value of input_name is: ${input_name}": } | |
notify{"The value of plugin_type is: ${plugin_type}": } | |
notify{"The value of input_options is: ${input_options}": } | |
# telegraf::input{ $input_name: | |
# plugin_type => $plugin_type, | |
# options => $plugin_options, | |
# } | |
} | |
$options = [{'urls' => ['http://remote-dc:8086',],},] | |
$i_name = 'influxdb-dc' | |
$p_type = 'influxdb' | |
notify{"The value of options is: ${options}": } | |
notify{"The value of i_name is: ${i_name}": } | |
notify{"The value of p_type is: ${p_type}": } | |
telegraf::input { $i_name: | |
plugin_type => $p_type, | |
options => $options, | |
} | |
} | |
Output Puppet: | |
Notice: The value of input_name is: influxdb-dc | |
Notice: /Stage[main]/Site_module::Hit::Telegraf/Notify[The value of input_name is: influxdb-dc]/message: defined 'message' as 'The value of input_name is: influxdb-dc' | |
Notice: The value of plugin_type is: influxdb | |
Notice: /Stage[main]/Site_module::Hit::Telegraf/Notify[The value of plugin_type is: influxdb]/message: defined 'message' as 'The value of plugin_type is: influxdb' | |
Notice: The value of input_options is: [{urls => [http://remote-dc:8086]}] | |
Notice: /Stage[main]/Site_module::Hit::Telegraf/Notify[The value of input_options is: [{urls => [http://remote-dc:8086]}]]/message: defined 'message' as 'The value of input_options is: [{urls => [http://remote-dc:8086]}]' | |
Notice: The value of options is: [{urls => [http://remote-dc:8086]}] | |
Notice: /Stage[main]/Site_module::Hit::Telegraf/Notify[The value of options is: [{urls => [http://remote-dc:8086]}]]/message: defined 'message' as 'The value of options is: [{urls => [http://remote-dc:8086]}]' | |
Notice: The value of i_name is: influxdb-dc | |
Notice: /Stage[main]/Site_module::Hit::Telegraf/Notify[The value of i_name is: influxdb-dc]/message: defined 'message' as 'The value of i_name is: influxdb-dc' | |
Notice: The value of p_type is: influxdb | |
Notice: /Stage[main]/Site_module::Hit::Telegraf/Notify[The value of p_type is: influxdb]/message: defined 'message' as 'The value of p_type is: influxdb' | |
Notice: Applied catalog in 8.71 seconds | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment