Here is an updated basic bash script originally created by ummeegge, which is designed for basic network and system monitoring. The updated version now checks for necessary addons and installs them if not found, among other improvements.
What is required
Some addons, as mentioned the script now checks for and installs them if they are not found using Pakfire.
Homepage | execution | Status |
---|---|---|
Iftop | iftop | Add-on |
libstatgrab | saidar -c | Core Package |
bwm-ng | bwm-ng | Add-on |
htop | htop | Add-on |
#!/bin/bash
# Original concept and script by ummeegge
RED="\033[0;31;40m"
WHITE="\033[1;37;40m"
CYAN="\033[1;36;40m"
RESET="\033[0m"
# Got what we need?
declare -a tools=("saidar" "bwm-ng" "iftop" "htop")
for tool in "${tools[@]}"; do
if ! command -v $tool &> /dev/null; then
echo -e "${RED}Oops, $tool is missing. Let's fix that.${RESET}"
pakfire install $tool --non-interactive
fi
done
# Basic system info
current_date=$(date)
hostname=$(hostname)
ip_address=$(awk -v host="$hostname" '$0 ~ host {print $1}' /etc/hosts)
# A fancy line to separate stuff
draw_line() {
echo "=========================================================================================================================="
}
# Run monitoring tools
run_tool() {
local tool=$1
local desc=$2
draw_line
echo -e "${WHITE}$tool time!${RESET}"
echo "$desc"
echo -e "${RED}Wanna quit? Press [q]. Need help? Press [h].${RESET}"
read -p "Smash that [Enter] to start $tool..."
$tool
}
# Run monitoring tools
clear
echo -e "${WHITE}NETWORK MONITORING TIME!${RESET}"
echo -e "${CYAN}Details: $current_date, IP: $ip_address, Host: $hostname${RESET}"
echo -e "${RED}Bye-bye with [Ctrl+C]${RESET}"
sleep 3
# Run monitoring tools
run_tool "saidar" "See what your system's up to."
run_tool "bwm-ng" "How's the bandwidth?"
run_tool "iftop" "Who's hogging the network?"
run_tool "htop" "What are your processes doing?"
# Exit
echo -e "${CYAN}Details: $current_date, IP: $ip_address, Host: $hostname${RESET}"
echo "End"
After dropping / creating the script must be made executable:
chmod +x network_info.sh