Remove nagios deployment options

https://review.openstack.org/#/c/428752 added a deprecation note
for nagios in ocata cycle and warned about removal in pike.

This patch retires nagios deployment in packstack.

Change-Id: I4cbec69cf1137a4e16c972f181e982665400dc0b
This commit is contained in:
Alfredo Moralejo 2017-05-04 12:17:13 -04:00
parent f5716c9454
commit b08884d63e
20 changed files with 17 additions and 422 deletions

View File

@ -200,7 +200,6 @@ This is the current matrix of available tests:
| trove | | X | |
| horizon | X | | |
| manila | X | | |
| nagios | X | | |
| SSL | X | | |
To run these tests:

View File

@ -92,9 +92,6 @@ Global Options
**CONFIG_NTP_SERVERS**
Comma-separated list of NTP servers. Leave plain if Packstack should not install ntpd on instances.
**CONFIG_NAGIOS_INSTALL**
Specify 'y' to install Nagios to monitor OpenStack hosts. Nagios provides additional tools for monitoring the OpenStack environment. ['y', 'n']
**EXCLUDE_SERVERS**
Comma-separated list of servers to be excluded from the installation. This is helpful if you are running Packstack a second time with the same answer file and do not want Packstack to overwrite these server's configurations. Leave empty if you do not need to exclude any servers.
@ -1096,12 +1093,6 @@ Trove config parameters
**CONFIG_TROVE_NOVA_PW**
Password to use when OpenStack Database-as-a-Service connects to the Compute service.
Nagios Config parameters
------------------------
**CONFIG_NAGIOS_PW**
Password of the nagiosadmin user on the Nagios server.
Magnum Options
------------------------

View File

@ -817,7 +817,7 @@ def initCmdLineParser():
"if only a single host is supplied then it is setup as an all in one installation. An answerfile "
"will also be generated and should be used if Packstack needs to be run a second time ")
parser.add_option("--allinone", action="store_true", help="Shorthand for --install-hosts=<local ipaddr> --novanetwork-pubif=<dev> "
"--novacompute-privif=lo --novanetwork-privif=lo --os-swift-install=y --nagios-install=y "
"--novacompute-privif=lo --novanetwork-privif=lo --os-swift-install=y"
", this option can be used to install an all in one OpenStack on this host")
parser.add_option("-t", "--timeout", default=300, help="The timeout for puppet Exec calls")

View File

@ -1,111 +0,0 @@
# -*- coding: utf-8 -*-
# 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.
"""
Installs and configures Nagios
"""
from packstack.installer import basedefs
from packstack.installer import validators
from packstack.installer import processors
from packstack.installer import utils
from packstack.modules.documentation import update_params_usage
from packstack.modules.common import filtered_hosts
# ------------- Nagios Packstack Plugin Initialization --------------
PLUGIN_NAME = "OS-Nagios"
PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
def initConfig(controller):
params = [
{"CMD_OPTION": "nagios-passwd",
"PROMPT": "Enter the password for the nagiosadmin user",
"OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty],
"PROCESSORS": [processors.process_password],
"DEFAULT_VALUE": "PW_PLACEHOLDER",
"MASK_INPUT": True,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_NAGIOS_PW",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
]
update_params_usage(basedefs.PACKSTACK_DOC, params, sectioned=False)
group = {"GROUP_NAME": "NAGIOS",
"DESCRIPTION": "Nagios Config parameters",
"PRE_CONDITION": "CONFIG_NAGIOS_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def initSequences(controller):
if controller.CONF['CONFIG_NAGIOS_INSTALL'] != 'y':
return
nagiossteps = [
{'title': 'Preparing Nagios server entries',
'functions': [create_manifest]},
{'title': 'Preparing Nagios host entries',
'functions': [create_nrpe_manifests]}
]
controller.addSequence("Installing Nagios", [], [], nagiossteps)
# -------------------------- step functions --------------------------
def create_manifest(config, messages):
config['CONFIG_NAGIOS_NODES'] = list(filtered_hosts(config))
openstack_services = []
openstack_services.append('keystone-user-list')
if config['CONFIG_GLANCE_INSTALL'] == 'y':
openstack_services.append('glance-index')
if config['CONFIG_NOVA_INSTALL'] == 'y':
openstack_services.append('nova-list')
if config['CONFIG_CINDER_INSTALL'] == 'y':
openstack_services.append('cinder-list')
if config['CONFIG_SWIFT_INSTALL'] == 'y':
openstack_services.append('swift-list')
config['CONFIG_NAGIOS_SERVICES'] = openstack_services
def create_nrpe_manifests(config, messages):
for hostname in filtered_hosts(config):
config['CONFIG_NRPE_HOST'] = hostname
# Only the Nagios host is allowed to talk to nrpe
fw_details = dict()
key = "nagios_nrpe"
fw_details.setdefault(key, {})
fw_details[key]['host'] = "%s" % config['CONFIG_CONTROLLER_HOST']
fw_details[key]['service_name'] = "nagios-nrpe"
fw_details[key]['chain'] = "INPUT"
fw_details[key]['ports'] = ['5666']
fw_details[key]['proto'] = "tcp"
config['FIREWALL_NAGIOS_NRPE_RULES'] = fw_details
messages.append("To use Nagios, browse to "
"http://%(CONFIG_CONTROLLER_HOST)s/nagios "
"username: nagiosadmin, password: %(CONFIG_NAGIOS_PW)s"
% config)

View File

@ -356,23 +356,6 @@ def initConfig(controller):
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "nagios-install",
"PROMPT": (
"Should Packstack install Nagios to monitor OpenStack "
"hosts"
),
"OPTION_LIST": ["y", "n"],
"VALIDATORS": [validators.validate_options],
"DEFAULT_VALUE": 'n',
"MASK_INPUT": False,
"LOOSE_VALIDATION": False,
"CONF_NAME": "CONFIG_NAGIOS_INSTALL",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False,
"MESSAGE": "Nagios installation option is deprecated and will be removed from packstack in Pike.",
"MESSAGE_VALUES": ["y"]},
{"CMD_OPTION": "exclude-servers",
"PROMPT": (
"Enter a comma separated list of server(s) to be excluded."

View File

@ -1,40 +0,0 @@
class packstack::nagios::nrpe ()
{
create_resources(packstack::firewall, hiera('FIREWALL_NAGIOS_NRPE_RULES', {}))
$nagios_configs_cfg_ctrl_host = hiera('CONFIG_CONTROLLER_HOST')
package{ 'nrpe':
ensure => present,
} ->
file{ '/etc/nagios/nrpe.cfg':
ensure => file,
mode => '0644',
owner => 'nagios',
group => 'nagios',
require => Package['nrpe'],
} ->
file_line{'allowed_hosts':
path => '/etc/nagios/nrpe.cfg',
match => 'allowed_hosts=',
line => "allowed_hosts=${nagios_configs_cfg_ctrl_host}",
} ->
# 5 minute load average
file_line{'load5':
path => '/etc/nagios/nrpe.cfg',
match => 'command\[load5\]=',
line => 'command[load5]=cut /proc/loadavg -f 1 -d " "',
} ->
# disk used on /var
file_line{'df_var':
path => '/etc/nagios/nrpe.cfg',
match => 'command\[df_var\]=',
line => "command[df_var]=df /var/ | sed -re 's/.* ([0-9]+)%.*/\\1/' | grep -E '^[0-9]'",
} ->
service{'nrpe':
ensure => running,
enable => true,
hasstatus => true,
}
}

View File

@ -1,80 +0,0 @@
class packstack::nagios::server ()
{
$nagios_cfg_ks_adm_pw = hiera('CONFIG_KEYSTONE_ADMIN_PW')
$nagios_cfg_keystone_url = hiera('CONFIG_KEYSTONE_ADMIN_URL')
$keystone_admin_username = hiera('CONFIG_KEYSTONE_ADMIN_USERNAME')
package { ['nagios', 'nagios-plugins-nrpe']:
ensure => present,
} ->
class { 'packstack::nagios_config_wrapper':
nagios_hosts => hiera('CONFIG_NAGIOS_NODES'),
nagios_openstack_services => hiera('CONFIG_NAGIOS_SERVICES'),
controller_host => hiera('CONFIG_CONTROLLER_HOST'),
require => Package['nagios'],
notify => [Service['nagios'], Service['httpd']],
} ->
# We need to preferably install nagios-plugins-ping
exec { 'nagios-plugins-ping':
path => '/usr/bin',
command => 'yum install -y -d 0 -e 0 monitoring-plugins-ping',
onlyif => 'yum install -y -d 0 -e 0 nagios-plugins-ping &> /dev/null && exit 1 || exit 0',
} ->
file { ['/etc/nagios/nagios_command.cfg', '/etc/nagios/nagios_host.cfg', '/etc/nagios/nagios_service.cfg']:
ensure => file,
mode => '0644',
owner => 'nagios',
group => 'nagios',
} ->
# Remove the entry for localhost, it contains services we're not
# monitoring
file { ['/etc/nagios/objects/localhost.cfg']:
ensure => file,
content => '',
} ->
file_line { 'nagios_host':
path => '/etc/nagios/nagios.cfg',
line => 'cfg_file=/etc/nagios/nagios_host.cfg',
} ->
file_line { 'nagios_command':
path => '/etc/nagios/nagios.cfg',
line => 'cfg_file=/etc/nagios/nagios_command.cfg',
} ->
file_line { 'nagios_service':
path => '/etc/nagios/nagios.cfg',
line => 'cfg_file=/etc/nagios/nagios_service.cfg',
} ->
file { '/etc/nagios/keystonerc_admin':
ensure => file,
owner => 'nagios',
mode => '0600',
content => "export OS_USERNAME=${keystone_admin_username}
export OS_TENANT_NAME=admin
export OS_PASSWORD=${nagios_cfg_ks_adm_pw}
export OS_AUTH_URL=${nagios_cfg_keystone_url}",
}
$cfg_nagios_pw = hiera('CONFIG_NAGIOS_PW')
exec { 'nagiospasswd':
command => "/usr/bin/htpasswd -b /etc/nagios/passwd nagiosadmin ${cfg_nagios_pw}",
require => Package['nagios'],
before => Service['nagios'],
}
class { '::apache::mod::php': }
service { ['nagios']:
ensure => running,
enable => true,
hasstatus => true,
}
firewall { '001 nagios incoming':
proto => 'tcp',
dport => ['80'],
action => 'accept',
}
}

View File

@ -1,76 +0,0 @@
define packstack_nagios_host {
nagios_host { $name:
use => 'linux-server',
address => $name,
owner => 'nagios',
group => 'nagios',
mode => '0644',
}
}
define packstack_nagios_generic_services {
nagios_service { "load5-${name}":
check_command => 'check_nrpe!load5',
host_name => $name,
normal_check_interval => '5',
service_description => '5 minute load average',
use => 'generic-service',
owner => 'nagios',
group => 'nagios',
mode => '0644',
}
nagios_service { "df_var${name}":
check_command => 'check_nrpe!df_var',
host_name => $name,
service_description => 'Percent disk space used on /var',
use => 'generic-service',
owner => 'nagios',
group => 'nagios',
mode => '0644',
}
}
define packstack_nagios_services {
file { "/usr/lib64/nagios/plugins/${name}":
mode => '0755',
owner => 'nagios',
seltype => 'nagios_unconfined_plugin_exec_t',
content => template("packstack/${name}.erb"),
}
nagios_command { $name:
command_line => "/usr/lib64/nagios/plugins/${name}",
owner => 'nagios',
group => 'nagios',
mode => '0644',
}
nagios_service { $name:
host_name => $packstack::nagios_config_wrapper::controller_host,
normal_check_interval => '5',
check_command => $name,
use => 'generic-service',
service_description => "$name service",
owner => 'nagios',
group => 'nagios',
mode => '0644',
}
}
class packstack::nagios_config_wrapper (
$nagios_hosts = [],
$nagios_openstack_services = [],
$controller_host,
) {
nagios_command { 'check_nrpe':
command_line => '/usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$',
owner => 'nagios',
group => 'nagios',
mode => '0644',
}
packstack_nagios_host { $nagios_hosts: }
packstack_nagios_generic_services { $nagios_hosts: }
packstack_nagios_services { $nagios_openstack_services: }
}

View File

@ -1,14 +0,0 @@
#!/bin/env bash
. /etc/nagios/keystonerc_admin
data=$(cinder list --all-tenants 2>&1)
rv=$?
if [ "$rv" != "0" ] ; then
echo $data
exit $rv
fi
echo "$data" | grep -v -e '--------' -e ' Status ' | wc -l

View File

@ -1,13 +0,0 @@
#!/bin/env bash
. /etc/nagios/keystonerc_admin
data=$(glance image-list --member-status all 2>&1)
rv=$?
if [ "$rv" != "0" ] ; then
echo $data
exit $rv
fi
echo "$data" | grep -v -e "^ID " -e "---------------" | wc -l

View File

@ -1,13 +0,0 @@
#!/bin/env bash
. /etc/nagios/keystonerc_admin
data=$(openstack user list 2>&1)
rv=$?
if [ "$rv" != "0" ] ; then
echo $data
exit $rv
fi
echo "$data" | grep -v -e " id " -e "---------------" | wc -l

View File

@ -1,13 +0,0 @@
#!/bin/env bash
. /etc/nagios/keystonerc_admin
data=$(nova list 2>&1)
rv=$?
if [ "$rv" != "0" ] ; then
echo $data
exit $rv
fi
echo "$data" | grep -v -e '--------' -e '| Status |' -e '^$' | wc -l

View File

@ -1,14 +0,0 @@
#!/bin/env bash
. /etc/nagios/keystonerc_admin
data=$(swift list 2>&1)
rv=$?
if [ "$rv" != "0" ] ; then
echo $data
exit $rv
fi
echo "$data" |wc -l

View File

@ -57,7 +57,3 @@ if hiera('CONFIG_NEUTRON_INSTALL') == 'y' {
include '::packstack::neutron::sriov'
}
}
if hiera('CONFIG_NAGIOS_INSTALL') == 'y' {
include '::packstack::nagios::nrpe'
}

View File

@ -205,8 +205,3 @@ if hiera('CONFIG_SAHARA_INSTALL') == 'y' {
include '::packstack::sahara::ceilometer'
}
}
if hiera('CONFIG_NAGIOS_INSTALL') == 'y' {
include '::packstack::nagios::server'
include '::packstack::nagios::nrpe'
}

View File

@ -48,7 +48,3 @@ if hiera('CONFIG_NEUTRON_INSTALL') == 'y' {
include '::packstack::provision::bridge'
}
}
if hiera('CONFIG_NAGIOS_INSTALL') == 'y' {
include '::packstack::nagios::nrpe'
}

