diff --git a/tools/collector/scripts/collect_sysinv.sh b/tools/collector/scripts/collect_sysinv.sh index 29bdc94b..4e100579 100755 --- a/tools/collector/scripts/collect_sysinv.sh +++ b/tools/collector/scripts/collect_sysinv.sh @@ -50,8 +50,8 @@ function collect_inventory { delimiter ${LOGFILE} "system service-list" system service-list 2>>${COLLECT_ERROR_LOG} >> ${LOGFILE} - # delimiter ${LOGFILE} "vm-topology" - # timeout 60 vm-topology --show all 2>>${COLLECT_ERROR_LOG} >> ${LOGFILE} + # delimiter ${LOGFILE} "vm-topology" + # timeout 60 vm-topology --show all 2>>${COLLECT_ERROR_LOG} >> ${LOGFILE} delimiter ${LOGFILE} "system network-list" system network-list 2>>${COLLECT_ERROR_LOG} >> ${LOGFILE} diff --git a/tools/engtools/hostdata-collectors/scripts/collect-engtools.sh b/tools/engtools/hostdata-collectors/scripts/collect-engtools.sh index e59f382b..44971221 100644 --- a/tools/engtools/hostdata-collectors/scripts/collect-engtools.sh +++ b/tools/engtools/hostdata-collectors/scripts/collect-engtools.sh @@ -64,7 +64,7 @@ function do_parallel_commands { ${STDBUF} ${tool} --repeat=${repeat} --delay=${interval} > ${fname} 2>/dev/null & fi else - # run without file output (eg., ticker) + # run without file output (eg., ticker) ${STDBUF} ${tool} -p ${period} -i ${interval} 2>/dev/null & fi done @@ -83,7 +83,7 @@ function get_current_avail_usage { # purge_oldest_files() - remove oldest files based on file-system available space, # and maximum collection size function purge_oldest_files { - # get current file-system usage + # get current file-system usage get_current_avail_usage msg=$(printf "avail %d MB, headroom %d MB; used %d MB, max %d MB" \ $[$df_avail_bytes/1024/1024] $[$tgt_avail_bytes/1024/1024] \ @@ -110,8 +110,8 @@ function purge_oldest_files { return fi - # remove files in oldest time sorted order until we meet usage targets, - # incrementally updating usage as we remve files + # remove files in oldest time sorted order until we meet usage targets, + # incrementally updating usage as we remve files for file in $( ls -rt ${TOOL_DEST_DIR}/${HOSTNAME}_* 2>/dev/null ); do if [[ $df_avail_bytes -ge $tgt_avail_bytes ]] && \ [[ $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}" ) 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}" ) fi @@ -301,7 +301,7 @@ OPT_DEBUG=0 REP=0 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 # increment loop counter ((REP++)) @@ -322,7 +322,7 @@ if [ ${#tlist[@]} -ne 0 ]; then ${CMD_IDLE} bzip2 -q -f ${parallel_outfiles[@]} 2>/dev/null & done - # Wait for the compression to complete + # Wait for the compression to complete wait tools_cleanup 0 fi diff --git a/tools/engtools/hostdata-collectors/scripts/diskstats.sh b/tools/engtools/hostdata-collectors/scripts/diskstats.sh index c419a9a0..570f3c34 100644 --- a/tools/engtools/hostdata-collectors/scripts/diskstats.sh +++ b/tools/engtools/hostdata-collectors/scripts/diskstats.sh @@ -18,12 +18,12 @@ function print_disk { print_separator TOOL_HIRES_TIME - # NOTES: - # --total (grand-total) is a new option, but don't necessarily want to add tmpfs - # or dummy filesystems. - # - use -H to print in SI (eg, GB, vs GiB) - # - can use -a to print all filesystems including dummy filesystems, but then - # there can be double-counting: + # NOTES: + # --total (grand-total) is a new option, but don't necessarily want to add tmpfs + # or dummy filesystems. + # - use -H to print in SI (eg, GB, vs GiB) + # - can use -a to print all filesystems including dummy filesystems, but then + # there can be double-counting: print_separator 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):" @@ -63,7 +63,7 @@ function print_disk_static { ${cmd} ${ECHO} - # fdisk - requires sudo/root + # fdisk - requires sudo/root print_separator cmd='fdisk -l' if [ $UID -eq 0 ]; then @@ -74,7 +74,7 @@ function print_disk_static { fi ${ECHO} - # parted - requires sudo/root + # parted - requires sudo/root print_separator cmd='parted -l' if [ $UID -eq 0 ]; then diff --git a/tools/engtools/hostdata-collectors/scripts/engtools_util.sh b/tools/engtools/hostdata-collectors/scripts/engtools_util.sh index af1aaa4e..8f65ccf8 100644 --- a/tools/engtools/hostdata-collectors/scripts/engtools_util.sh +++ b/tools/engtools/hostdata-collectors/scripts/engtools_util.sh @@ -57,13 +57,13 @@ function tools_init { local error=0 TOOLNAME=$(basename $0) - # Check for sufficient priviledges + # Check for sufficient priviledges if [ $UID -ne 0 ]; then ERRLOG "${NAME} requires sudo/root access." return 1 fi - # Check for essential binaries + # Check for essential binaries ECHO=$(which echo 2>/dev/null) rc=$? if [ $rc -ne 0 ]; then @@ -78,8 +78,8 @@ function tools_init { error=$rc fi - # Check for standard linux binaries, at least can use LOG functions now - # - these are used in tools_header + # Check for standard linux binaries, at least can use LOG functions now + # - these are used in tools_header CAT=$(which cat 2>/dev/null) rc=$? if [ $rc -ne 0 ]; then @@ -157,38 +157,38 @@ function tools_init { error=$rc fi - # The following block is needed for LSB systems such as Windriver Linux. - # The utility is not available on CentOS so comment it out. - # Generic utility, but may not be available - # LSB=$(which lsb_release 2>/dev/null) - # rc=$? - # if [ $rc -ne 0 ]; then - # WARNLOG "'lsb_release' not found, rc=$rc"; - # fi + # The following block is needed for LSB systems such as Windriver Linux. + # The utility is not available on CentOS so comment it out. + # Generic utility, but may not be available + # LSB=$(which lsb_release 2>/dev/null) + # rc=$? + # if [ $rc -ne 0 ]; then + # WARNLOG "'lsb_release' not found, rc=$rc"; + # fi - # Let parent program decide what to do with the errors, - # give ominous warning + # Let parent program decide what to do with the errors, + # give ominous warning if [ $error -eq 1 ]; then WARNLOG "possibly cannot continue, missing linux binaries" fi - # Check if tool was previously running + # Check if tool was previously running if [ -e ${PIDFILE} ]; then # [ JGAULD - remove pidofproc() / LSB compatibility issue ] if check_pidfile -p "${PIDFILE}" >/dev/null; then ERRLOG "${PIDFILE} exists and ${TOOLNAME} is running" return 1 else - # remove pid file + # remove pid file WARNLOG "${PIDFILE} exists but ${TOOLNAME} is not running; cleaning up" rm -f ${PIDFILE} fi fi - # Create pid file + # Create pid file 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_usr1_handler USR1 trap tools_usr2_handler USR2 @@ -198,7 +198,7 @@ function tools_init { # tools_cleanup() - terminate child processes function tools_cleanup { - # restore signal handling to default behaviour + # restore signal handling to default behaviour trap - INT HUP TERM EXIT trap - USR1 USR2 @@ -211,16 +211,16 @@ function tools_cleanup { fi - # stop all processes launched from this process + # stop all processes launched from this process pkill -TERM -P $$ if [ "$1" -ne "0" ]; then sleep 1 fi - # OK, if the above didn't work, use force + # OK, if the above didn't work, use force pkill -KILL -P $$ - # remove pid file + # remove pid file if [ -e ${PIDFILE} ]; then rm -f ${VERBOSE_OPT} ${PIDFILE} fi @@ -274,7 +274,7 @@ function set_affinity { return fi - # Set cpu affinity for current program + # Set cpu affinity for current program local TASKSET=$(which taskset 2>/dev/null) if [ -x "${TASKSET}" ]; then ${TASKSET} -pc ${CPULIST} $$ 2>/dev/null @@ -312,26 +312,26 @@ function print_separator { function tools_header { local TOOLNAME=$(basename $0) - # Get timestamp - #local tstamp=$( date +"%Y-%0m-%0e %H:%M:%S" 2>/dev/null ) + # Get timestamp + #local tstamp=$( date +"%Y-%0m-%0e %H:%M:%S" 2>/dev/null ) local tstamp=$( date --rfc-3339=ns | cut -c1-23 2>/dev/null ) - # Linux Generic + # Linux Generic local UPTIME=/proc/uptime - # Get number of online cpus + # Get number of online cpus local CPUINFO=/proc/cpuinfo 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 LDAVG=( `cat ${LOADAVG} | sed -e 's#[/]# #g' 2>/dev/null` ) - # Get current architecture + # Get current architecture local arch=$( uname -m ) - # Determine processor name (there are many different formats... *sigh* ) - # - build up info from multiple lines + # Determine processor name (there are many different formats... *sigh* ) + # - build up info from multiple lines local processor='unk' local NAME=$( cat ${CPUINFO} | grep \ -e '^cpu\W\W:' \ @@ -346,7 +346,7 @@ function tools_header { processor=${NAME} fi - # Determine processor speed (abort grep after first match) + # Determine processor speed (abort grep after first match) local speed='unk' local BOGO=$( cat ${CPUINFO} | grep -m1 -e ^BogoMIPS -e ^bogomips | \ awk 'BEGIN{FS=":";} {printf "%.1f", $2;}' 2>/dev/null ) @@ -362,14 +362,14 @@ function tools_header { speed=${BOGO} fi - # Determine OS and kernel version + # Determine OS and kernel version local os_name=$( uname -s 2>/dev/null ) local os_release=$( uname -r 2>/dev/null ) declare -a arr local dist_id="" - # Determine OS distribution ID + # Determine OS distribution ID if [ lsb_pres == "yes" ]; then arr=( $( lsb_release -i 2>/dev/null ) ) dist_id=${arr[2]} @@ -379,13 +379,13 @@ function tools_header { local dist_rel="" if [ lsb_pres == "yes" ]; then - # Determine OS distribution release + # Determine OS distribution release arr=( $( cat /proc/version | awk '{print $3}' 2>/dev/null ) ) local dist_rel=${arr[1]} else local dist_rel=$(cat /etc/centos-release | awk '{print $4}' 2>/dev/null) 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 " host:${HOSTNAME} Distribution:${dist_id} ${dist_rel} ${os_name} ${os_release}" 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 function tools_parse_options { - # check for no arguments, print usage + # check for no arguments, print usage if [ $# -eq "0" ]; then tools_usage tools_cleanup 0 exit 0 fi - # parse the input arguments + # parse the input arguments while getopts "fp:i:c:h" Option; do case $Option in f) @@ -459,7 +459,7 @@ function tools_parse_options { esac done - # validate input arguments + # validate input arguments PERIOD_MAX=$[4*24*60] INTERVAL_MAX=$[60*60] diff --git a/tools/engtools/hostdata-collectors/scripts/memstats.sh b/tools/engtools/hostdata-collectors/scripts/memstats.sh index 5ba340f0..dd88702a 100644 --- a/tools/engtools/hostdata-collectors/scripts/memstats.sh +++ b/tools/engtools/hostdata-collectors/scripts/memstats.sh @@ -17,7 +17,7 @@ OPT_USE_INTERVALS=1 # Print key networking device statistics function print_memory { - # Configuration for netcmds + # Configuration for netcmds MEMINFO=/proc/meminfo NODEINFO=/sys/devices/system/node/node?/meminfo BUDDYINFO=/proc/buddyinfo @@ -43,7 +43,7 @@ function print_memory { awk '/^Pss:/ {a += $2;} END {printf "%d MiB\n", a/1024.0;}' ${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}" ${CAT} ${SLABINFO} | \ awk -v page_size_B=${PAGE_SIZE} ' diff --git a/tools/engtools/hostdata-collectors/scripts/netstats.sh b/tools/engtools/hostdata-collectors/scripts/netstats.sh index c9be0a1e..d8e2b81c 100644 --- a/tools/engtools/hostdata-collectors/scripts/netstats.sh +++ b/tools/engtools/hostdata-collectors/scripts/netstats.sh @@ -15,7 +15,7 @@ OPT_USE_INTERVALS=1 # Print key networking device statistics function print_netcmds { - # Configuration for netcmds + # Configuration for netcmds DEV=/proc/net/dev NETSTAT=/proc/net/netstat diff --git a/tools/engtools/hostdata-collectors/scripts/postgres.sh b/tools/engtools/hostdata-collectors/scripts/postgres.sh index 340d0e42..ad16f307 100644 --- a/tools/engtools/hostdata-collectors/scripts/postgres.sh +++ b/tools/engtools/hostdata-collectors/scripts/postgres.sh @@ -18,16 +18,16 @@ function print_postgres { print_separator 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" - # List postgres databases + # List postgres databases db_list=( $(${PSQL} -t -c "SELECT datname FROM pg_database WHERE datistemplate = false;") ) ${ECHO} "# postgres databases" echo "db_list = ${db_list[@]}" ${ECHO} - # List sizes of all postgres databases (similar to "\l+") + # List sizes of all postgres databases (similar to "\l+") ${ECHO} "# postgres database sizes" ${PSQL} -c " SELECT @@ -38,7 +38,7 @@ FROM pg_database 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 ${ECHO} "# postgres database: ${db}" ${PSQL} -d ${db} -c " @@ -85,11 +85,11 @@ FROM pg_stat_user_tables; " done - # Specific table counts (This is very SLOW, look at "live tuples" instead) - # Number of keystone tokens - #${ECHO} "# keystone token count" + # Specific table counts (This is very SLOW, look at "live tuples" instead) + # Number of keystone tokens + #${ECHO} "# keystone token count" - # Number of postgres connections + # Number of postgres connections ${ECHO} "# postgres database connections" 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 ) diff --git a/tools/engtools/hostdata-collectors/scripts/rabbitmq.sh b/tools/engtools/hostdata-collectors/scripts/rabbitmq.sh index 2755024f..25d0992c 100644 --- a/tools/engtools/hostdata-collectors/scripts/rabbitmq.sh +++ b/tools/engtools/hostdata-collectors/scripts/rabbitmq.sh @@ -19,20 +19,20 @@ function print_rabbitmq { print_separator TOOL_HIRES_TIME - # IMPORTANT: - # - Difficulty getting rabbitmqctl to work from init.d script; - # apparently it requires a psuedo-TTY, which is something you don't have - # until post-init. - # - WORKAROUND: run command using 'sudo', even if you are 'root' + # IMPORTANT: + # - Difficulty getting rabbitmqctl to work from init.d script; + # apparently it requires a psuedo-TTY, which is something you don't have + # until post-init. + # - 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" ${ECHO} "# ${MQ_STATUS}" sudo ${MQ_STATUS} | grep -e '{memory' -A30 ${ECHO} - # THe following is useful in diagnosing rabbit memory leaks - # when end-users do not drain their queues (eg, due to RPC timeout issues, etc) + # THe following is useful in diagnosing rabbit memory leaks + # 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" ${ECHO} "# ${MQ_QUEUES}" sudo ${MQ_QUEUES} diff --git a/utilities/update-motd/source-debian/update-motd.sh b/utilities/update-motd/source-debian/update-motd.sh index c195ae3d..f1a3ccbc 100755 --- a/utilities/update-motd/source-debian/update-motd.sh +++ b/utilities/update-motd/source-debian/update-motd.sh @@ -12,7 +12,7 @@ eval_gettext() { # Only display this information in interactive shells 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 [ $(id -u) -eq 0 ] || SHOW="--show-only" update-motd $SHOW