Add health check for services connected to RabbitMQ

- extended common lib with check for processes opening a specific ports
- added health check scripts for services which require to be connected
  to RabbitMQ server

Implements: blueprint container-healthchecks
Change-Id: I039b4f2bc9826bece6c382ac07e8fb2495fae924
This commit is contained in:
Martin Mágr 2017-07-18 09:57:59 +02:00
parent 23468032b3
commit b4327a4d3b
31 changed files with 417 additions and 1 deletions

View File

@ -16,4 +16,3 @@ want to run scripts without installing to that file, you can set the
$ ./heat-api
{"versions": [{"status": "CURRENT", "id": "v1.0", "links": [{"href": "http://192.168.24.1:8004/v1/", "rel": "self"}]}]}
300 192.168.24.1:8004 0.002 seconds

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='aodh-evaluator'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

14
healthcheck/aodh-listener Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='aodh-listener'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

14
healthcheck/aodh-notifier Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='aodh-notifier'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='ceilometer-polling'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='ceilometer-polling'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='ceilometer-agent-notification'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

14
healthcheck/cinder-backup Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='cinder-backup'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='cinder-scheduler'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

14
healthcheck/cinder-volume Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='cinder-volume'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -10,6 +10,17 @@ healthcheck_curl () {
"$@" || return 1
}
healthcheck_port () {
process=$1
shift 1
port_args=()
for arg in "$@"; do
port_args+=("-i" "tcp:${arg}")
done
lsof +c0 -nP "${port_args[@]}" | awk '{print $1}' | grep -q "^${process}$"
}
get_config_val () {
crudini --get "$1" "$2" "$3" 2> /dev/null || echo "$4"
}

14
healthcheck/heat-engine Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='heat-engine'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='ironic-conductor'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='manila-scheduler'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='mistral-server'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='mistral-server'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

14
healthcheck/neutron-dhcp Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='neutron-dhcp-agent'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

14
healthcheck/neutron-l3 Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='neutron-l3-agent'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='neutron-metadata-agent'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='neutron-openvswitch-agent'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

14
healthcheck/nova-compute Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='nova-compute'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='nova-conductor'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='nova-consoleauth'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

14
healthcheck/nova-ironic Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='nova-compute'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='nova-scheduler'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='nova-novncproxy'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='octavia-health-manager'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='octavia-housekeeping'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='octavia-worker'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

14
healthcheck/sahara-engine Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='sahara-engine'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

14
healthcheck/sensu-client Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/tripleo-common/healthcheck}/common.sh
process='sensu-client'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi