On Wednesday, 24 September 2014 14:08:30 UTC+1, jcbollinger wrote:
>
>
>
> On Wednesday, September 24, 2014 5:57:45 AM UTC-5, Danny Roberts wrote:
>>
>> Hi Folks,
>>
>> I've started writing a module for zabbix monitoring (current version 
>> here: https://github.com/kemra102/puppet-zabbix).
>>
>> I have a basic set-up to install the zabbix client using the module.
>>
>> There are some values I need to change for our environment so that the 
>> config works, in my case I'm trying to set the $zabbix::client_server 
>> variable via Hiera so it can be populated via template for the zabbix 
>> client.
>>
>> Currently I have this in *common.yaml*:
>>
>> zabbix::client_server: '10.0.0.1'
>>
>> As far as I know this should work fine and matches the Puppetlabs NTP 
>> module way of doing it (in this module we define our own NTP servers in 
>> Hiera to override the defaults just fine).
>>
>> However it doesn't seem to be getting set as one of the error checks I 
>> have in place is being triggered due to this value being missing.
>>
>
>
> Are you talking about these checks:
>
> class zabbix::client::service inherits zabbix::params {  
>   if ($client_startagents != '0' and $client_server == '') {  fail("Your 
> StartAgents cannot be greater than 0 or null when Server is also null. Set 
> StartAgents to 0 or set Server.")  }  if ($client_server == '' and 
> $client_serveractive == '') {  fail("You must set either passvie or 
> active (or both) checks via the Server or ServerActive options.")  }  
> [...]
> }
>
> Whether you are or not, I note that in that particular class the 
> unqualified name $client_server refers to $::zabbix::params::client_server 
> (via class inheritance).  If you were expecting the value from hiera then 
> you should be testing $::zabbix::client_server (and therefore that class 
> should 'include ::zabbix', or at minimum it should document that it relies 
> on some other class to have already done so).  Alternatively, you could 
> read the value from hiera by calling "hiera('zabbix::client_server', 
> $::zabbix::params::client_server)" to get exactly the same value that 
> $::zabbix::client_server gets.
>

I don't think I've articulated this too well. I know those checks work 
becuase for example if I hardcode an IP in params.pp for client_server then 
the check is passed and the config file updated and service started without 
error.

However for example in our production common.yaml we have:

ntp::servers: [ '0.uk.pool.ntp.org', '1.uk.pool.ntp.org', 
'2.uk.pool.ntp.org', '3.uk.pool.ntp.org' ]

This correctly modifies the ntp::params::servers variable.

I am trying to achieve the same thing with my zabbix module by having this 
in common.yaml:

zabbix::client_server: '10.0.0.1'

In order to modify the default value of zabbix::params::client_server

I've had a look through the Puppetlabs NTP code and it doesn't look like 
you have to do anything special in order to be able to overwrite variables 
in Hiera beyond what I have already done.
 

>  
>
>
>> Any ideas where the issue might lie? This is my first big piece of work 
>> doing a Puppet module in the more correct way so I may have missed 
>> something.
>>
>
>
> I suspect you are confused about variable scope.  I don't see any reason 
> to think that the problem is in your Hiera data.
>
>
> John
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/01d133df-8927-4e86-a934-edef32bbadee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to