Fix bashate failure in zuul
This review allows this repo to pass zuul. Bashate 2.1.1 was released Oct 6, 2022 It adds a more stict indentation check Fixed the new bashate error. Related-Bug: 1991971 Signed-off-by: Al Bailey <al.bailey@windriver.com> Change-Id: I4e86c2a5046fd7ab876ce8ca0e1ad9e6fdbaaf01
This commit is contained in:
parent
db1a91064a
commit
971f9b6630
@ -50,8 +50,8 @@ function collect_inventory {
|
|||||||
delimiter ${LOGFILE} "system service-list"
|
delimiter ${LOGFILE} "system service-list"
|
||||||
system service-list 2>>${COLLECT_ERROR_LOG} >> ${LOGFILE}
|
system service-list 2>>${COLLECT_ERROR_LOG} >> ${LOGFILE}
|
||||||
|
|
||||||
# delimiter ${LOGFILE} "vm-topology"
|
# delimiter ${LOGFILE} "vm-topology"
|
||||||
# timeout 60 vm-topology --show all 2>>${COLLECT_ERROR_LOG} >> ${LOGFILE}
|
# timeout 60 vm-topology --show all 2>>${COLLECT_ERROR_LOG} >> ${LOGFILE}
|
||||||
|
|
||||||
delimiter ${LOGFILE} "system network-list"
|
delimiter ${LOGFILE} "system network-list"
|
||||||
system network-list 2>>${COLLECT_ERROR_LOG} >> ${LOGFILE}
|
system network-list 2>>${COLLECT_ERROR_LOG} >> ${LOGFILE}
|
||||||
|
@ -64,7 +64,7 @@ function do_parallel_commands {
|
|||||||
${STDBUF} ${tool} --repeat=${repeat} --delay=${interval} > ${fname} 2>/dev/null &
|
${STDBUF} ${tool} --repeat=${repeat} --delay=${interval} > ${fname} 2>/dev/null &
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# run without file output (eg., ticker)
|
# run without file output (eg., ticker)
|
||||||
${STDBUF} ${tool} -p ${period} -i ${interval} 2>/dev/null &
|
${STDBUF} ${tool} -p ${period} -i ${interval} 2>/dev/null &
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -83,7 +83,7 @@ function get_current_avail_usage {
|
|||||||
# purge_oldest_files() - remove oldest files based on file-system available space,
|
# purge_oldest_files() - remove oldest files based on file-system available space,
|
||||||
# and maximum collection size
|
# and maximum collection size
|
||||||
function purge_oldest_files {
|
function purge_oldest_files {
|
||||||
# get current file-system usage
|
# get current file-system usage
|
||||||
get_current_avail_usage
|
get_current_avail_usage
|
||||||
msg=$(printf "avail %d MB, headroom %d MB; used %d MB, max %d MB" \
|
msg=$(printf "avail %d MB, headroom %d MB; used %d MB, max %d MB" \
|
||||||
$[$df_avail_bytes/1024/1024] $[$tgt_avail_bytes/1024/1024] \
|
$[$df_avail_bytes/1024/1024] $[$tgt_avail_bytes/1024/1024] \
|
||||||
@ -110,8 +110,8 @@ function purge_oldest_files {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove files in oldest time sorted order until we meet usage targets,
|
# remove files in oldest time sorted order until we meet usage targets,
|
||||||
# incrementally updating usage as we remve files
|
# incrementally updating usage as we remve files
|
||||||
for file in $( ls -rt ${TOOL_DEST_DIR}/${HOSTNAME}_* 2>/dev/null ); do
|
for file in $( ls -rt ${TOOL_DEST_DIR}/${HOSTNAME}_* 2>/dev/null ); do
|
||||||
if [[ $df_avail_bytes -ge $tgt_avail_bytes ]] && \
|
if [[ $df_avail_bytes -ge $tgt_avail_bytes ]] && \
|
||||||
[[ $du_used_bytes -le $tgt_used_bytes ]]; then
|
[[ $du_used_bytes -le $tgt_used_bytes ]]; then
|
||||||
@ -286,7 +286,7 @@ if [[ ${ENABLE_STATIC_COLLECTION} == "Y" ]] || [[ ${ENABLE_STATIC_COLLECTION} ==
|
|||||||
tlist+=( "tool=${LBINDIR}/vswitch.sh name=vswitch period=${PERIOD_MIN} interval=${DUR_1MIN_IN_SEC}" )
|
tlist+=( "tool=${LBINDIR}/vswitch.sh name=vswitch period=${PERIOD_MIN} interval=${DUR_1MIN_IN_SEC}" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ticker - shows progress on the screen
|
# ticker - shows progress on the screen
|
||||||
tlist+=( "tool=${LBINDIR}/ticker.sh name= period=${PERIOD_MIN} interval=${DUR_1MIN_IN_SEC}" )
|
tlist+=( "tool=${LBINDIR}/ticker.sh name= period=${PERIOD_MIN} interval=${DUR_1MIN_IN_SEC}" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ OPT_DEBUG=0
|
|||||||
REP=0
|
REP=0
|
||||||
|
|
||||||
if [ ${#tlist[@]} -ne 0 ]; then
|
if [ ${#tlist[@]} -ne 0 ]; then
|
||||||
# Static stats collection is turned on
|
# Static stats collection is turned on
|
||||||
while [[ ${TOOL_USR1_SIGNAL} -eq 0 ]] && [[ ${OPT_FOREVER} -eq 1 || ${REP} -lt ${REPEATS} ]]; do
|
while [[ ${TOOL_USR1_SIGNAL} -eq 0 ]] && [[ ${OPT_FOREVER} -eq 1 || ${REP} -lt ${REPEATS} ]]; do
|
||||||
# increment loop counter
|
# increment loop counter
|
||||||
((REP++))
|
((REP++))
|
||||||
@ -322,7 +322,7 @@ if [ ${#tlist[@]} -ne 0 ]; then
|
|||||||
${CMD_IDLE} bzip2 -q -f ${parallel_outfiles[@]} 2>/dev/null &
|
${CMD_IDLE} bzip2 -q -f ${parallel_outfiles[@]} 2>/dev/null &
|
||||||
done
|
done
|
||||||
|
|
||||||
# Wait for the compression to complete
|
# Wait for the compression to complete
|
||||||
wait
|
wait
|
||||||
tools_cleanup 0
|
tools_cleanup 0
|
||||||
fi
|
fi
|
||||||
|
@ -18,12 +18,12 @@ function print_disk {
|
|||||||
print_separator
|
print_separator
|
||||||
TOOL_HIRES_TIME
|
TOOL_HIRES_TIME
|
||||||
|
|
||||||
# NOTES:
|
# NOTES:
|
||||||
# --total (grand-total) is a new option, but don't necessarily want to add tmpfs
|
# --total (grand-total) is a new option, but don't necessarily want to add tmpfs
|
||||||
# or dummy filesystems.
|
# or dummy filesystems.
|
||||||
# - use -H to print in SI (eg, GB, vs GiB)
|
# - use -H to print in SI (eg, GB, vs GiB)
|
||||||
# - can use -a to print all filesystems including dummy filesystems, but then
|
# - can use -a to print all filesystems including dummy filesystems, but then
|
||||||
# there can be double-counting:
|
# there can be double-counting:
|
||||||
print_separator
|
print_separator
|
||||||
cmd='df -h -H -T --local -t ext2 -t ext3 -t ext4 -t xfs --total'
|
cmd='df -h -H -T --local -t ext2 -t ext3 -t ext4 -t xfs --total'
|
||||||
${ECHO} "Disk space usage ext2,ext3,ext4,xfs,tmpfs (SI):"
|
${ECHO} "Disk space usage ext2,ext3,ext4,xfs,tmpfs (SI):"
|
||||||
@ -63,7 +63,7 @@ function print_disk_static {
|
|||||||
${cmd}
|
${cmd}
|
||||||
${ECHO}
|
${ECHO}
|
||||||
|
|
||||||
# fdisk - requires sudo/root
|
# fdisk - requires sudo/root
|
||||||
print_separator
|
print_separator
|
||||||
cmd='fdisk -l'
|
cmd='fdisk -l'
|
||||||
if [ $UID -eq 0 ]; then
|
if [ $UID -eq 0 ]; then
|
||||||
@ -74,7 +74,7 @@ function print_disk_static {
|
|||||||
fi
|
fi
|
||||||
${ECHO}
|
${ECHO}
|
||||||
|
|
||||||
# parted - requires sudo/root
|
# parted - requires sudo/root
|
||||||
print_separator
|
print_separator
|
||||||
cmd='parted -l'
|
cmd='parted -l'
|
||||||
if [ $UID -eq 0 ]; then
|
if [ $UID -eq 0 ]; then
|
||||||
|
@ -57,13 +57,13 @@ function tools_init {
|
|||||||
local error=0
|
local error=0
|
||||||
TOOLNAME=$(basename $0)
|
TOOLNAME=$(basename $0)
|
||||||
|
|
||||||
# Check for sufficient priviledges
|
# Check for sufficient priviledges
|
||||||
if [ $UID -ne 0 ]; then
|
if [ $UID -ne 0 ]; then
|
||||||
ERRLOG "${NAME} requires sudo/root access."
|
ERRLOG "${NAME} requires sudo/root access."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for essential binaries
|
# Check for essential binaries
|
||||||
ECHO=$(which echo 2>/dev/null)
|
ECHO=$(which echo 2>/dev/null)
|
||||||
rc=$?
|
rc=$?
|
||||||
if [ $rc -ne 0 ]; then
|
if [ $rc -ne 0 ]; then
|
||||||
@ -78,8 +78,8 @@ function tools_init {
|
|||||||
error=$rc
|
error=$rc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for standard linux binaries, at least can use LOG functions now
|
# Check for standard linux binaries, at least can use LOG functions now
|
||||||
# - these are used in tools_header
|
# - these are used in tools_header
|
||||||
CAT=$(which cat 2>/dev/null)
|
CAT=$(which cat 2>/dev/null)
|
||||||
rc=$?
|
rc=$?
|
||||||
if [ $rc -ne 0 ]; then
|
if [ $rc -ne 0 ]; then
|
||||||
@ -157,38 +157,38 @@ function tools_init {
|
|||||||
error=$rc
|
error=$rc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The following block is needed for LSB systems such as Windriver Linux.
|
# The following block is needed for LSB systems such as Windriver Linux.
|
||||||
# The utility is not available on CentOS so comment it out.
|
# The utility is not available on CentOS so comment it out.
|
||||||
# Generic utility, but may not be available
|
# Generic utility, but may not be available
|
||||||
# LSB=$(which lsb_release 2>/dev/null)
|
# LSB=$(which lsb_release 2>/dev/null)
|
||||||
# rc=$?
|
# rc=$?
|
||||||
# if [ $rc -ne 0 ]; then
|
# if [ $rc -ne 0 ]; then
|
||||||
# WARNLOG "'lsb_release' not found, rc=$rc";
|
# WARNLOG "'lsb_release' not found, rc=$rc";
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
# Let parent program decide what to do with the errors,
|
# Let parent program decide what to do with the errors,
|
||||||
# give ominous warning
|
# give ominous warning
|
||||||
if [ $error -eq 1 ]; then
|
if [ $error -eq 1 ]; then
|
||||||
WARNLOG "possibly cannot continue, missing linux binaries"
|
WARNLOG "possibly cannot continue, missing linux binaries"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if tool was previously running
|
# Check if tool was previously running
|
||||||
if [ -e ${PIDFILE} ]; then
|
if [ -e ${PIDFILE} ]; then
|
||||||
# [ JGAULD - remove pidofproc() / LSB compatibility issue ]
|
# [ JGAULD - remove pidofproc() / LSB compatibility issue ]
|
||||||
if check_pidfile -p "${PIDFILE}" >/dev/null; then
|
if check_pidfile -p "${PIDFILE}" >/dev/null; then
|
||||||
ERRLOG "${PIDFILE} exists and ${TOOLNAME} is running"
|
ERRLOG "${PIDFILE} exists and ${TOOLNAME} is running"
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
# remove pid file
|
# remove pid file
|
||||||
WARNLOG "${PIDFILE} exists but ${TOOLNAME} is not running; cleaning up"
|
WARNLOG "${PIDFILE} exists but ${TOOLNAME} is not running; cleaning up"
|
||||||
rm -f ${PIDFILE}
|
rm -f ${PIDFILE}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create pid file
|
# Create pid file
|
||||||
echo $$ > ${PIDFILE}
|
echo $$ > ${PIDFILE}
|
||||||
|
|
||||||
# Setup trap handler - these signals trigger child shutdown and cleanup
|
# Setup trap handler - these signals trigger child shutdown and cleanup
|
||||||
trap tools_exit_handler INT HUP TERM EXIT
|
trap tools_exit_handler INT HUP TERM EXIT
|
||||||
trap tools_usr1_handler USR1
|
trap tools_usr1_handler USR1
|
||||||
trap tools_usr2_handler USR2
|
trap tools_usr2_handler USR2
|
||||||
@ -198,7 +198,7 @@ function tools_init {
|
|||||||
|
|
||||||
# tools_cleanup() - terminate child processes
|
# tools_cleanup() - terminate child processes
|
||||||
function tools_cleanup {
|
function tools_cleanup {
|
||||||
# restore signal handling to default behaviour
|
# restore signal handling to default behaviour
|
||||||
trap - INT HUP TERM EXIT
|
trap - INT HUP TERM EXIT
|
||||||
trap - USR1 USR2
|
trap - USR1 USR2
|
||||||
|
|
||||||
@ -211,16 +211,16 @@ function tools_cleanup {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# stop all processes launched from this process
|
# stop all processes launched from this process
|
||||||
pkill -TERM -P $$
|
pkill -TERM -P $$
|
||||||
if [ "$1" -ne "0" ]; then
|
if [ "$1" -ne "0" ]; then
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# OK, if the above didn't work, use force
|
# OK, if the above didn't work, use force
|
||||||
pkill -KILL -P $$
|
pkill -KILL -P $$
|
||||||
|
|
||||||
# remove pid file
|
# remove pid file
|
||||||
if [ -e ${PIDFILE} ]; then
|
if [ -e ${PIDFILE} ]; then
|
||||||
rm -f ${VERBOSE_OPT} ${PIDFILE}
|
rm -f ${VERBOSE_OPT} ${PIDFILE}
|
||||||
fi
|
fi
|
||||||
@ -274,7 +274,7 @@ function set_affinity {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set cpu affinity for current program
|
# Set cpu affinity for current program
|
||||||
local TASKSET=$(which taskset 2>/dev/null)
|
local TASKSET=$(which taskset 2>/dev/null)
|
||||||
if [ -x "${TASKSET}" ]; then
|
if [ -x "${TASKSET}" ]; then
|
||||||
${TASKSET} -pc ${CPULIST} $$ 2>/dev/null
|
${TASKSET} -pc ${CPULIST} $$ 2>/dev/null
|
||||||
@ -312,26 +312,26 @@ function print_separator {
|
|||||||
function tools_header {
|
function tools_header {
|
||||||
local TOOLNAME=$(basename $0)
|
local TOOLNAME=$(basename $0)
|
||||||
|
|
||||||
# Get timestamp
|
# Get timestamp
|
||||||
#local tstamp=$( date +"%Y-%0m-%0e %H:%M:%S" 2>/dev/null )
|
#local tstamp=$( date +"%Y-%0m-%0e %H:%M:%S" 2>/dev/null )
|
||||||
local tstamp=$( date --rfc-3339=ns | cut -c1-23 2>/dev/null )
|
local tstamp=$( date --rfc-3339=ns | cut -c1-23 2>/dev/null )
|
||||||
|
|
||||||
# Linux Generic
|
# Linux Generic
|
||||||
local UPTIME=/proc/uptime
|
local UPTIME=/proc/uptime
|
||||||
|
|
||||||
# Get number of online cpus
|
# Get number of online cpus
|
||||||
local CPUINFO=/proc/cpuinfo
|
local CPUINFO=/proc/cpuinfo
|
||||||
local online_cpus=$( cat ${CPUINFO} | grep -i ^processor | wc -l 2>/dev/null )
|
local online_cpus=$( cat ${CPUINFO} | grep -i ^processor | wc -l 2>/dev/null )
|
||||||
|
|
||||||
# Get load average, run-queue size, and number of threads
|
# Get load average, run-queue size, and number of threads
|
||||||
local LOADAVG=/proc/loadavg
|
local LOADAVG=/proc/loadavg
|
||||||
local LDAVG=( `cat ${LOADAVG} | sed -e 's#[/]# #g' 2>/dev/null` )
|
local LDAVG=( `cat ${LOADAVG} | sed -e 's#[/]# #g' 2>/dev/null` )
|
||||||
|
|
||||||
# Get current architecture
|
# Get current architecture
|
||||||
local arch=$( uname -m )
|
local arch=$( uname -m )
|
||||||
|
|
||||||
# Determine processor name (there are many different formats... *sigh* )
|
# Determine processor name (there are many different formats... *sigh* )
|
||||||
# - build up info from multiple lines
|
# - build up info from multiple lines
|
||||||
local processor='unk'
|
local processor='unk'
|
||||||
local NAME=$( cat ${CPUINFO} | grep \
|
local NAME=$( cat ${CPUINFO} | grep \
|
||||||
-e '^cpu\W\W:' \
|
-e '^cpu\W\W:' \
|
||||||
@ -346,7 +346,7 @@ function tools_header {
|
|||||||
processor=${NAME}
|
processor=${NAME}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Determine processor speed (abort grep after first match)
|
# Determine processor speed (abort grep after first match)
|
||||||
local speed='unk'
|
local speed='unk'
|
||||||
local BOGO=$( cat ${CPUINFO} | grep -m1 -e ^BogoMIPS -e ^bogomips | \
|
local BOGO=$( cat ${CPUINFO} | grep -m1 -e ^BogoMIPS -e ^bogomips | \
|
||||||
awk 'BEGIN{FS=":";} {printf "%.1f", $2;}' 2>/dev/null )
|
awk 'BEGIN{FS=":";} {printf "%.1f", $2;}' 2>/dev/null )
|
||||||
@ -362,14 +362,14 @@ function tools_header {
|
|||||||
speed=${BOGO}
|
speed=${BOGO}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Determine OS and kernel version
|
# Determine OS and kernel version
|
||||||
local os_name=$( uname -s 2>/dev/null )
|
local os_name=$( uname -s 2>/dev/null )
|
||||||
local os_release=$( uname -r 2>/dev/null )
|
local os_release=$( uname -r 2>/dev/null )
|
||||||
|
|
||||||
declare -a arr
|
declare -a arr
|
||||||
|
|
||||||
local dist_id=""
|
local dist_id=""
|
||||||
# Determine OS distribution ID
|
# Determine OS distribution ID
|
||||||
if [ lsb_pres == "yes" ]; then
|
if [ lsb_pres == "yes" ]; then
|
||||||
arr=( $( lsb_release -i 2>/dev/null ) )
|
arr=( $( lsb_release -i 2>/dev/null ) )
|
||||||
dist_id=${arr[2]}
|
dist_id=${arr[2]}
|
||||||
@ -379,13 +379,13 @@ function tools_header {
|
|||||||
|
|
||||||
local dist_rel=""
|
local dist_rel=""
|
||||||
if [ lsb_pres == "yes" ]; then
|
if [ lsb_pres == "yes" ]; then
|
||||||
# Determine OS distribution release
|
# Determine OS distribution release
|
||||||
arr=( $( cat /proc/version | awk '{print $3}' 2>/dev/null ) )
|
arr=( $( cat /proc/version | awk '{print $3}' 2>/dev/null ) )
|
||||||
local dist_rel=${arr[1]}
|
local dist_rel=${arr[1]}
|
||||||
else
|
else
|
||||||
local dist_rel=$(cat /etc/centos-release | awk '{print $4}' 2>/dev/null)
|
local dist_rel=$(cat /etc/centos-release | awk '{print $4}' 2>/dev/null)
|
||||||
fi
|
fi
|
||||||
# Print generic header
|
# Print generic header
|
||||||
echo "${TOOLNAME} -- ${tstamp} load average:${LDAVG[0]}, ${LDAVG[1]}, ${LDAVG[2]} runq:${LDAVG[3]} nproc:${LDAVG[4]}"
|
echo "${TOOLNAME} -- ${tstamp} load average:${LDAVG[0]}, ${LDAVG[1]}, ${LDAVG[2]} runq:${LDAVG[3]} nproc:${LDAVG[4]}"
|
||||||
echo " host:${HOSTNAME} Distribution:${dist_id} ${dist_rel} ${os_name} ${os_release}"
|
echo " host:${HOSTNAME} Distribution:${dist_id} ${dist_rel} ${os_name} ${os_release}"
|
||||||
echo " arch:${arch} processor:${processor} speed:${speed} MHz CPUs:${online_cpus}"
|
echo " arch:${arch} processor:${processor} speed:${speed} MHz CPUs:${online_cpus}"
|
||||||
@ -426,14 +426,14 @@ function tools_print_help {
|
|||||||
|
|
||||||
# tools_parse_options() -- parse common options for tools scripts
|
# tools_parse_options() -- parse common options for tools scripts
|
||||||
function tools_parse_options {
|
function tools_parse_options {
|
||||||
# check for no arguments, print usage
|
# check for no arguments, print usage
|
||||||
if [ $# -eq "0" ]; then
|
if [ $# -eq "0" ]; then
|
||||||
tools_usage
|
tools_usage
|
||||||
tools_cleanup 0
|
tools_cleanup 0
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# parse the input arguments
|
# parse the input arguments
|
||||||
while getopts "fp:i:c:h" Option; do
|
while getopts "fp:i:c:h" Option; do
|
||||||
case $Option in
|
case $Option in
|
||||||
f)
|
f)
|
||||||
@ -459,7 +459,7 @@ function tools_parse_options {
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# validate input arguments
|
# validate input arguments
|
||||||
PERIOD_MAX=$[4*24*60]
|
PERIOD_MAX=$[4*24*60]
|
||||||
INTERVAL_MAX=$[60*60]
|
INTERVAL_MAX=$[60*60]
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ OPT_USE_INTERVALS=1
|
|||||||
|
|
||||||
# Print key networking device statistics
|
# Print key networking device statistics
|
||||||
function print_memory {
|
function print_memory {
|
||||||
# Configuration for netcmds
|
# Configuration for netcmds
|
||||||
MEMINFO=/proc/meminfo
|
MEMINFO=/proc/meminfo
|
||||||
NODEINFO=/sys/devices/system/node/node?/meminfo
|
NODEINFO=/sys/devices/system/node/node?/meminfo
|
||||||
BUDDYINFO=/proc/buddyinfo
|
BUDDYINFO=/proc/buddyinfo
|
||||||
@ -43,7 +43,7 @@ function print_memory {
|
|||||||
awk '/^Pss:/ {a += $2;} END {printf "%d MiB\n", a/1024.0;}'
|
awk '/^Pss:/ {a += $2;} END {printf "%d MiB\n", a/1024.0;}'
|
||||||
${ECHO}
|
${ECHO}
|
||||||
|
|
||||||
# use old slabinfo format (i.e. slub not enabled in kernel)
|
# use old slabinfo format (i.e. slub not enabled in kernel)
|
||||||
${ECHO} "# ${SLABINFO}"
|
${ECHO} "# ${SLABINFO}"
|
||||||
${CAT} ${SLABINFO} | \
|
${CAT} ${SLABINFO} | \
|
||||||
awk -v page_size_B=${PAGE_SIZE} '
|
awk -v page_size_B=${PAGE_SIZE} '
|
||||||
|
@ -15,7 +15,7 @@ OPT_USE_INTERVALS=1
|
|||||||
|
|
||||||
# Print key networking device statistics
|
# Print key networking device statistics
|
||||||
function print_netcmds {
|
function print_netcmds {
|
||||||
# Configuration for netcmds
|
# Configuration for netcmds
|
||||||
DEV=/proc/net/dev
|
DEV=/proc/net/dev
|
||||||
NETSTAT=/proc/net/netstat
|
NETSTAT=/proc/net/netstat
|
||||||
|
|
||||||
|
@ -18,16 +18,16 @@ function print_postgres {
|
|||||||
print_separator
|
print_separator
|
||||||
TOOL_HIRES_TIME
|
TOOL_HIRES_TIME
|
||||||
|
|
||||||
# postgressql command: set user, disable pagination, and be quiet
|
# postgressql command: set user, disable pagination, and be quiet
|
||||||
PSQL="sudo -u postgres psql --pset pager=off -q"
|
PSQL="sudo -u postgres psql --pset pager=off -q"
|
||||||
|
|
||||||
# List postgres databases
|
# List postgres databases
|
||||||
db_list=( $(${PSQL} -t -c "SELECT datname FROM pg_database WHERE datistemplate = false;") )
|
db_list=( $(${PSQL} -t -c "SELECT datname FROM pg_database WHERE datistemplate = false;") )
|
||||||
${ECHO} "# postgres databases"
|
${ECHO} "# postgres databases"
|
||||||
echo "db_list = ${db_list[@]}"
|
echo "db_list = ${db_list[@]}"
|
||||||
${ECHO}
|
${ECHO}
|
||||||
|
|
||||||
# List sizes of all postgres databases (similar to "\l+")
|
# List sizes of all postgres databases (similar to "\l+")
|
||||||
${ECHO} "# postgres database sizes"
|
${ECHO} "# postgres database sizes"
|
||||||
${PSQL} -c "
|
${PSQL} -c "
|
||||||
SELECT
|
SELECT
|
||||||
@ -38,7 +38,7 @@ FROM pg_database
|
|||||||
ORDER BY pg_database_size DESC;
|
ORDER BY pg_database_size DESC;
|
||||||
"
|
"
|
||||||
|
|
||||||
# For each database, list tables and their sizes (similar to "\dt+")
|
# For each database, list tables and their sizes (similar to "\dt+")
|
||||||
for db in "${db_list[@]}"; do
|
for db in "${db_list[@]}"; do
|
||||||
${ECHO} "# postgres database: ${db}"
|
${ECHO} "# postgres database: ${db}"
|
||||||
${PSQL} -d ${db} -c "
|
${PSQL} -d ${db} -c "
|
||||||
@ -85,11 +85,11 @@ FROM pg_stat_user_tables;
|
|||||||
"
|
"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Specific table counts (This is very SLOW, look at "live tuples" instead)
|
# Specific table counts (This is very SLOW, look at "live tuples" instead)
|
||||||
# Number of keystone tokens
|
# Number of keystone tokens
|
||||||
#${ECHO} "# keystone token count"
|
#${ECHO} "# keystone token count"
|
||||||
|
|
||||||
# Number of postgres connections
|
# Number of postgres connections
|
||||||
${ECHO} "# postgres database connections"
|
${ECHO} "# postgres database connections"
|
||||||
CONN=$(ps -C postgres -o cmd= | wc -l)
|
CONN=$(ps -C postgres -o cmd= | wc -l)
|
||||||
CONN_T=$(ps -C postgres -o cmd= | awk '/postgres: / {print $3}' | awk '{for(i=1;i<=NF;i++) a[$i]++} END {for(k in a) print k, a[k]}' | sort -k 2 -nr )
|
CONN_T=$(ps -C postgres -o cmd= | awk '/postgres: / {print $3}' | awk '{for(i=1;i<=NF;i++) a[$i]++} END {for(k in a) print k, a[k]}' | sort -k 2 -nr )
|
||||||
|
@ -19,20 +19,20 @@ function print_rabbitmq {
|
|||||||
print_separator
|
print_separator
|
||||||
TOOL_HIRES_TIME
|
TOOL_HIRES_TIME
|
||||||
|
|
||||||
# IMPORTANT:
|
# IMPORTANT:
|
||||||
# - Difficulty getting rabbitmqctl to work from init.d script;
|
# - Difficulty getting rabbitmqctl to work from init.d script;
|
||||||
# apparently it requires a psuedo-TTY, which is something you don't have
|
# apparently it requires a psuedo-TTY, which is something you don't have
|
||||||
# until post-init.
|
# until post-init.
|
||||||
# - WORKAROUND: run command using 'sudo', even if you are 'root'
|
# - WORKAROUND: run command using 'sudo', even if you are 'root'
|
||||||
|
|
||||||
# Dump various rabbitmq related stats
|
# Dump various rabbitmq related stats
|
||||||
MQ_STATUS="rabbitmqctl ${MQOPT} status"
|
MQ_STATUS="rabbitmqctl ${MQOPT} status"
|
||||||
${ECHO} "# ${MQ_STATUS}"
|
${ECHO} "# ${MQ_STATUS}"
|
||||||
sudo ${MQ_STATUS} | grep -e '{memory' -A30
|
sudo ${MQ_STATUS} | grep -e '{memory' -A30
|
||||||
${ECHO}
|
${ECHO}
|
||||||
|
|
||||||
# THe following is useful in diagnosing rabbit memory leaks
|
# THe following is useful in diagnosing rabbit memory leaks
|
||||||
# when end-users do not drain their queues (eg, due to RPC timeout issues, etc)
|
# when end-users do not drain their queues (eg, due to RPC timeout issues, etc)
|
||||||
MQ_QUEUES="rabbitmqctl ${MQOPT} list_queues messages name pid messages_ready messages_unacknowledged memory consumers"
|
MQ_QUEUES="rabbitmqctl ${MQOPT} list_queues messages name pid messages_ready messages_unacknowledged memory consumers"
|
||||||
${ECHO} "# ${MQ_QUEUES}"
|
${ECHO} "# ${MQ_QUEUES}"
|
||||||
sudo ${MQ_QUEUES}
|
sudo ${MQ_QUEUES}
|
||||||
|
@ -12,7 +12,7 @@ eval_gettext() {
|
|||||||
|
|
||||||
# Only display this information in interactive shells
|
# Only display this information in interactive shells
|
||||||
if echo "$-" | grep -qs "i"; then
|
if echo "$-" | grep -qs "i"; then
|
||||||
# Also, don't display if .hushlogin exists or MOTD was shown recently
|
# Also, don't display if .hushlogin exists or MOTD was shown recently
|
||||||
if [ ! -e "$HOME/.hushlogin" ] && [ -z "$MOTD_SHOWN" ] && ! find $stamp -newermt 'today 0:00' 2> /dev/null | grep -q -m 1 '.'; then
|
if [ ! -e "$HOME/.hushlogin" ] && [ -z "$MOTD_SHOWN" ] && ! find $stamp -newermt 'today 0:00' 2> /dev/null | grep -q -m 1 '.'; then
|
||||||
[ $(id -u) -eq 0 ] || SHOW="--show-only"
|
[ $(id -u) -eq 0 ] || SHOW="--show-only"
|
||||||
update-motd $SHOW
|
update-motd $SHOW
|
||||||
|
Loading…
Reference in New Issue
Block a user