Browse Source

bind to VIP reserved for Zabbix instead of management VIP

do not overwrite initscripts with the network namespace support version
change compatible MOS version

Change-Id: I991d21b07d416720cf2225871e297fd039fa0950
Piotr Misiak 3 years ago
parent
commit
1e6fe34139

+ 0
- 16
deployment_scripts/puppet/manifests/primary_controller.pp View File

@@ -1,16 +0,0 @@
1
-#
2
-#    Copyright 2015 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
-include plugin_zabbix_snmptrapd::primary_controller

+ 2
- 0
deployment_scripts/puppet/modules/plugin_zabbix_snmptrapd/files/initscripts/snmpd View File

@@ -42,12 +42,14 @@ IP_BINARY="/sbin/ip"
42 42
 
43 43
 SNMPD_BINARY="/usr/sbin/snmpd"
44 44
 SNMPD_PID="/run/snmpd.pid"
45
+#run snmpd process in the following namespace:
45 46
 SNMPDNS="haproxy"
46 47
 SNMPDRUN="yes"
47 48
 SNMPDOPTS="-Lsd -Lf /dev/null -p $SNMPD_PID"
48 49
 
49 50
 TRAPD_BINARY="/usr/sbin/snmptrapd"
50 51
 TRAPD_PID="/run/snmptrapd.pid"
52
+#run snmptrapd process in the following namespace:
51 53
 TRAPDNS="haproxy"
52 54
 TRAPDRUN="no"
53 55
 TRAPDOPTS="-Lsd -p $TRAPD_PID"

+ 1
- 0
deployment_scripts/puppet/modules/plugin_zabbix_snmptrapd/files/initscripts/snmptrapd View File

@@ -40,6 +40,7 @@
40 40
 # source function library
41 41
 . /etc/init.d/functions
42 42
 
43
+#run service in the following network namespace:
43 44
 NS="haproxy"
44 45
 OPTIONS="-Lsd -p /var/run/snmptrapd.pid"
45 46
 if [ -e /etc/sysconfig/snmptrapd ]; then

+ 26
- 13
deployment_scripts/puppet/modules/plugin_zabbix_snmptrapd/manifests/init.pp View File

