What do you use as a system monitor - Servers Administration, Networking, & Virtualization

Users browsing this thread: 1 Guest(s)
prx*
Members
Hi,
On OpenBSD, I use this little script to output in tmux status or dwm's bar various info : mpd current song, battery remaining, audio volume, date. There are also functions for disk usage, cpu and ram that I actually don't use (top/vmstat/systat are good for this)

[Image: oKVt.png]

Code:
fs_perc()
{
    df -h $1 | awk 'NR==2 {print $5}'
}

get_vol()
{
    sndioctl output.level | awk -F = '{printf "%d\n",$2*100}'
}

ram() {
    top | awk '/Memory/ { print $3 }'
}

loadavg()
{
    #uptime | awk -F'[a-z]:' '{print $2}' | tr -d ' '
    sysctl -n vm.loadavg
}

bat()
{
    apm | awk 'NR==1 && !/absent/ {printf "%s", $4}'
    #test $(apm -a) -eq 0 && printf "⚡%s%%" $(apm -l)
}

mpdstatus()
{
mpc | awk '
(NR == 1) {
    status = $0
    if (length(status) > 42) {
        status = substr($0, 1, 42) "..."
    }
}
(NR == 2) && /playing/ {
    isplaying = 1
}
END { if (isplaying) { printf "[%s]", status } }
'
}

temp()
{
    sysctl hw.sensors | awk -F"=" '{print $2; exit}'
}

printf "%s / ⚡ %s / 🔈 %s / %s" \
     "$(mpdstatus)"\
     "$(bat)" \
     "$(get_vol)%" \
     "$(date "+📅 %Y-%m-%d / 🕓 %H:%M")"


Messages In This Thread
What do you use as a system monitor - by venam - 10-02-2022, 01:22 PM
RE: What do you use as a system monitor - by movq - 12-02-2022, 04:51 AM
RE: What do you use as a system monitor - by pfr - 14-02-2022, 10:31 PM
RE: What do you use as a system monitor - by VMS - 15-02-2022, 01:14 PM
RE: What do you use as a system monitor - by jkl - 21-02-2022, 11:31 AM
RE: What do you use as a system monitor - by prx* - 24-02-2022, 06:02 PM
RE: What do you use as a system monitor - by gaak - 31-10-2022, 04:21 AM