Fix formatting options

Fix tabs<->spaces and other bashate complains
	Change mode to +x to scripts missing it
	Force shell to be /bin/bash for compatibility

Change-Id: Ied5979f2d886c15b273956a9828d9e0484368bab
Signed-off-by: Pablo Iranzo Gómez <Pablo.Iranzo@gmail.com>
This commit is contained in:
Pablo Iranzo Gómez 2018-08-30 00:26:49 +02:00
parent fc1f301f26
commit 37a5c78673
No known key found for this signature in database
GPG Key ID: 034823665BD8E1E4
73 changed files with 290 additions and 289 deletions

View File

@ -1,7 +1,7 @@
# Health check commands
The scripts in this directory are meant to implement the
[container-healthcheck][] blueprint. They are written to be compatible
[container-healthcheck][] blueprint. They are written to be compatible
with the Docker [HEALTHCHECK][] api.
[container-healthcheck]: https://blueprints.launchpad.net/tripleo/+spec/container-healthchecks
@ -12,7 +12,7 @@ The scripts expect to source
want to run scripts without installing to that file, you can set the
`HEALTHCHECKS_DIR` environment variable, e.g:
$ export HEALTHCHECKS_DIR=$PWD
$ ./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
$ export HEALTHCHECKS_DIR=$PWD
$ ./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

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -6,9 +6,9 @@ process='aodh-evaluator'
args="${@:-6379}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened Redis ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened Redis ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='aodh-listener'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='aodh-notifier'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -6,9 +6,9 @@ process='barbican-keystone-listener'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='barbican-worker'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='ceilometer-polling'
args="${@:-6379}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened Redis ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened Redis ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='ceilometer-polling'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='ceilometer-polling'
args="${@:-6379}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened Redis ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened Redis ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='ceilometer-agent-notification'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -6,9 +6,9 @@ process='cinder-backup'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='cinder-scheduler'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='cinder-volume'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

97
healthcheck/common.sh Normal file → Executable file
View File

