Add SNMP related packages
Change-Id: I1c5c569564e63673909695c1c21b41acf474cccc
This commit is contained in:
parent
704cd71252
commit
c179e925cb
|
@ -18,7 +18,8 @@ class plugin_zabbix_snmptrapd {
|
|||
include plugin_zabbix_snmptrapd::params
|
||||
|
||||
$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')
|
||||
|
||||
|
@ -41,6 +42,11 @@ class plugin_zabbix_snmptrapd {
|
|||
port => $server_port,
|
||||
}
|
||||
|
||||
package { $utils_pkg_name:
|
||||
ensure => 'present',
|
||||
name => $utils_pkg_name,
|
||||
}
|
||||
|
||||
# The following resource overwrites default initscript for snmptrapd.
|
||||
# Version provided by the plugin supports namespaces.
|
||||
# If there is a need to run snmptrad in a specific namespace,
|
||||
|
@ -51,7 +57,7 @@ class plugin_zabbix_snmptrapd {
|
|||
group => 'root',
|
||||
mode => '0755',
|
||||
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],
|
||||
}
|
||||
|
||||
|
|
|
@ -17,12 +17,14 @@ class plugin_zabbix_snmptrapd::params {
|
|||
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
$service_name = 'snmpd'
|
||||
$package_name = 'snmpd'
|
||||
$service_name = 'snmpd'
|
||||
$daemon_pkg_name = 'snmpd'
|
||||
$utils_pkg_name = 'snmp'
|
||||
}
|
||||
'RedHat': {
|
||||
$service_name = 'snmptrapd'
|
||||
$package_name = 'net-snmp'
|
||||
$service_name = 'snmptrapd'
|
||||
$daemon_pkg_name = 'net-snmp'
|
||||
$utils_pkg_name = 'snmp'
|
||||
}
|
||||
default: {
|
||||
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
|
||||
|
||||
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
|
||||
DEB_REPO="${ROOT}"/repositories/ubuntu
|
||||
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
|
||||
mkdir -p $DEB_REPO
|
||||
mkdir -p $MODULES
|
||||
mkdir -p $RPM_REPO $DEB_REPO
|
||||
|
||||
# Downloads needed RPM or DEB packages
|
||||
function download {
|
||||
|
@ -25,7 +29,11 @@ function download {
|
|||
done
|
||||
}
|
||||
|
||||
#download snmp module
|
||||
mkdir -p "${MODULES}/snmp"
|
||||
wget -qO- "${SNMP_TARBALL_URL}" | tar -C "${MODULES}/snmp" --strip-components=1 -xz
|
||||
download deb http://archive.ubuntu.com/ubuntu/pool/universe/n/net-snmp/libsnmp-perl_5.7.2~dfsg-8.1ubuntu3.1_amd64.deb \
|
||||
http://archive.ubuntu.com/ubuntu/pool/main/n/net-snmp/snmpd_5.7.2~dfsg-8.1ubuntu3.1_amd64.deb \
|
||||
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