3 ##############################################################################
4 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
12 # check the status of a service
16 NOVA_API_PROCESS_1="nova-api-os-compute"
17 NOVA_API_PROCESS_2="nova-api-metadata"
18 NOVA_API_LXC_FILTER_1="nova_api_os_compute"
19 NOVA_API_LXC_FILTER_2="nova_api_metadata"
23 lxc_filter=$(echo "${process_name}" | sed 's/-/_/g')
25 if [ "${lxc_filter}" = "glance_api" ]; then
29 if [ "${process_name}" = "nova-api" ]; then
30 container_1=$(lxc-ls -1 --filter="${NOVA_API_LXC_FILTER_1}")
31 container_2=$(lxc-ls -1 --filter="${NOVA_API_LXC_FILTER_2}")
33 echo $(($(lxc-attach -n "${container_1}" -- ps aux | grep -e "${NOVA_API_PROCESS_1}" | grep -v grep | grep -cv /bin/sh) + $(lxc-attach -n "${container_2}" -- ps aux | grep -e "${NOVA_API_PROCESS_2}" | grep -v grep | grep -cv /bin/sh)))
35 container=$(lxc-ls -1 --filter="${lxc_filter}")
37 if [ "${process_name}" = "haproxy" ]; then
38 ps aux | grep -e "/usr/.*/${process_name}" | grep -v grep | grep -cv /bin/sh
40 lxc-attach -n "${container}" -- ps aux | grep -e "${process_name}" | grep -v grep | grep -cv /bin/sh