File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change @@ -323,9 +323,6 @@ SYSLOG=`trueorfalse False $SYSLOG`
323323SYSLOG_HOST=${SYSLOG_HOST:- $HOST_IP }
324324SYSLOG_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)
330327LOG_COLOR=` trueorfalse True $LOG_COLOR `
331328
@@ -369,6 +366,7 @@ source $TOP_DIR/lib/heat
369366source $TOP_DIR /lib/neutron
370367source $TOP_DIR /lib/baremetal
371368source $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# ==============
Original file line number Diff line number Diff line change @@ -162,6 +162,8 @@ if is_service_enabled trove; then
162162 cleanup_trove
163163fi
164164
165+ stop_dstat
166+
165167# Clean up the remainder of the screen processes
166168SCREEN=$( which screen)
167169if [[ -n " $SCREEN " ]]; then
You can’t perform that action at this time.
0 commit comments