Ask Your Question
0

Installing a package doesn't work. Template values don't get passed to the endpoint.

asked 2016-07-20 15:31:37 -0500

obdnanr gravatar image

updated 2016-07-25 00:26:45 -0500

ramindk gravatar image

I created my own module and there's multiple issues that I can't fix. I know there's modules in the forge for this, but I can't get any of them to work and I simply need the agent to install.
1) The zabbix-agent doesn't install, but sudo service zabbix-agent status shows it's running. ps aux | grep zabbix-agent shows no zabbix-agent processes. apt-get install zabbix-agent shows it's already installed.

2) The only thing that seems to work is the template gets pushed without the config variables being set in the node's yaml file. I've used <%= @server %>, etc for the variables

I've tried hard configuring the init.pp with values and it doesn't work either, because the agent isn't really installed??????

3) After hard coding the values a netstat -nap | grep 10050 shows it's not listening on port 10050 after hard coding it. The puppettest01.dollartree.com.yaml is setup as follows:

I have indentation done correctly but it's not formatting correctly here.

classes:
  - zabbixagent

zabbixagent:
  server: "10.10.10.10"
  port: '10050'
  serveractive: '10.10.10.10'
  zabhostname: 'server01'

init.pp is setup as follows.

class zabbixagent (
  $server       = '',
  $port         = '',
  $serveractive = '',
  $zabhostname  = '',
) {
  package { 'zabbix-agent':<
    ensure  => installed,
  }
  service { 'zabbix-agent':
    ensure  => running,
    enable  => true,
    require => Package['zabbix-agent'],
  }
  file { '/etc/zabbix/zabbix_agentd.conf':
    notify  => Service['zabbix-agent'],
    ensure  => present,
    content => template('zabbixagent/zabbix_agentd.conf.erb'),
  }
}
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-07-29 08:33:11 -0500

ddk gravatar image

updated 2016-11-14 03:43:25 -0500

Do you have the hash definition to pass the variables to the class? Else I don't think the values will be passed properly. Try to add one class called set.pp inside the module:

class zabbixagent::set {
    $zabbixagent_config = hiera_hash('zabbixagent',{})
    create_resources('zabbixagent',$zabbixagent_config)
}

In the hiera file, include zabbixagent::set instead:

classes:
  - zabbixagent::set
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2016-07-20 15:31:37 -0500

Seen: 98 times

Last updated: Nov 14 '16