SHELL BYPASS 403 |
Modern UI. Responsive. Powerful.

Faizzz-Chin Shell

: /usr/share/glusterfs/scripts/ [ drwxr-xr-x ]
Uname\Kernel: Linux server.kxo.bgz.mybluehostin.me 3.10.0-1160.119.1.el7.tuxcare.els19.x86_64 #1 SMP Mon Mar 31 17:29:00 UTC 2025 x86_64
Server: Apache
PHP Version: 8.2.28 [ PHP INFO ]
Operating System: Linux
Server Ip: 162.240.163.222
Your Ip: 216.73.216.114
Date Time: 2025-07-11 00:54:59
User: dilseshaadi (1027) | Group: dilseshaadi (1027)
Safe Mode: OFF
Disable Function: exec,passthru,shell_exec,system

name : collect-system-stats.sh
#!/bin/bash
################################################################################
# Usage: collect-system-stats.sh <delay-in-seconds>
# This script starts sar/top/iostat/vmstat processes which collect system stats
# with the interval <delay-in-seconds> given as argument to the script. When
# the script is stopped either by entering any input or Ctrl+C the list of
# files where output is captured will be printed on the screen which can be
# observed to find any problems/bottlenecks.
###############################################################################

function stop_processes {
        echo "Stopping the monitoring processes"
        echo "sar pid:$sar_pid", "top pid: $top_pid", "iostat pid: $iostat_pid", "vmstat pid: $vmstat_pid"
        kill "$sar_pid" "$top_pid" "$iostat_pid" "$vmstat_pid"
        echo "Files created: ${timestamp}-network.out, ${timestamp}-top.out, ${timestamp}-iostat.out, ${timestamp}-vmstat.out"
}

function check_dependent_commands_exist()
{
        declare -a arr=("sar" "top" "iostat" "vmstat")
        for i in "${arr[@]}"
        do
                if ! command -v "$i" > /dev/null 2>&1
                then
                        echo "ERROR: '$i' command is not found"
                        exit 1
                fi
        done

}

case "$1" in
    ''|*[!0-9]*) echo "Usage: $0 <delay-between-successive-metrics-collection-in-seconds>"; exit 1 ;;
    *) interval="$1" ;;
esac

timestamp=$(date +"%s")

check_dependent_commands_exist
sar -n DEV "$interval" > "${timestamp}"-network.out &
sar_pid="$!"
top -bHd "$interval" > "${timestamp}"-top.out &
top_pid="$!"
iostat -Ntkdx "$interval" > "${timestamp}"-iostat.out &
iostat_pid="$!"
vmstat -t "$interval" > "${timestamp}"-vmstat.out &
vmstat_pid="$!"
echo "Started sar, vmstat, iostat, top for collecting stats"


trap stop_processes EXIT
read -r -p "Press anything and ENTER to exit";
© 2025 Faizzz-Chin