dgolja / golja-influxdb

Puppet module for InfluxDB
Apache License 2.0
19 stars 73 forks source link

Is it possible to define more than one graphite database? (BUG) #39

Open mrh666 opened 8 years ago

mrh666 commented 8 years ago

Hi there,

Is it possible to define more than one graphite database? And if it is, what should be the syntax for graphite_options? I tried this code:

    graphite_options        => [ {
      'enabled'           => true,
      'database'          => 'graphite',
      'bind-address'      => ':2003',
      'protocol'          => tcp,
      'consistency-level' => 'one',
      'name-separator'    => '.',
      'batch-size'        => 1000,
      'batch-pending'     => 5,
      'batch-timeout'     => '1s',
      'udp-read-buffer'   => 0,
    },
    {
      'enabled'           => true,
      'database'          => 'graphite2',
      'bind-address'      => ':2011',
      'protocol'          => tcp,
      'consistency-level' => 'one',
      'name-separator'    => '.',
      'batch-size'        => 1000,
      'batch-pending'     => 5,
      'batch-timeout'     => '1s',
      'udp-read-buffer'   => 0,
    } ],

But I've got an error:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template influxdb/influxdb.conf.erb:
  Filepath: /etc/puppet/modules/influxdb/templates/influxdb.conf.erb
  Line: 128
  Detail: undefined method `key' for nil:NilClass
 at /etc/puppet/modules/influxdb/manifests/server/config.pp:96 on node influxdbnode-96jxf36fl7tdfn7
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Please advice. Thank you!

dgolja commented 8 years ago

what version of puppet you use ?

mrh666 commented 8 years ago

3.8.7

mrh666 commented 8 years ago

n1tr0g, I fixed template a little to make it work. It was (LINE 126-129):

<% @graphite_options.each do |option| -%>
[[graphite]]
<% @options.key.sort.each do |key| -%>
<% val = @options[key] 

And fix is:

<% @graphite_options.each do |option| -%>
[[graphite]]
<% option.keys.sort.each do |key| -%>
<% val = option[key] 

It it's correct I can commit with Pull Request.

dgolja commented 8 years ago

looks ok ... can you create an PR ?

mrh666 commented 8 years ago

@n1tr0g Of course! Done.

https://github.com/n1tr0g/golja-influxdb/pull/40