@@ -17,14 +17,17 @@ class plugin_zabbix_snmptrapd {
17 17
 
18 18
   include plugin_zabbix_snmptrapd::params
19 19
 
20
-  $service_name    = $plugin_zabbix_snmptrapd::params::service_name
21
-  $package_name    = $plugin_zabbix_snmptrapd::params::package_name
20
+  $service_name     = $plugin_zabbix_snmptrapd::params::service_name
21
+  $package_name     = $plugin_zabbix_snmptrapd::params::package_name
22 22
 
23
-  $server_ip       = hiera('management_vip')
24
-  $plugin_settings = hiera('zabbix_snmptrapd')
23
+  $plugin_settings  = hiera('zabbix_snmptrapd')
24
+
25
+  $network_metadata = hiera('network_metadata')
26
+  $server_ip        = $network_metadata['vips']['zabbix_vip_management']['ipaddr']
27
+  $server_port      = '162'
25 28
 
26 29
   class { 'snmp':
27
-    snmptrapdaddr       => ["udp:${server_ip}:162"],
30
+    snmptrapdaddr       => ["udp:${server_ip}:${server_port}"],
28 31
     ro_community        => $plugin_settings['community'],
29 32
     service_ensure      => 'stopped',
30 33
     trap_service_ensure => 'running',
@@ -32,16 +35,26 @@ class plugin_zabbix_snmptrapd {
32 35
     trap_handlers       => ['default /usr/sbin/snmptthandler'],
33 36
   }
34 37
 
35
-  file { "/etc/init.d/${service_name}":
36
-    ensure  => present,
37
-    owner   => 'root',
38
-    group   => 'root',
39
-    mode    => '0755',
40
-    source  => "puppet:///modules/plugin_zabbix_snmptrapd/initscripts/${service_name}",
41
-    require => Package[$package_name],
42
-    notify  => Service[$service_name],
38
+  firewall { '998 snmptrapd':
39
+    proto     => 'udp',
40
+    action    => 'accept',
41
+    port      => $server_port,
43 42
   }
44 43
 
44
+  # The following resource overwrites default initscript for snmptrapd.
45
+  # Version provided by the plugin supports namespaces.
46
+  # If there is a need to run snmptrad in a specific namespace,
47
+  # uncomment the following resource and put the correct namespace in the file.
48
+  #file { "/etc/init.d/${service_name}":
49
+  #  ensure  => present,
50
+  #  owner   => 'root',
51
+  #  group   => 'root',
52
+  #  mode    => '0755',
53
+  #  source  => "puppet:///modules/plugin_zabbix_snmptrapd/initscripts/${service_name}",
54
+  #  require => Package[$package_name],
55
+  #  notify  => Service[$service_name],
56
+  #}
57
+
45 58
   class { 'plugin_zabbix_snmptrapd::snmptt':
46 59
     require => Class['snmp'],
47 60
   }

+ 0
- 3
deployment_scripts/puppet/modules/plugin_zabbix_snmptrapd/manifests/params.pp View File

@@ -29,7 +29,4 @@ class plugin_zabbix_snmptrapd::params {
29 29
     }
30 30
   }
31 31
 
32
-  $zabbix_cs_name = 'p_zabbix-server'
33
-  $vip_cs_name = 'vip__management'
34
-
35 32
 }

+ 0
- 24
deployment_scripts/puppet/modules/plugin_zabbix_snmptrapd/manifests/primary_controller.pp View File

@@ -1,24 +0,0 @@
1
-#
2
-#    Copyright 2015 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
-class plugin_zabbix_snmptrapd::primary_controller {
17
-
18
-  include plugin_zabbix_snmptrapd::params
19
-
20
-  cs_group { 'g_zabbix':
21
-    primitives => [$plugin_zabbix_snmptrapd::params::vip_cs_name, $plugin_zabbix_snmptrapd::params::zabbix_cs_name],
22
-  }
23
-
24
-}

+ 4
- 4
metadata.yaml View File

@@ -6,9 +6,9 @@ version: 1.0.0
6 6
 # Description
7 7
 description: Gives ability to receive SNMP traps and pass them to Zabbix.
8 8
 # Required fuel version
9
-fuel_version: ['6.1']
9
+fuel_version: ['7.0']
10 10
 # Groups
11
-groups: []
11
+groups: ['monitoring']
12 12
 # Licenses
13 13
 licenses: ['Apache License, Version 2.0']
14 14
 # Homepage
@@ -19,12 +19,12 @@ authors: ['Dmitry Klenov <dklenov@mirantis.com>', 'Piotr Misiak <pmisiak@miranti
19 19
 # The plugin is compatible with releases in the list
20 20
 releases:
21 21
   - os: ubuntu
22
-    version: 2014.2-6.1
22
+    version: 2015.1.0-7.0
23 23
     mode: ['ha']
24 24
     deployment_scripts_path: deployment_scripts/
25 25
     repository_path: repositories/ubuntu
26 26
   - os: centos
27
-    version: 2014.2-6.1
27
+    version: 2015.1.0-7.0
28 28
     mode: ['ha']
29 29
     deployment_scripts_path: deployment_scripts/
30 30
     repository_path: repositories/centos

+ 3
- 3
pre_build_hook View File

@@ -25,9 +25,9 @@ function download {
25 25
     done
26 26
 }
27 27
 
28
-download rpm http://mirror.centos.org/centos/6/updates/x86_64/Packages/net-snmp-5.5-50.el6_6.1.x86_64.rpm \
29
-             http://mirror.centos.org/centos/6/updates/x86_64/Packages/net-snmp-libs-5.5-50.el6_6.1.x86_64.rpm \
30
-             http://mirror.centos.org/centos/6/updates/x86_64/Packages/net-snmp-perl-5.5-50.el6_6.1.x86_64.rpm \
28
+download rpm http://mirror.centos.org/centos/6/os/x86_64/Packages/net-snmp-5.5-54.el6.x86_64.rpm \
29
+             http://mirror.centos.org/centos/6/os/x86_64/Packages/net-snmp-libs-5.5-54.el6.x86_64.rpm \
30
+             http://mirror.centos.org/centos/6/os/x86_64/Packages/net-snmp-perl-5.5-54.el6.x86_64.rpm \
31 31
              http://mirror.centos.org/centos/6/os/x86_64/Packages/perl-Digest-HMAC-1.01-22.el6.noarch.rpm \
32 32
              http://mirror.centos.org/centos/6/os/x86_64/Packages/perl-Digest-SHA1-2.12-2.el6.x86_64.rpm \
33 33
              http://mirror.centos.org/centos/6/os/x86_64/Packages/perl-IO-stringy-2.110-10.1.el6.noarch.rpm \

+ 0
- 7
tasks.yaml View File

@@ -5,10 +5,3 @@
5 5
     puppet_manifest: puppet/manifests/controller.pp
6 6
     puppet_modules: puppet/modules:/etc/puppet/modules
7 7
     timeout: 1200
8
-- role: ['primary-controller']
9
-  stage: post_deployment/8115
10
-  type: puppet
11
-  parameters:
12
-    puppet_manifest: puppet/manifests/primary_controller.pp
13
-    puppet_modules: puppet/modules:/etc/puppet/modules
14
-    timeout: 1200

Loading…
Cancel
Save