Merge "Add SNMP related packages"
This commit is contained in:
commit
59866c3fa0
|
@ -18,7 +18,8 @@ class plugin_zabbix_snmptrapd {
|
||||||
include plugin_zabbix_snmptrapd::params
|
include plugin_zabbix_snmptrapd::params
|
||||||
|
|
||||||
$service_name = $plugin_zabbix_snmptrapd::params::service_name
|
$service_name = $plugin_zabbix_snmptrapd::params::service_name
|
||||||
$package_name = $plugin_zabbix_snmptrapd::params::package_name
|
$daemon_pkg_name = $plugin_zabbix_snmptrapd::params::daemon_pkg_name
|
||||||
|
$utils_pkg_name = $plugin_zabbix_snmptrapd::params::utils_pkg_name
|
||||||
|
|
||||||
$plugin_settings = hiera('zabbix_snmptrapd')
|
$plugin_settings = hiera('zabbix_snmptrapd')
|
||||||
|
|
||||||
|
@ -41,6 +42,11 @@ class plugin_zabbix_snmptrapd {
|
||||||
port => $server_port,
|
port => $server_port,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
package { $utils_pkg_name:
|
||||||
|
ensure => 'present',
|
||||||
|
name => $utils_pkg_name,
|
||||||
|
}
|
||||||
|
|
||||||
# The following resource overwrites default initscript for snmptrapd.
|
# The following resource overwrites default initscript for snmptrapd.
|
||||||
# Version provided by the plugin supports namespaces.
|
# Version provided by the plugin supports namespaces.
|
||||||
# If there is a need to run snmptrad in a specific namespace,
|
# If there is a need to run snmptrad in a specific namespace,
|
||||||
|
@ -51,7 +57,7 @@ class plugin_zabbix_snmptrapd {
|
||||||
group => 'root',
|
group => 'root',
|
||||||
mode => '0755',
|
mode => '0755',
|
||||||
source => "puppet:///modules/plugin_zabbix_snmptrapd/initscripts/${service_name}",
|
source => "puppet:///modules/plugin_zabbix_snmptrapd/initscripts/${service_name}",
|
||||||
require => Package[$package_name],
|
require => [Package[$daemon_pkg_name], Package[$utils_pkg_name]],
|
||||||
notify => Service[$service_name],
|
notify => Service[$service_name],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,14 @@ class plugin_zabbix_snmptrapd::params {
|
||||||
|
|
||||||
case $::osfamily {
|
case $::osfamily {
|
||||||
'Debian': {
|
'Debian': {
|
||||||
$service_name = 'snmpd'
|
$service_name = 'snmpd'
|
||||||
$package_name = 'snmpd'
|
$daemon_pkg_name = 'snmpd'
|
||||||
|
$utils_pkg_name = 'snmp'
|
||||||
}
|
}
|
||||||
'RedHat': {
|
'RedHat': {
|
||||||
$service_name = 'snmptrapd'
|
$service_name = 'snmptrapd'
|
||||||
$package_name = 'net-snmp'
|
$daemon_pkg_name = 'net-snmp'
|
||||||
|
$utils_pkg_name = 'snmp'
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
fail("unsuported osfamily ${::osfamily}, currently Debian and RedHat are the only supported platforms")
|
fail("unsuported osfamily ${::osfamily}, currently Debian and RedHat are the only supported platforms")
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Copyright 2015 Mirantis, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
ROOT="$(dirname "$(readlink -f "$0")")"
|
||||||
|
MODULES_DIR="${ROOT}"/deployment_scripts/puppet/modules
|
||||||
|
RPM_REPO="${ROOT}"/repositories/centos/
|
||||||
|
DEB_REPO="${ROOT}"/repositories/ubuntu/
|
||||||
|
|
||||||
|
# Download RPM or DEB packages and store them in the local repository directory
|
||||||
|
function download_package {
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
if [[ "$1" == *.deb ]]; then
|
||||||
|
REPO=$DEB_REPO
|
||||||
|
elif [[ "$1" == *.rpm ]]; then
|
||||||
|
REPO=$RPM_REPO
|
||||||
|
else
|
||||||
|
echo "Invalid URL for download_package(): $1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
FILE=$(basename "$1")
|
||||||
|
wget -qO - "$1" > "$REPO"/"$FILE"
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Download official Puppet module and store it in the local directory
|
||||||
|
function download_puppet_module {
|
||||||
|
rm -rf "${MODULES_DIR:?}"/"$1"
|
||||||
|
mkdir -p "${MODULES_DIR}"/"$1"
|
||||||
|
wget -qO- "$2" | tar -C "${MODULES_DIR}/$1" --strip-components=1 -xz
|
||||||
|
}
|
||||||
|
|
|
@ -2,13 +2,17 @@
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
ROOT="$(dirname `readlink -f $0`)"
|
ROOT="$(dirname `readlink -f $0`)"
|
||||||
|
|
||||||
|
. "${ROOT}"/functions.sh
|
||||||
|
|
||||||
|
# Puppet manifests
|
||||||
|
# Dependency for SNMP
|
||||||
|
SNMP_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/razorsedge-snmp-3.3.1.tar.gz"
|
||||||
|
|
||||||
RPM_REPO="${ROOT}"/repositories/centos
|
RPM_REPO="${ROOT}"/repositories/centos
|
||||||
DEB_REPO="${ROOT}"/repositories/ubuntu
|
DEB_REPO="${ROOT}"/repositories/ubuntu
|
||||||
MODULES="${ROOT}"/deployment_scripts/puppet/modules
|
MODULES="${ROOT}"/deployment_scripts/puppet/modules
|
||||||
SNMP_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/razorsedge-snmp-3.3.1.tar.gz"
|
mkdir -p $RPM_REPO $DEB_REPO
|
||||||
mkdir -p $RPM_REPO
|
|
||||||
mkdir -p $DEB_REPO
|
|
||||||
mkdir -p $MODULES
|
|
||||||
|
|
||||||
# Downloads needed RPM or DEB packages
|
# Downloads needed RPM or DEB packages
|
||||||
function download {
|
function download {
|
||||||
|
@ -25,7 +29,11 @@ function download {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
#download snmp module
|
download deb http://archive.ubuntu.com/ubuntu/pool/universe/n/net-snmp/libsnmp-perl_5.7.2~dfsg-8.1ubuntu3.1_amd64.deb \
|
||||||
mkdir -p "${MODULES}/snmp"
|
http://archive.ubuntu.com/ubuntu/pool/main/n/net-snmp/snmpd_5.7.2~dfsg-8.1ubuntu3.1_amd64.deb \
|
||||||
wget -qO- "${SNMP_TARBALL_URL}" | tar -C "${MODULES}/snmp" --strip-components=1 -xz
|
http://archive.ubuntu.com/ubuntu/pool/main/n/net-snmp/snmp_5.7.2~dfsg-8.1ubuntu3.1_amd64.deb \
|
||||||
|
http://archive.ubuntu.com/ubuntu/pool/universe/s/snmptt/snmptt_1.4-1_all.deb
|
||||||
|
|
||||||
|
|
||||||
|
# Install puppet manifests
|
||||||
|
download_puppet_module "snmp" "$SNMP_TARBALL_URL"
|
||||||
|
|
Loading…
Reference in New Issue