@ -1,55 +1,56 @@
#!/bin/bash
: ${HEALTHCHECK_CURL_MAX_TIME:=10}
: ${HEALTHCHECK_CURL_USER_AGENT:=curl-healthcheck}
: ${HEALTHCHECK_CURL_WRITE_OUT:='\n%{http_code} %{remote_ip}:%{remote_port} %{time_total} seconds\n'}
healthcheck_curl () {
curl -g -k -q --fail \
--max-time "${HEALTHCHECK_CURL_MAX_TIME}" \
--user-agent "${HEALTHCHECK_CURL_USER_AGENT}" \
--write-out "${HEALTHCHECK_CURL_WRITE_OUT}" \
"$@" || return 1
curl -g -k -q --fail \
--max-time "${HEALTHCHECK_CURL_MAX_TIME}" \
--user-agent "${HEALTHCHECK_CURL_USER_AGENT}" \
--write-out "${HEALTHCHECK_CURL_WRITE_OUT}" \
"$@" || return 1
}
healthcheck_port () {
process=$1
process=$1
# ss truncate command name to 15 characters and this behaviour
# cannot be disabled
if [ ${#process} -gt 15 ] ; then
process=${process:0:15}
fi
# ss truncate command name to 15 characters and this behaviour
# cannot be disabled
if [ ${#process} -gt 15 ] ; then
process=${process:0:15}
fi
shift 1
args=$@
ports=${args// /|}
ss -ntp | awk '{print $5,"-",$6}' | egrep ":($ports)" | grep "$process"
shift 1
args=$@
ports=${args// /|}
ss -ntp | awk '{print $5,"-",$6}' | egrep ":($ports)" | grep "$process"
}
healthcheck_listen () {
process=$1
process=$1
# ss truncate command name to 15 characters and this behaviour
# cannot be disabled
if [ ${#process} -gt 15 ] ; then
process=${process:0:15}
fi
# ss truncate command name to 15 characters and this behaviour
# cannot be disabled
if [ ${#process} -gt 15 ] ; then
process=${process:0:15}
fi
shift 1
args=$@
ports=${args// /|}
ss -lnp | awk '{print $5,"-",$7}' | egrep ":($ports)" | grep "$process"
shift 1
args=$@
ports=${args// /|}
ss -lnp | awk '{print $5,"-",$7}' | egrep ":($ports)" | grep "$process"
}
healthcheck_socket () {
process=$1
socket=$2
process=$1
socket=$2
# lsof truncate command name to 15 characters and this behaviour
# cannot be disabled
if [ ${#process} -gt 15 ] ; then
process=${process:0:15}
fi
lsof -Fc -Ua $socket | grep "c$process"
# lsof truncate command name to 15 characters and this behaviour
# cannot be disabled
if [ ${#process} -gt 15 ] ; then
process=${process:0:15}
fi
lsof -Fc -Ua $socket | grep "c$process"
}
healthcheck_file_modification () {
@ -60,27 +61,27 @@ healthcheck_file_modification () {
last_mod=$(stat -c '%Y' $file_path)
limit_epoch=$(( curr_time-limit_seconds ))
if [ "$limit_epoch" -gt "$last_mod" ]; then
return 1
return 1
fi
}
get_config_val () {
crudini --get "$1" "$2" "$3" 2> /dev/null || echo "$4"
crudini --get "$1" "$2" "$3" 2> /dev/null || echo "$4"
}
# apachectl -S is slightly harder to parse and doesn't say if the vhost is serving SSL
get_url_from_vhost () {
vhost_file=$1
server_name=$(awk '/ServerName/ {print $2}' $vhost_file)
ssl_enabled=$(awk '/SSLEngine/ {print $2}' $vhost_file)
bind_port=$(grep -h "<VirtualHost .*>" $vhost_file | sed 's/<VirtualHost .*:\(.*\)>/\1/')
wsgi_alias=$(awk '/WSGIScriptAlias/ {print $2}' $vhost_file)
proto=http
if [[ $ssl_enabled == "on" ]]; then
proto=https
fi
if [[ $wsgi_alias != "/" ]]; then
wsgi_alias="${wsgi_alias}/"
fi
echo ${proto}://${server_name}:${bind_port}${wsgi_alias}
vhost_file=$1
server_name=$(awk '/ServerName/ {print $2}' $vhost_file)
ssl_enabled=$(awk '/SSLEngine/ {print $2}' $vhost_file)
bind_port=$(grep -h "<VirtualHost .*>" $vhost_file | sed 's/<VirtualHost .*:\(.*\)>/\1/')
wsgi_alias=$(awk '/WSGIScriptAlias/ {print $2}' $vhost_file)
proto=http
if [[ $ssl_enabled == "on" ]]; then
proto=https
fi
if [[ $wsgi_alias != "/" ]]; then
wsgi_alias="${wsgi_alias}/"
fi
echo ${proto}://${server_name}:${bind_port}${wsgi_alias}
}

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
@ -6,7 +6,7 @@ bind_host=$(get_config_val /etc/glance/glance-api.conf DEFAULT bind_host 127.0.0
bind_port=$(get_config_val /etc/glance/glance-api.conf DEFAULT bind_port 9292)
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
bind_host="[${bind_host}]"
fi
# glance-api is still eventlet
healthcheck_curl http://${bind_host}:${bind_port}/

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -6,9 +6,9 @@ process='gnocchi-metricd'
args="${@:-6379}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened Redis ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened Redis ports ($ports) running in the container"
exit 1
fi

View File

@ -6,6 +6,6 @@ process='gnocchi-statsd'
bind_port=$(get_config_val /etc/gnocchi/gnocchi.conf statsd port 8125)
if ! healthcheck_listen $process $bind_port; then
echo "There is no $process process listening on ports $bind_port in the container."
exit 1
echo "There is no $process process listening on ports $bind_port in the container."
exit 1
fi

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -6,9 +6,9 @@ process='heat-engine'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -1,10 +1,10 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
check_url=$(get_url_from_vhost /etc/httpd/conf.d/10-horizon_vhost.conf)
if healthcheck_curl ${check_url}; then
exit 0
exit 0
else
healthcheck_curl $(get_url_from_vhost /etc/httpd/conf.d/10-horizon_ssl_vhost.conf)
healthcheck_curl $(get_url_from_vhost /etc/httpd/conf.d/10-horizon_ssl_vhost.conf)
fi

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -6,9 +6,9 @@ process='ironic-conductor'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -1,16 +1,16 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
if grep "/httpd " /run_command ; then
bind_host=127.0.0.1
bind_port=$(grep "^Listen " /etc/httpd/conf.d/10-ipxe_vhost.conf | awk '{print $2}')
protocol=http
path=
bind_host=127.0.0.1
bind_port=$(grep "^Listen " /etc/httpd/conf.d/10-ipxe_vhost.conf | awk '{print $2}')
protocol=http
path=
else
bind_host=$(ps -ef | grep -oe '--address \([0-9]\+\.\?\)\+' | awk '{print $2}')
bind_port=69
protocol=tftp
path=map-file
bind_host=$(ps -ef | grep -oe '--address \([0-9]\+\.\?\)\+' | awk '{print $2}')
bind_port=69
protocol=tftp
path=map-file
fi
healthcheck_curl ${protocol}://${bind_host}:${bind_port}/${path}

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -6,9 +6,9 @@ process='manila-scheduler'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
GALERA_XINETD_CONF='/etc/xinetd.d/galera-monitor'
@ -6,11 +6,11 @@ GALERA_XINETD_CONF='/etc/xinetd.d/galera-monitor'
# If the mariadb container is running xinetd with galera-monitor then it is a
# clustercheck container, otherwise a mysql/mariadb one
if pgrep xinetd &> /dev/null && grep -qe 'disable.*no' $GALERA_XINETD_CONF; then
PORT=$(awk '/port.*=/{ print $3 }' $GALERA_XINETD_CONF)
ADDR=$(awk '/bind.*=/{ print $3 }' $GALERA_XINETD_CONF)
bind_host=${ADDR:-$(hostname)}
bind_port=${PORT:-9200}
healthcheck_curl http://${bind_host}:${bind_port}/
PORT=$(awk '/port.*=/{ print $3 }' $GALERA_XINETD_CONF)
ADDR=$(awk '/bind.*=/{ print $3 }' $GALERA_XINETD_CONF)
bind_host=${ADDR:-$(hostname)}
bind_port=${PORT:-9200}
healthcheck_curl http://${bind_host}:${bind_port}/
else
mysql -e 'select 1' || exit 1
mysql -e 'select 1' || exit 1
fi

View File

@ -4,7 +4,7 @@ listen_addr=$(awk 'match($0, /-l +([0-9a-fA-F\.\:]+) /, a) {print a[1]}' /etc/sy
# Add brackets if IPv6
if [[ $listen_addr =~ ":" ]]; then
listen_addr="[${listen_addr}]"
listen_addr="[${listen_addr}]"
fi
echo "stats" | socat - TCP:$listen_addr:11211

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -6,9 +6,9 @@ process='mistral-server'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='mistral-server'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='mistral-server'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
@ -7,7 +7,7 @@ bind_port=$(get_config_val /etc/neutron/neutron.conf DEFAULT bind_port 9696)
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
bind_host="[${bind_host}]"
fi
healthcheck_curl http://${bind_host}:${bind_port}/

View File

@ -6,9 +6,9 @@ process='neutron-dhcp-agent'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='neutron-l3-agent'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='neutron-metadata-agent'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='neutron-openvswitch-agent'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='neutron-sriov-nic-agent'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process connected via RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process connected via RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -1,14 +1,14 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
if ps -e | grep --quiet nova-api-metada; then
bind_host=$(get_config_val /etc/nova/nova.conf DEFAULT metadata_listen 127.0.0.1)
bind_port=$(get_config_val /etc/nova/nova.conf DEFAULT metadata_listen_port 8775)
check_url="http://${bind_host}:${bind_port}/"
bind_host=$(get_config_val /etc/nova/nova.conf DEFAULT metadata_listen 127.0.0.1)
bind_port=$(get_config_val /etc/nova/nova.conf DEFAULT metadata_listen_port 8775)
check_url="http://${bind_host}:${bind_port}/"
else
check_url=$(get_url_from_vhost /etc/httpd/conf.d/10-nova_api_wsgi.conf)
check_url=$(get_url_from_vhost /etc/httpd/conf.d/10-nova_api_wsgi.conf)
fi
healthcheck_curl ${check_url}

View File

@ -3,20 +3,20 @@
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
if ps -e | grep nova-compute; then
process='nova-compute'
args="${@:-5671 5672}"
test_func='healthcheck_port'
err_msg="There is no $process process with opened RabbitMQ ports (${args// /,}) running in the container"
process='nova-compute'
args="${@:-5671 5672}"
test_func='healthcheck_port'
err_msg="There is no $process process with opened RabbitMQ ports (${args// /,}) running in the container"
else
process='sshd'
args="${@:-2022}"
test_func='healthcheck_listen'
err_msg="There is no $process process listening on port(s) ${args// /,} in the container"
process='sshd'
args="${@:-2022}"
test_func='healthcheck_listen'
err_msg="There is no $process process listening on port(s) ${args// /,} in the container"
fi
if $test_func $process $args; then
exit 0
exit 0
else
echo $err_msg
exit 1
echo $err_msg
exit 1
fi

View File

@ -6,9 +6,9 @@ process='nova-conductor'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='nova-consoleauth'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='nova-compute'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -1,3 +1,3 @@
#!/bin/sh
#!/bin/bash
virsh version --daemon

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -6,9 +6,9 @@ process='nova-scheduler'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -9,7 +9,7 @@ proto_is_ssl=$(get_config_val /etc/nova/nova.conf DEFAULT ssl_only false)
bind_proto=http
if [ "${proto_is_ssl,,}" = true ] ; then
bind_proto=https
bind_proto=https
fi
healthcheck_curl ${bind_proto}://${bind_host}:${bind_port}/

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
@ -7,7 +7,7 @@ bind_port=$(get_config_val /etc/octavia/octavia.conf api_settings bind_port 9876
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
bind_host="[${bind_host}]"
fi
healthcheck_curl http://${bind_host}:${bind_port}/

View File

@ -6,9 +6,9 @@ process='octavia-health-manager'
args="${@:-5555}"
if healthcheck_listen $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process listening on ports $ports."
exit 1
ports=${args// /,}
echo "There is no $process process listening on ports $ports."
exit 1
fi

View File

@ -6,9 +6,9 @@ process='octavia-housekeeping'
args="${@:-3306}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "Did not find $process process running and connected to MySQL via ports ($ports) in the container."
exit 1
ports=${args// /,}
echo "Did not find $process process running and connected to MySQL via ports ($ports) in the container."
exit 1
fi

View File

@ -6,9 +6,9 @@ process='octavia-worker'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ file=/opt/opendaylight/etc/org.ops4j.pax.web.cfg
bind_host=$(awk -F "= *" '/^org.ops4j.pax.web.listening.addresses/ {print $2}' $file)
tls_enabled=$(awk -F "= *" '/^org.osgi.service.http.secure.enabled/ {print $2}' $file)
if [[ -z "$tls_enabled" || "$tls_enabled" != "true" ]]; then
bind_port=$(awk -F "= *" '/^org.osgi.service.http.port\s*=/ {print $2}' $file)
bind_port=$(awk -F "= *" '/^org.osgi.service.http.port\s*=/ {print $2}' $file)
else
bind_port=$(awk -F "= *" '/^org.osgi.service.http.port.secure/ {print $2}' $file)
bind_port=$(awk -F "= *" '/^org.osgi.service.http.port.secure/ {print $2}' $file)
fi
healthcheck_curl http://$bind_host:$bind_port/diagstatus

8
healthcheck/ovn-controller Normal file → Executable file
View File

@ -6,9 +6,9 @@ process='ovn-controller'
args="${@:-6642}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process connected to ovsdb ports $ports running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process connected to ovsdb ports $ports running in the container"
exit 1
fi

8
healthcheck/ovn-dbs Normal file → Executable file
View File

@ -6,8 +6,8 @@ process='ovn-northd'
sockets="${@:-/run/openvswitch/ovnnb_db.sock /run/openvswitch/ovnsb_db.sock}"
for sock in sockets; do
if ! healthcheck_socket $process $sock; then
echo "There is no $process process connected to socket $sock running in the container"
exit 1
fi
if ! healthcheck_socket $process $sock; then
echo "There is no $process process connected to socket $sock running in the container"
exit 1
fi
done

View File

@ -6,9 +6,9 @@ process='networking-ovn-metadata-agent'
args="${@:-6642}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process connected to ovsdb ports $ports running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process connected to ovsdb ports $ports running in the container"
exit 1
fi

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh

View File

@ -1,3 +1,3 @@
#!/bin/sh
#!/bin/bash
rabbitmqctl node_health_check || exit 1

View File

@ -1,27 +1,27 @@
#!/bin/bash
if parse_out=$(cat "/etc/redis.conf" | egrep "^bind +.*$"); then
redis_host=$(echo -n $parse_out | awk '{print $2}')
redis_host=$(echo -n $parse_out | awk '{print $2}')
else
redis_host=127.0.0.1
redis_host=127.0.0.1
fi
if parse_out=$(cat "/etc/redis.conf" | egrep "^port +.*$"); then
redis_port=$(echo -n $parse_out | awk '{print $2}')
redis_port=$(echo -n $parse_out | awk '{print $2}')
else
redis_port=6379
redis_port=6379
fi
if parse_out=$(cat "/etc/redis.conf" | egrep "^requirepass +.*$"); then
redis_pass=$(echo -n $parse_out | awk '{print $2}')
result=$(printf "*2\r\n\$4\r\nAUTH\r\n\$${#redis_pass}\r\n${redis_pass}\r\n*1\r\n\$4\r\nPING\r\n" | socat - TCP:$redis_host:$redis_port)
redis_pass=$(echo -n $parse_out | awk '{print $2}')
result=$(printf "*2\r\n\$4\r\nAUTH\r\n\$${#redis_pass}\r\n${redis_pass}\r\n*1\r\n\$4\r\nPING\r\n" | socat - TCP:$redis_host:$redis_port)
else
result=$(printf "*1\r\n\$4\r\nPING\r\n" | socat - TCP:$redis_host:$redis_port)
result=$(printf "*1\r\n\$4\r\nPING\r\n" | socat - TCP:$redis_host:$redis_port)
fi
if echo $result | grep -q '+PONG'; then
echo "Redis server responded correctly on ${redis_host}:${redis_port}."
echo "Redis server responded correctly on ${redis_host}:${redis_port}."
else
echo "Redis server does not respond correctly: ${result}"
exit 1
echo "Redis server does not respond correctly: ${result}"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='sahara-engine'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -6,9 +6,9 @@ process='sensu-client'
args="${@:-5671 5672}"
if healthcheck_port $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
ports=${args// /,}
echo "There is no $process process with opened RabbitMQ ports ($ports) running in the container"
exit 1
fi

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
@ -16,7 +16,7 @@ if ps -e | grep --quiet swift-account-server; then
bind_port=$(get_config_val $conf DEFAULT bind_port 6002)
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
bind_host="[${bind_host}]"
fi
healthcheck_curl http://${bind_host}:${bind_port}/healthcheck
else

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
@ -16,7 +16,7 @@ if ps -e | grep --quiet swift-container-server; then
bind_port=$(get_config_val $conf DEFAULT bind_port 6001)
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
bind_host="[${bind_host}]"
fi
healthcheck_curl http://${bind_host}:${bind_port}/healthcheck
else

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
@ -16,7 +16,7 @@ if ps -e | grep --quiet swift-object-server; then
bind_port=$(get_config_val $conf DEFAULT bind_port 6000)
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
bind_host="[${bind_host}]"
fi
healthcheck_curl http://${bind_host}:${bind_port}/healthcheck
elif ps -e | grep --quiet rsync; then
@ -24,9 +24,9 @@ elif ps -e | grep --quiet rsync; then
args="${@:-873}"
if ! healthcheck_listen $process $args; then
ports=${args// /,}
echo "There is no $process process, listening on port(s) $ports, running in the container."
exit 1
ports=${args// /,}
echo "There is no $process process, listening on port(s) $ports, running in the container."
exit 1
fi
else
if ps -e | grep --quiet swift-account-auditor; then

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
@ -6,8 +6,8 @@ if ps -e | grep --quiet swift-proxy-server; then
conf=/etc/swift/proxy-server.conf
if ! crudini --get $conf pipeline:main pipeline | grep -q healthcheck; then
echo "healthcheck is not available" >&2
exit 0
echo "healthcheck is not available" >&2
exit 0
fi
# swift-proxy is still eventlet
@ -15,7 +15,7 @@ if ps -e | grep --quiet swift-proxy-server; then
bind_port=$(get_config_val $conf DEFAULT bind_port 8080)
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
bind_host="[${bind_host}]"
fi
healthcheck_curl http://${bind_host}:${bind_port}/healthcheck
else

View File

@ -6,9 +6,9 @@ process='rsync'
args="${@:-873}"
if healthcheck_listen $process $args; then
exit 0
exit 0
else
ports=${args// /,}
echo "There is no $process process, listening on port(s) $ports, running in the container."
exit 1
ports=${args// /,}
echo "There is no $process process, listening on port(s) $ports, running in the container."
exit 1
fi

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
@ -6,7 +6,7 @@ bind_host=$(get_config_val /etc/tacker/tacker.conf DEFAULT bind_host 127.0.0.1)
bind_port=$(get_config_val /etc/tacker/tacker.conf DEFAULT bind_port 9890)
# Add brackets if IPv6
if [[ $bind_host =~ ":" ]]; then
bind_host="[${bind_host}]"
bind_host="[${bind_host}]"
fi
healthcheck_curl http://${bind_host}:${bind_port}/