Skip to content

Commit 01e5f72

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Pull dstat logic into its own function so grenade can use it"
2 parents 17b6938 + e0b08d0 commit 01e5f72

3 files changed

Lines changed: 45 additions & 9 deletions

File tree

lib/dstat

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# lib/apache
2+
# Functions to start and stop dstat
3+
4+
# Dependencies:
5+
#
6+
# - ``functions`` file
7+
8+
# ``stack.sh`` calls the entry points in this order:
9+
#
10+
# - start_dstat
11+
# - stop_dstat
12+
13+
# Save trace setting
14+
XTRACE=$(set +o | grep xtrace)
15+
set +o xtrace
16+
17+
18+
# Defaults
19+
# --------
20+
# for DSTAT logging
21+
DSTAT_FILE=${DSTAT_FILE:-"dstat.txt"}
22+
23+
24+
# start_dstat() - Start running processes, including screen
25+
function start_dstat {
26+
# A better kind of sysstat, with the top process per time slice
27+
DSTAT_OPTS="-tcmndrylp --top-cpu-adv"
28+
if [[ -n ${SCREEN_LOGDIR} ]]; then
29+
screen_it dstat "cd $TOP_DIR; dstat $DSTAT_OPTS | tee $SCREEN_LOGDIR/$DSTAT_FILE"
30+
else
31+
screen_it dstat "dstat $DSTAT_OPTS"
32+
fi
33+
}
34+
35+
# stop_dstat() stop dstat process
36+
function stop_dstat {
37+
screen_stop dstat
38+
}
39+
40+
# Restore xtrace
41+
$XTRACE

stack.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,6 @@ SYSLOG=`trueorfalse False $SYSLOG`
323323
SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP}
324324
SYSLOG_PORT=${SYSLOG_PORT:-516}
325325

326-
# for DSTAT logging
327-
DSTAT_FILE=${DSTAT_FILE:-"dstat.txt"}
328-
329326
# Use color for logging output (only available if syslog is not used)
330327
LOG_COLOR=`trueorfalse True $LOG_COLOR`
331328

@@ -369,6 +366,7 @@ source $TOP_DIR/lib/heat
369366
source $TOP_DIR/lib/neutron
370367
source $TOP_DIR/lib/baremetal
371368
source $TOP_DIR/lib/ldap
369+
source $TOP_DIR/lib/dstat
372370

373371
# Extras Source
374372
# --------------
@@ -948,12 +946,7 @@ init_service_check
948946
# -------
949947

950948
# A better kind of sysstat, with the top process per time slice
951-
DSTAT_OPTS="-tcmndrylp --top-cpu-adv"
952-
if [[ -n ${SCREEN_LOGDIR} ]]; then
953-
screen_it dstat "cd $TOP_DIR; dstat $DSTAT_OPTS | tee $SCREEN_LOGDIR/$DSTAT_FILE"
954-
else
955-
screen_it dstat "dstat $DSTAT_OPTS"
956-
fi
949+
start_dstat
957950

958951
# Start Services
959952
# ==============

unstack.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ if is_service_enabled trove; then
162162
cleanup_trove
163163
fi
164164

165+
stop_dstat
166+
165167
# Clean up the remainder of the screen processes
166168
SCREEN=$(which screen)
167169
if [[ -n "$SCREEN" ]]; then

0 commit comments

Comments
 (0)