Merge "remove sysstat & pidstat"
This commit is contained in:
commit
339ec17731
@ -1 +0,0 @@
|
||||
sysstat
|
@ -1 +0,0 @@
|
||||
sysstat
|
@ -1 +0,0 @@
|
||||
sysstat
|
33
stack.sh
33
stack.sh
@ -294,15 +294,9 @@ SYSLOG=`trueorfalse False $SYSLOG`
|
||||
SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP}
|
||||
SYSLOG_PORT=${SYSLOG_PORT:-516}
|
||||
|
||||
# Enable sysstat logging
|
||||
SYSSTAT_FILE=${SYSSTAT_FILE:-"sysstat.dat"}
|
||||
SYSSTAT_INTERVAL=${SYSSTAT_INTERVAL:-"1"}
|
||||
|
||||
# for DSTAT logging
|
||||
DSTAT_FILE=${DSTAT_FILE:-"dstat.txt"}
|
||||
|
||||
PIDSTAT_FILE=${PIDSTAT_FILE:-"pidstat.txt"}
|
||||
PIDSTAT_INTERVAL=${PIDSTAT_INTERVAL:-"5"}
|
||||
|
||||
# Use color for logging output (only available if syslog is not used)
|
||||
LOG_COLOR=`trueorfalse True $LOG_COLOR`
|
||||
|
||||
@ -863,23 +857,9 @@ fi
|
||||
# Initialize the directory for service status check
|
||||
init_service_check
|
||||
|
||||
|
||||
# Sysstat and friends
|
||||
# Dstat
|
||||
# -------
|
||||
|
||||
# If enabled, systat has to start early to track OpenStack service startup.
|
||||
# what we want to measure
|
||||
# -u : cpu statitics
|
||||
# -q : load
|
||||
# -b : io load rates
|
||||
# -w : process creation and context switch rates
|
||||
SYSSTAT_OPTS="-u -q -b -w"
|
||||
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
||||
screen_it sysstat "cd $TOP_DIR; ./tools/sar_filter.py $SYSSTAT_OPTS -o $SCREEN_LOGDIR/$SYSSTAT_FILE $SYSSTAT_INTERVAL"
|
||||
else
|
||||
screen_it sysstat "./tools/sar_filter.py $SYSSTAT_OPTS $SYSSTAT_INTERVAL"
|
||||
fi
|
||||
|
||||
# A better kind of sysstat, with the top process per time slice
|
||||
DSTAT_OPTS="-tcndylp --top-cpu-adv"
|
||||
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
||||
@ -888,15 +868,6 @@ else
|
||||
screen_it dstat "dstat $DSTAT_OPTS"
|
||||
fi
|
||||
|
||||
# Per-process stats
|
||||
PIDSTAT_OPTS="-l -p ALL -T ALL"
|
||||
if [[ -n ${SCREEN_LOGDIR} ]]; then
|
||||
screen_it pidstat "cd $TOP_DIR; pidstat $PIDSTAT_OPTS $PIDSTAT_INTERVAL > $SCREEN_LOGDIR/$PIDSTAT_FILE"
|
||||
else
|
||||
screen_it pidstat "pidstat $PIDSTAT_OPTS $PIDSTAT_INTERVAL"
|
||||
fi
|
||||
|
||||
|
||||
# Start Services
|
||||
# ==============
|
||||
|
||||
|
@ -1,86 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2014 Samsung Electronics Corp. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def is_data_line(line):
|
||||
timestamp, data = parse_line(line)
|
||||
return re.search('\d\.d', data)
|
||||
|
||||
|
||||
def parse_line(line):
|
||||
m = re.search('(\d\d:\d\d:\d\d( \w\w)?)(\s+((\S+)\s*)+)', line)
|
||||
if m:
|
||||
date = m.group(1)
|
||||
data = m.group(3).rstrip()
|
||||
return date, data
|
||||
else:
|
||||
return None, None
|
||||
|
||||
|
||||
process = subprocess.Popen(
|
||||
"sar %s" % " ".join(sys.argv[1:]),
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT)
|
||||
|
||||
# Poll process for new output until finished
|
||||
|
||||
start_time = ""
|
||||
header = ""
|
||||
data_line = ""
|
||||
printed_header = False
|
||||
current_ts = None
|
||||
|
||||
# print out the first sysstat line regardless
|
||||
print process.stdout.readline()
|
||||
|
||||
while True:
|
||||
nextline = process.stdout.readline()
|
||||
if nextline == '' and process.poll() is not None:
|
||||
break
|
||||
|
||||
date, data = parse_line(nextline)
|
||||
# stop until we get to the first set of real lines
|
||||
if not date:
|
||||
continue
|
||||
|
||||
# now we eat the header lines, and only print out the header
|
||||
# if we've never seen them before
|
||||
if not start_time:
|
||||
start_time = date
|
||||
header += "%s %s" % (date, data)
|
||||
elif date == start_time:
|
||||
header += " %s" % data
|
||||
elif not printed_header:
|
||||
printed_header = True
|
||||
print header
|
||||
|
||||
# now we know this is a data line, printing out if the timestamp
|
||||
# has changed, and stacking up otherwise.
|
||||
nextline = process.stdout.readline()
|
||||
date, data = parse_line(nextline)
|
||||
if date != current_ts:
|
||||
current_ts = date
|
||||
print data_line
|
||||
data_line = "%s %s" % (date, data)
|
||||
else:
|
||||
data_line += " %s" % data
|
||||
|
||||
sys.stdout.flush()
|
Loading…
Reference in New Issue
Block a user