Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP6
sapwmp.16404
supportconfig-sapwmp
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File supportconfig-sapwmp of Package sapwmp.16404
#!/bin/bash set -u version="1.0" function display_file() { echo -e "\n#==[ Configuration File ]===========================#" echo -e "# ${1}" if [ -e "${1}" ] ; then cat "${1}" else echo "${1} does not exist." fi } function display_rpm() { echo -e "\n#==[ Command ]======================================#" echo -e "# rpm -q ${1} " rpm -q "${1}" } function display_cmd() { echo -e "\n#==[ Command ]======================================#" echo -e "# ${@}" ${@} } function display_cgroup() { local f echo -e "\n#==[ Cgroup ]=======================================#" for f in memory.low memory.current memory.stat memory.events memory.swap.current ; do [[ -e "${1}/${f}" ]] || continue echo "# ${1}/${f}" cat ${1}/${f} echo done } function display_log() { local file echo -e "\n#==[ Log File ]=====================================#" for file in ${1} ; do if [ -n "${3-}" ] ; then echo -e "# ${file} - only pattern '${2}' (latest ${3} hits)" zgrep "${2}" "${file}" | tail -n "${3}" else echo -e "# ${file} - only pattern '${2}'" zgrep "${2}" "${file}" fi done } function display_instance_profiles() { local p profile echo -e "\n#==[ Configuration]================================#" # Extracts profile pathes from running processes. while read profile ; do [[ "${profile}" =~ /host_profile ]] && continue echo "# ${profile}" cat "${profile}" echo done < <( while read p ; do [ "${p:0:3}" = "pf=" ] || continue echo "${p:3}" done < <(ps -eo cmd | tr ' ' '\n') | sort -u ) } function display_swapped_procs() { local path pid comm swappss echo -e "\n#==[ Configuration ]================================#" echo "# /proc/[0-9]*/smaps - only SwapPSS > 0" printf " SwapPss Process\n------------- ---------------------------\n" for path in /proc/[1-9]* ; do # smaps take time, tolerate gone PIDs [ -d ${path} ] || continue pid="${path##*/}" read comm < /proc/${pid}/comm swappss=$(awk 'BEGIN { swappss = 0 } /^SwapPss:/ { swappss += $2 } END {print swappss}' "${path}/smaps") [ "0${swappss}" -eq 0 ] && continue printf "%10d kB %s[%d]\n" "${swappss}" "${comm}" ${pid} done } # ---- Main ---- echo "# Version: ${version}" display_cmd grep cgroup /proc/mounts display_file /proc/cmdline display_file /etc/default/grub display_rpm sapwmp display_file /etc/sapwmp.conf ( if [ -e /etc/sapwmp.conf ] ; then . /etc/sapwmp.conf if [ -n "${DEFAULT_SLICE:=}" ] ; then display_cmd systemctl cat "${DEFAULT_SLICE}" display_cmd systemctl show -p MemoryLow "${DEFAULT_SLICE}" while read subcgroup ; do display_cmd systemctl cat "${subcgroup##*/}" done < <(find "/sys/fs/cgroup/${DEFAULT_SLICE}" -mindepth 1 -maxdepth 1 -type d) else echo -e "\n#==[ Variable ]=====================================#\nDEFAULT_SLICE (/etc/sapwmp.conf) not set!" fi fi ) display_cmd systemctl status wmp-sample-memory.timer display_cmd systemctl cat wmp-sample-memory.timer display_instance_profiles display_cmd systemd-cgls --all --no-pager while read path ; do display_cgroup "${path}" done < <(find /sys/fs/cgroup/ -mindepth 1 -maxdepth 1 -type d) display_swapped_procs display_log '/var/log/messages*' sapwmp-capture 100 display_log '/var/log/messages' wmp_memory_current 100 # Bye. exit 0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor