Permalink
Browse files

Initial commit for project citellus.

  • Loading branch information...
rcernin committed Jun 11, 2017
0 parents commit fd5e56fbd946ba12aaef5e3776c341c4eab6b882
Showing with 375 additions and 0 deletions.
  1. +7 −0 README.md
  2. +93 −0 citellus
  3. +125 −0 load_functions
  4. +45 −0 osp-director.d/errors.conf
  5. 0 osp-director.d/heat.conf
  6. +33 −0 osp-director.d/hwreq.conf
  7. +72 −0 osp-director.d/tuning.conf
@@ -0,0 +1,7 @@
## Introduction
Citellus is a program that should help faster identify common pitfails of OpenStack deployments from sosreports.
### Usage
@@ -0,0 +1,93 @@
#!/bin/bash
# Copyright (C) 2017 Robin Cernin (rcernin@redhat.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# set -x
# Load all necessary functions
source load_functions
# Unset all variables that might be possibly set.
DIRECTORY=
DISCOVERED_NODE=
VERSION=
while :; do
case $1 in
-h|-\?|--help)
show_help
exit
;;
-d|--directory)
if [ -n "$2" ]; then
DIRECTORY=$2
shift
else
bad '"--directory" requires a non-empty option argument.' >&2
exit 1
fi
;;
--directory=?*)
DIRECTORY=${1#*=}
;;
--directory=)
bad '"--directory" requires a non-empty option argument.' >&2
exit 1
;;
--)
shift
break
;;
-?*)
bad "Unknown option: ${1}" >&2
exit 1
;;
*)
break
esac
shift
done
if [ ! -d "${DIRECTORY}" ]
then
bad "Uh, oh, ${DIRECTORY} is not directory."
exit 1
fi
echo "_________ .__ __ .__ .__ "
echo "\_ ___ \|__|/ |_ ____ | | | | __ __ ______"
echo "/ \ \/| \ __\/ __ \| | | | | | \/ ___/"
echo "\ \___| || | \ ___/| |_| |_| | /\___ \ "
echo " \______ /__||__| \___ >____/____/____//____ >"
echo " \/ \/ \/ "
# Here we are going to discover which node type [director,controller,compute] we
# are running against.
discover_node
get_version
echo "SOSreport was created at $(cat ${DIRECTORY}/date)"
echo "Hostname: $(cat ${DIRECTORY}/hostname)"
echo "Discovered node: ${DISCOVERED_NODE}"
echo "Version: ${VERSION}"
echo ""
# Go thru the all existing .conf files inside DISCOVERED_NODE.d directory/.
for FILE in ./"${DISCOVERED_NODE}".d/*.conf; do
[ -e "$FILE" ] || continue
source "$FILE"
done
@@ -0,0 +1,125 @@
#!/bin/bash
# Copyright (C) 2017 Robin Cernin (rcernin@redhat.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
show_help(){
# Show usage info
echo "_________ .__ __ .__ .__ "
echo "\_ ___ \|__|/ |_ ____ | | | | __ __ ______"
echo "/ \ \/| \ __\/ __ \| | | | | | \/ ___/"
echo "\ \___| || | \ ___/| |_| |_| | /\___ \ "
echo " \______ /__||__| \___ >____/____/____//____ >"
echo " \/ \/ \/ "
echo ""
echo "Usage: ${0##*/} [-h] [-d DIRECTORY]..."
echo "Do stuff with sosreport and write the result to standard output."
echo ""
echo " -h display this help and exit"
echo " -d sosreport-* opens a sosreport directory for analysis"
}
discover_node(){
# Check which node we are running against [director,controller,compute]
if grep -q "tripleo-heat-templates" "${DIRECTORY}/installed-rpms" && grep -q \
"python-tripleoclient" "${DIRECTORY}/installed-rpms"
then
# We have discovered this is with highest probability OSP-d
DISCOVERED_NODE="osp-director"
elif grep -q "nova-compute" "${DIRECTORY}/ps"
then
# We have discovered this is with highest probability compute node
DISCOVERED_NODE="compute"
else
# We have discovered this is with highest probability controller node
DISCOVERED_NODE="controller"
fi
}
get_version(){
# Check which version we are using
VERSION=$(grep "openstack-nova-common" "${DIRECTORY}/installed-rpms")
case ${VERSION} in
*12*) VERSION="Red Hat OpenStack Platform 8/Liberty" ;;
*13*) VERSION="Red Hat OpenStack Platform 9/Mitaka" ;;
*14*) VERSION="Red Hat OpenStack Platform 10/Newton" ;;
*15*) VERSION="Red Hat OpenStack Platform 11/Ocata" ;;
*16*) VERSION="Red Hat OpenStack Platform 12/Pike" ;;
*) echo "I don't recognize your version." ;;
esac
}
check_root(){
if [ ! "${USER}" = "root" ]
then
bad "You're not logged as root user. Who the hell are you, $USER?"
exit 1
fi
}
good(){
tput setaf 2
echo "[OK] ${1}"
tput sgr0
}
bad(){
tput setaf 1
echo "[WRONG] ${1}"
tput sgr0
}
miss(){
tput setaf 3
echo "[MISSING] ${1}"
tput sgr0
}
check_config(){
if grep -q "${2}.*=.*${3}" ${1} >/dev/null 2>&1
then
good "Checking value ${2} is set to ${3} in ${1}"
else
if [ -e "$1" ]
then
bad "Checking value ${2} is set to ${3} in ${1}"
else
miss "Missing ${1}"
fi
fi
}
grep_file(){
if grep -q "${2}" ${1} >/dev/null 2>&1
then
good "Checking ${2} is in ${1}"
else
bad "Checking ${2} is in ${1}"
fi
}
# vim: ts=2 sw=2 et
@@ -0,0 +1,45 @@
#!/bin/bash
# Copyright (C) 2017 Robin Cernin (rcernin@redhat.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Checking common ERRORS
# Ref: None
echo "+--------------------------------------------+"
echo "| Checking common ERRORS |"
echo "+--------------------------------------------+"
# Check for iptables -t nat -j REDIRECT rule for metadata server exists.
# Happens that when deployment is stuck without any FAILURE might be
# caused by this.
if iptables -vnL -t nat | grep -q "REDIRECT.*169.254.169.254"
then
good 'Checking "REDIRECT.*169.254.169.254" in iptables.'
else
bad 'Uh, oh, "REDIRECT.*169.254.169.254" rule missing.'
fi
# Check OpenStack services in undercloud are running and aren't failed
if systemctl list-units neutron* openstack* --no-pager --all| grep -q failed
then
bad "There are some failed openstack* neutron* services found in undercloud."
else
good "No failed openstack * neutron* services found in undercloud."
fi
No changes.
@@ -0,0 +1,33 @@
#!/bin/bash
# Copyright (C) 2017 Robin Cernin (rcernin@redhat.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Checking Hardware Requirements
# Ref: https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/8/html-single/director_installation_and_usage/#sect-Undercloud_Requirements
echo "+--------------------------------------------+"
echo "| Checking Hardware Requirements |"
echo "+--------------------------------------------+"
MEMTOTAL=$(cat "${DIRECTORY}"/proc/meminfo | sed -n -r -e 's/MemTotal:[ \t]+([0-9]+).*/\1/p')
if [[ ${MEMTOTAL} -ge 16268048 ]]
then
good "Memory is greater than or equal to 16GB"
else
bad "Uh, oh, undercloud requires at least 16GB of RAM"
fi
@@ -0,0 +1,72 @@
#!/bin/bash
# Copyright (C) 2017 Robin Cernin (rcernin@redhat.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Checking Tuned Undercloud options
# Ref: https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/8/html-single/director_installation_and_usage/#sect-Tuning_the_Undercloud
echo "+--------------------------------------------+"
echo "| Checking Tuning options |"
echo "+--------------------------------------------+"
# Checking /etc/heat/heat.conf
check_config "${DIRECTORY}/etc/heat/heat.conf" "max_resources_per_stack" "-1"
check_config "${DIRECTORY}/etc/heat/heat.conf" "num_engine_workers" "4"
# Checking /etc/my.cnf.d/server.cnf
# Number of simultaneous connections to the database. The recommended
# value is 4096.
check_config "${DIRECTORY}/etc/my.cnf.d/server.cnf" "max_connections" "4096"
# The size in bytes of a memory pool the database uses to store data
# dictionary information and other internal data structures. The default
# is usually 8M and an ideal value is 20M for the undercloud.
check_config "${DIRECTORY}/etc/my.cnf.d/server.cnf" "innodb_additional_mem_pool_size" "20M"
# The size in bytes of the buffer pool, the memory area where the
# database caches table and index data. The default is usually 128M and
# an ideal value is 1000M for the undercloud.
check_config "${DIRECTORY}/etc/my.cnf.d/server.cnf" "innodb_buffer_pool_size" "1000M"
# Controls the balance between strict ACID compliance for commit
# operations, and higher performance that is possible when commit-related
# I/O operations are rearranged and done in batches. Set to 1.
check_config "${DIRECTORY}/etc/my.cnf.d/server.cnf" "innodb_flush_log_at_trx_commit" "1"
# The length of time in seconds a database transaction waits for a row
# lock before giving up. Set to 50.
check_config "${DIRECTORY}/etc/my.cnf.d/server.cnf" "innodb_lock_wait_timeout" "50"
# This variable controls how to delay INSERT, UPDATE, and DELETE
# operations when purge operations are lagging. Set to 10000.
check_config "${DIRECTORY}/etc/my.cnf.d/server.cnf" "innodb_max_purge_lag" "10000"
# The limit of concurrent operating system threads. Ideally, provide at
# least two threads for each CPU and disk resource. For example, if
# using a quad-core CPU and a single disk, use 10 threads.
check_config ${DIRECTORY}"/etc/my.cnf.d/server.cnf" "innodb_thread_concurrency" "2"
# Crontab check
grep_file "${DIRECTORY}/var/spool/cron/keystone" "keystone-manage token_flush"
grep_file "${DIRECTORY}/var/spool/cron/heat" "heat-manage purge_deleted"
# Sometimes the director might not have enough resources to perform
# concurrent node provisioning. The default is 10 nodes at the same time.
# To reduce the number of concurrent nodes, set the max_concurrent_builds
# parameter in /etc/nova/nova.conf
check_config "${DIRECTORY}/etc/nova/nova.conf" "max_concurrent_builds" "5"

0 comments on commit fd5e56f

Please sign in to comment.