Browse Source

Merge "Fix Zabbix server 2.2 configuration file"

Jenkins 1 year ago
parent
commit
b0232cdf48

+ 36
- 0
deployment_scripts/puppet/modules/plugin_zabbix/lib/facter/check_zabbix_version.rb View File

@@ -0,0 +1,36 @@
1
+#
2
+#    Copyright 2017 Mirantis, Inc.
3
+#
4
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
5
+#    not use this file except in compliance with the License. You may obtain
6
+#    a copy of the License at
7
+#
8
+#         http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+#    Unless required by applicable law or agreed to in writing, software
11
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+#    License for the specific language governing permissions and limitations
14
+#    under the License.
15
+#
16
+
17
+# check_zabbix_version.rb
18
+
19
+Facter.add("check_zabbix_version") do
20
+  setcode do
21
+    qcmd = "/usr/bin/apt-cache"
22
+    if FileTest.exists?(qcmd) then
23
+      q = qcmd + ' policy zabbix-agent 2>/dev/null'
24
+      filter = "egrep 'Installed:|Candidate:' | grep -v 'Installed: (none)' | head -1"
25
+      parse = 'cut -d " " -f4 | cut -d: -f2 | cut -d. -f1,2'
26
+      res = Facter::Util::Resolution.exec(q + '|' + filter + '|' + parse)
27
+      if res.nil? then
28
+        '100.0'
29
+      else
30
+        res
31
+      end
32
+    else
33
+      '100.0'
34
+    end
35
+  end
36
+end

+ 7
- 0
deployment_scripts/puppet/modules/plugin_zabbix/manifests/params.pp View File

@@ -17,6 +17,7 @@ class plugin_zabbix::params {
17 17
 
18 18
   include plugin_zabbix::params::openstack
19 19
 
20
+  $zabbix_version = $::check_zabbix_version
20 21
   $zabbix_hash = hiera('zabbix_monitoring')
21 22
   $network_metadata = hiera('network_metadata')
22 23
   $ssl = hiera('public_ssl')
@@ -26,6 +27,12 @@ class plugin_zabbix::params {
26 27
   $zabbix_base_run_dir = '/var/run/zabbix'
27 28
   $zabbix_base_log_dir = '/var/log/zabbix'
28 29
 
30
+  if versioncmp($zabbix_version, '2.4') < 0 {
31
+    $zabbix_includes = $zabbix_extra_conf_dir
32
+  } else {
33
+    $zabbix_includes = "${zabbix_extra_conf_dir}/*.conf"
34
+  }
35
+
29 36
   $zabbix_ports = {
30 37
     server         => '10051',
31 38
     agent          => '10049',

+ 1
- 1
deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix_server.conf.erb View File

@@ -89,7 +89,7 @@ DebugLevel=3
89 89
 Timeout=5
90 90
 
91 91
 # Optional SNMP & others Zabbix extra modules specific configuration
92
-Include=<%= scope.lookupvar('plugin_zabbix::params::zabbix_extra_conf_dir') %>/*.conf
92
+Include=<%= scope.lookupvar('plugin_zabbix::params::zabbix_includes') %>
93 93
 
94 94
 # Specifies how many seconds trapper may spend processing new data
95 95
 # Must be between 1 and 30

Loading…
Cancel
Save