View File

@ -0,0 +1,13 @@
---
deprecations:
- |
The option to deploy nagios from packstack was
deprecated in Ocata release and it has been removed
in Pike. Following options have been retired:
* CONFIG_NAGIOS_INSTALL
* CONFIG_NAGIOS_PW
Note that CentOS OpsTools Special Interest Group provides
packages and automation tooling to deploy monitoring tools
and integrate them with RDO.

View File

@ -53,8 +53,7 @@ class CommandLineTestCase(PackstackTestCaseMixin, TestCase):
Test packstack.installer.run_setup.main
This test effectivly runs all of the python code ran by
packstack --install-hosts=127.0.0.1 --os-swift-install=y \
--nagios-install=y
packstack --install-hosts=127.0.0.1 --os-swift-install=y
It is a fairly wide net but boost code coverage of the packstack
python code to about 85%, more finer grained tests should also be
@ -102,8 +101,8 @@ class CommandLineTestCase(PackstackTestCaseMixin, TestCase):
sys.argv = ['packstack', '--debug',
'--ssh-public-key=%s' % dummy_public_key,
'--install-hosts=127.0.0.1', '--os-swift-install=y',
'--nagios-install=y', '--ssl-cacert-selfsign=y',
'--ssl-cert-dir=%s' % os.path.expanduser('~/')]
'--ssl-cacert-selfsign=y', '--ssl-cert-dir=%s' %
os.path.expanduser('~/')]
# There is no puppet logfile to validate, so replace
# ospluginutils.validate_puppet_logfile with a mock function

View File

@ -10,7 +10,6 @@ echo -e "Generating packstack config for:
- neutron (ovs+vxlan)
- cinder (lvm+iscsi)
- manila
- nagios
- tempest (regex: 'smoke')"
echo "tempest will run if packstack's installation completes successfully."
echo
@ -26,7 +25,6 @@ $SUDO packstack ${ADDITIONAL_ARGS} \
--os-swift-install=n \
--os-manila-install=y \
--os-horizon-ssl=y \
--nagios-install=y \
--amqp-enable-ssl=y \
--glance-backend=file \
--provision-uec-kernel-url="/tmp/cirros/cirros-0.3.4-x86_64-vmlinuz" \

View File

@ -26,7 +26,6 @@ $SUDO packstack ${ADDITIONAL_ARGS} \
--os-gnocchi-install=n \
--os-cinder-install=n \
--os-horizon-install=n \
--nagios-install=n \
--glance-backend=swift \
--os-neutron-lbaas-install=y \
--os-neutron-vpnaas-install=y \