c8159ea6cb
Create fault management REST API service Create fault management client and CLI shell Add a python extension for fault management application APIs Update fault management python APIs to use the python extension Update fault manager to retrieve the SNMP configuration from the config file Story: 2002828 Task: 22747 Depends-On: https://review.openstack.org/#/c/592176/ Change-Id: I888d8d23edf75d05d51594ccca55570ae366c848 Signed-off-by: Tao Liu <tao.liu@windriver.com>
111 lines
2.4 KiB
Bash
Executable File
111 lines
2.4 KiB
Bash
Executable File
#! /bin/sh
|
|
#
|
|
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
#
|
|
# chkconfig: 2345 95 95
|
|
#
|
|
### BEGIN INIT INFO
|
|
# Provides: fminit
|
|
# Default-Start: 3 5
|
|
# Default-Stop: 0 1 2 6
|
|
# Short-Description: Fault Manager
|
|
### END INIT INFO
|
|
|
|
. /etc/init.d/functions
|
|
|
|
FMMGR_NAME="fmManager"
|
|
FMMGR="/usr/local/bin/${FMMGR_NAME}"
|
|
PIDFILE=/var/run/${FMMGR_NAME}.pid
|
|
CONFIGFILE=/etc/fm/fm.conf
|
|
|
|
# Linux Standard Base (LSB) Error Codes
|
|
RETVAL=0
|
|
GENERIC_ERROR=1
|
|
INVALID_ARGS=2
|
|
NOT_RUNNING=3
|
|
NOT_INSTALLED=5
|
|
|
|
if [ ! -e "$FMMGR" ] ; then
|
|
logger "$FMMGR is missing"
|
|
exit ${NOT_INSTALLED}
|
|
fi
|
|
|
|
|
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
|
|
export PATH
|
|
|
|
case "$1" in
|
|
start)
|
|
# The FMMGR runs on controller only
|
|
echo -n "Starting ${FMMGR_NAME}: "
|
|
if [ -n "`pidof ${FMMGR_NAME}`" ] ; then
|
|
echo -n "is already running "
|
|
RETVAL=0
|
|
else
|
|
start-stop-daemon --start -b --make-pidfile --pidfile $PIDFILE --chuid fm -x ${FMMGR} -- -c ${CONFIGFILE}
|
|
RETVAL=$?
|
|
fi
|
|
if [ ${RETVAL} -eq 0 ] ; then
|
|
pid=`pidof ${FMMGR_NAME}`
|
|
echo "OK"
|
|
logger "${FMMGR} (${pid})"
|
|
else
|
|
echo "FAIL"
|
|
RETVAL=${GENERIC_ERROR}
|
|
fi
|
|
|
|
|
|
;;
|
|
stop)
|
|
status ${FMMGR_NAME} >/dev/null
|
|
if [ $? -ne 0 ]; then
|
|
echo "$FMMGR_NAME is not running"
|
|
RETVAL=0
|
|
else
|
|
echo -n "Stopping ${FMMGR_NAME}: "
|
|
killproc ${FMMGR_NAME}
|
|
if [ -n "`pidof ${FMMGR_NAME}`" ] ; then
|
|
logger "Going to SIGKILL ${FMMGR_NAME}"
|
|
killproc -KILL ${FMMGR_NAME}
|
|
fi
|
|
/bin/rm -rf $PIDFILE
|
|
status ${FMMGR_NAME} >/dev/null
|
|
if [ $? -ne 0 ]; then
|
|
echo "Stopped"
|
|
RETVAL=0
|
|
else
|
|
echo "Failed"
|
|
RETVAL=${GENERIC_ERROR}
|
|
fi
|
|
fi
|
|
;;
|
|
restart)
|
|
$0 stop
|
|
sleep 1
|
|
$0 start
|
|
;;
|
|
|
|
status)
|
|
status ${FMMGR_NAME} >/dev/null
|
|
RETVAL=$?
|
|
if [ ! ${RETVAL} -eq 0 ] ; then
|
|
RETVAL=${NOT_RUNNING}
|
|
fi
|
|
|
|
;;
|
|
|
|
condrestart)
|
|
$0 restart
|
|
;;
|
|
|
|
*)
|
|
echo "usage: $0 { start | stop | status | restart | condrestart | status }"
|
|
;;
|
|
esac
|
|
|
|
exit $RETVAL
|