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.
> 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/f5cc811e-b922-402c-a0cb-9006d02d3065%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.