Pull dstat logic into its own function so grenade can use it
In order to use dstat on the new side of grenade, pull dstat code into its own lib with the function start_dstat Change-Id: I5c908d594a6f3a90ed4b3f744002bf606841cf07
This commit is contained in:
parent
11d6bde264
commit
e0b08d04ab
41
lib/dstat
Normal file
41
lib/dstat
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# lib/apache
|
||||||
|
# Functions to start and stop dstat
|
||||||
|
|
||||||
|
# Dependencies:
|
||||||
|
#
|
||||||
|
# - ``functions`` file
|
||||||
|
|
||||||
|
# ``stack.sh`` calls the entry points in this order:
|
||||||
|
#
|
||||||
|
# - start_dstat
|
||||||
|
# - stop_dstat
|
||||||
|
|
||||||
|
# Save trace setting
|
||||||
|
XTRACE=$(set +o | grep xtrace)
|
||||||
|
set +o xtrace
|
||||||
|
|
||||||
|
|
||||||
|
# Defaults
|
||||||
|
# --------
|
||||||
|
# for DSTAT logging
|
||||||
|
DSTAT_FILE=${DSTAT_FILE:-"dstat.txt"}
|
||||||
|
|
||||||
|
|
||||||
|
# start_dstat() - Start running processes, including screen
|
||||||
|
function start_dstat {
|
||||||
|
# A better kind of sysstat, with the top process per time slice
|
||||||
|
DSTAT_OPTS="-tcmndrylp --top-cpu-adv"
|
||||||
|
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
||||||
|
screen_it dstat "cd $TOP_DIR; dstat $DSTAT_OPTS | tee $SCREEN_LOGDIR/$DSTAT_FILE"
|
||||||
|
else
|
||||||
|
screen_it dstat "dstat $DSTAT_OPTS"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# stop_dstat() stop dstat process
|
||||||
|
function stop_dstat {
|
||||||
|
screen_stop dstat
|
||||||
|
}
|
||||||
|
|
||||||
|
# Restore xtrace
|
||||||
|
$XTRACE
|
11
stack.sh
11
stack.sh
@ -323,9 +323,6 @@ SYSLOG=`trueorfalse False $SYSLOG`
|
|||||||
SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP}
|
SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP}
|
||||||
SYSLOG_PORT=${SYSLOG_PORT:-516}
|
SYSLOG_PORT=${SYSLOG_PORT:-516}
|
||||||
|
|
||||||
# for DSTAT logging
|
|
||||||
DSTAT_FILE=${DSTAT_FILE:-"dstat.txt"}
|
|
||||||
|
|
||||||
# Use color for logging output (only available if syslog is not used)
|
# Use color for logging output (only available if syslog is not used)
|
||||||
LOG_COLOR=`trueorfalse True $LOG_COLOR`
|
LOG_COLOR=`trueorfalse True $LOG_COLOR`
|
||||||
|
|
||||||
@ -369,6 +366,7 @@ source $TOP_DIR/lib/heat
|
|||||||
source $TOP_DIR/lib/neutron
|
source $TOP_DIR/lib/neutron
|
||||||
source $TOP_DIR/lib/baremetal
|
source $TOP_DIR/lib/baremetal
|
||||||
source $TOP_DIR/lib/ldap
|
source $TOP_DIR/lib/ldap
|
||||||
|
source $TOP_DIR/lib/dstat
|
||||||
|
|
||||||
# Extras Source
|
# Extras Source
|
||||||
# --------------
|
# --------------
|
||||||
@ -948,12 +946,7 @@ init_service_check
|
|||||||
# -------
|
# -------
|
||||||
|
|
||||||
# A better kind of sysstat, with the top process per time slice
|
# A better kind of sysstat, with the top process per time slice
|
||||||
DSTAT_OPTS="-tcmndrylp --top-cpu-adv"
|
start_dstat
|
||||||
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
|
||||||
screen_it dstat "cd $TOP_DIR; dstat $DSTAT_OPTS | tee $SCREEN_LOGDIR/$DSTAT_FILE"
|
|
||||||
else
|
|
||||||
screen_it dstat "dstat $DSTAT_OPTS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start Services
|
# Start Services
|
||||||
# ==============
|
# ==============
|
||||||
|
@ -162,6 +162,8 @@ if is_service_enabled trove; then
|
|||||||
cleanup_trove
|
cleanup_trove
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
stop_dstat
|
||||||
|
|
||||||
# Clean up the remainder of the screen processes
|
# Clean up the remainder of the screen processes
|
||||||
SCREEN=$(which screen)
|
SCREEN=$(which screen)
|
||||||
if [[ -n "$SCREEN" ]]; then
|
if [[ -n "$SCREEN" ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user