voxpupuli / puppet-zabbix

Puppet module for creating and maintaining zabbix components with puppet.
https://forge.puppet.com/puppet/zabbix
Apache License 2.0
80 stars 229 forks source link

SSLparamters for web monitoring are only supported for zabbix version 2.4 #468

Open anotherfigo opened 6 years ago

anotherfigo commented 6 years ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

add parameters sslcertlocation_dir and/or sslkeylocation_dir (and/or sslcalocation) to wherever you call the server class

What are you seeing

The corresponding parameters are not added to zabbix_server.conf

What behaviour did you expect instead

The corresponding parameters are added to zabbix_server.conf

Output log

Any additional information you'd like to impart

As I understand this happens because of line 432 in zabbix_server.conf.erb https://github.com/voxpupuli/puppet-zabbix/blob/af5dd3838cfa36d376e2b262af5e110a3fc76f9c/templates/zabbix_server.conf.erb#L432

This should be something like the result of versioncmp($zabbix_version, '2.4') >=0 since these parameters are supported starting at version 2.4 of Zabbix Related zabbix documentation: https://www.zabbix.com/documentation/3.2/manual/web_monitoring

bastelfreak commented 6 years ago

Hi @anotherfigo, thanks for reporting this. Are you able to provide a PR for this?

anotherfigo commented 6 years ago

@bastelfreak Yes, I am trying to.

anotherfigo commented 6 years ago

But I've never used rspec before. Based on my basic knowledge with unit tests, I'd test it with a version 2.3 one 2.4 and one 2.5 to validate border values and of-by-ones. I guess testing if the parameters get written to zabbix_server.conf will be sufficient? So the code would be similar to this: is_expected.to contain_file('/etc/') \ .with_content(/^\s*parametername=$/)

But where should I put those tests to?

anotherfigo commented 6 years ago

Well, fixing is easy... its just <% if @zabbix_version.to_f >= 2.4 %> instead of https://github.com/voxpupuli/puppet-zabbix/blob/af5dd3838cfa36d376e2b262af5e110a3fc76f9c/templates/zabbix_server.conf.erb#L432

anotherfigo commented 6 years ago

Opened PR here: https://github.com/voxpupuli/puppet-zabbix/pull/469