From 974383db6c76ce549b659a9e9781c70a46a3d3ee Mon Sep 17 00:00:00 2001 From: Braxton Schafer Date: Thu, 29 Oct 2020 16:15:34 -0500 Subject: [PATCH 1/2] Fix $hostinterfaceitem to not be an Fqdn. As per the upstream documentation (https://www.zabbix.com/documentation/5.0/manual/appendix/config/zabbix_agentd), hostinterfaceitem should be a Zabbix item and NOT an FQDN. Closes #725 --- manifests/agent.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/agent.pp b/manifests/agent.pp index 0dd43bb09..dd2a16488 100644 --- a/manifests/agent.pp +++ b/manifests/agent.pp @@ -275,7 +275,7 @@ $hostmetadata = $zabbix::params::agent_hostmetadata, $hostmetadataitem = $zabbix::params::agent_hostmetadataitem, Optional[Stdlib::Fqdn] $hostinterface = $zabbix::params::agent_hostinterface, - Optional[Stdlib::Fqdn] $hostinterfaceitem = $zabbix::params::agent_hostinterfaceitem, + $hostinterfaceitem = $zabbix::params::agent_hostinterfaceitem, $refreshactivechecks = $zabbix::params::agent_refreshactivechecks, $buffersend = $zabbix::params::agent_buffersend, $buffersize = $zabbix::params::agent_buffersize, From 7d9e0830a59030b1507d1a927666f2a4101b44e1 Mon Sep 17 00:00:00 2001 From: Braxton Schafer Date: Tue, 23 Mar 2021 11:43:53 -0500 Subject: [PATCH 2/2] set parameter type on $hostnameitem add test to fail if hostinterfaceitem is set to fqdn --- manifests/agent.pp | 2 +- spec/classes/agent_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/manifests/agent.pp b/manifests/agent.pp index 8134c000c..0d1e36645 100644 --- a/manifests/agent.pp +++ b/manifests/agent.pp @@ -275,7 +275,7 @@ Stdlib::Ensure::Service $service_ensure = $zabbix::params::agent_service_ensure, Boolean $service_enable = $zabbix::params::agent_service_enable, $hostname = $zabbix::params::agent_hostname, - $hostnameitem = $zabbix::params::agent_hostnameitem, + Optional[String[1]] $hostnameitem = $zabbix::params::agent_hostnameitem, $hostmetadata = $zabbix::params::agent_hostmetadata, $hostmetadataitem = $zabbix::params::agent_hostmetadataitem, Optional[Stdlib::Fqdn] $hostinterface = $zabbix::params::agent_hostinterface, diff --git a/spec/classes/agent_spec.rb b/spec/classes/agent_spec.rb index 7e69ab5d2..de46e046c 100644 --- a/spec/classes/agent_spec.rb +++ b/spec/classes/agent_spec.rb @@ -154,6 +154,16 @@ it { is_expected.to contain_file(config_path).with_content %r{^HostInterfaceItem=system.hostname$} } end + context 'configuration file with hostinterfaceitem set to fqdn' do + let :params do + { + hostinterfaceitem: 'zabbix.example.com' + } + end + + it { is_expected.to compile.and_raise_error(%r{.*}) } + end + context 'configuration file with hostinterface' do let :params do {