added filter preferences to top of script
This commit is contained in:
parent
95aca53cfb
commit
5fe9a163e2
1 changed files with 16 additions and 4 deletions
|
|
@ -9,6 +9,19 @@
|
||||||
# Written by Alan "pyr0ball" Weinstock #
|
# Written by Alan "pyr0ball" Weinstock #
|
||||||
###############################################################
|
###############################################################
|
||||||
|
|
||||||
|
# Preferences:
|
||||||
|
|
||||||
|
# Network Adapter Preferences
|
||||||
|
display_disconnected=true
|
||||||
|
# separate adapter names with '\|' ex. "lo\|tun0"
|
||||||
|
filtered_adapters="lo"
|
||||||
|
|
||||||
|
# Disks
|
||||||
|
# separate disk types with '\|' ex. "sd\|nvme"
|
||||||
|
allowed_disk_prefixes="sd\|md\|mapper\|nvme\|mmcblk\|root"
|
||||||
|
disallowed_disks="boot"
|
||||||
|
|
||||||
|
# source PRbL functions
|
||||||
source $prbl_functions
|
source $prbl_functions
|
||||||
prbl_functons_req_ver=1.1.3
|
prbl_functons_req_ver=1.1.3
|
||||||
|
|
||||||
|
|
@ -264,19 +277,18 @@ fi
|
||||||
|
|
||||||
# Network display and filtering
|
# Network display and filtering
|
||||||
|
|
||||||
filtered_adapters="lo"
|
|
||||||
declare -a adapters=()
|
declare -a adapters=()
|
||||||
declare -a ips=()
|
declare -a ips=()
|
||||||
declare -a macs=()
|
declare -a macs=()
|
||||||
for device in $(ls /sys/class/net/ | grep -v "$filtered_adapters") ; do
|
for device in $(ls /sys/class/net/ | grep -v "$filtered_adapters") ; do
|
||||||
adapters+=($device)
|
adapters+=($device)
|
||||||
_ip=$(/sbin/ifconfig $device 2> /dev/null | grep broadcast | awk '{print $2}' | cut -f 2 -d ":" |cut -f 1 -d " ")
|
_ip=$(ip -f inet -o addr show $device | cut -d\ -f 7 | cut -d/ -f 1 | head -n 1)
|
||||||
if valid-ip $_ip ; then
|
if valid-ip $_ip ; then
|
||||||
ips=(${ips[@]} "$_ip")
|
ips=(${ips[@]} "$_ip")
|
||||||
else
|
else
|
||||||
ips=(${ips[@]} "${red}disconnected${dfl}")
|
ips=(${ips[@]} "${red}disconnected${dfl}")
|
||||||
fi
|
fi
|
||||||
macs+=("$(/sbin/ifconfig $device | grep ether | awk '{print $2}')")
|
macs=(${macs[@]} "$(cat /sys/class/net/${device}/address)")
|
||||||
done
|
done
|
||||||
|
|
||||||
# Begin echo out of formatted table with agregated information
|
# Begin echo out of formatted table with agregated information
|
||||||
|
|
@ -299,7 +311,7 @@ boxline " System Load: ${load_averages}"
|
||||||
boxline " CPU Temp: ${lbl}${cputemp}${dfl} | Utilization: ${lrd}${cpu_util}%${dfl}"
|
boxline " CPU Temp: ${lbl}${cputemp}${dfl} | Utilization: ${lrd}${cpu_util}%${dfl}"
|
||||||
boxline " Memory used/total: ${mem_usage}"
|
boxline " Memory used/total: ${mem_usage}"
|
||||||
boxline " Disk Usage:"
|
boxline " Disk Usage:"
|
||||||
for i in $(/bin/df -h | grep "sd\|md\|mapper\|nvme\|mmcblk\|root" | awk '{print $1}') ; do
|
for i in $(/bin/df -h | grep "$allowed_disk_prefixes" | grep -v "$disallowed_disks" | awk '{print $1}') ; do
|
||||||
boxline " `/bin/df -h | grep $i | awk '{print $5}'` $i: `/bin/df -h | grep $i | awk '{print $6}'`"
|
boxline " `/bin/df -h | grep $i | awk '{print $5}'` $i: `/bin/df -h | grep $i | awk '{print $6}'`"
|
||||||
done
|
done
|
||||||
boxline ""
|
boxline ""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue