50 lines
1.6 KiB
Bash
Executable File
50 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
|
|
|
|
# {{ ansible_managed | comment }}
|
|
|
|
# Colors definition [[[
|
|
BLACK='\033[49;30m'
|
|
BLACKB='\033[49;90m'
|
|
RED='\033[0;31m'
|
|
REDB='\033[1;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[0;33m'
|
|
BLUE='\033[94;49m'
|
|
MAGENTA='\033[0;35m'
|
|
CYAN='\033[36;49m'
|
|
WHITE='\033[0;37m'
|
|
BOLD='\033[1m'
|
|
RESET='\033[0m'
|
|
# ]]]
|
|
# Vars definition [[[
|
|
HOSTNAME=$(hostname)
|
|
NET_ADDR=$(ip -oneline -4 addr | awk 'BEGIN { ORS = " " } !/^[0-9]*: ?lo|link\/ether/ {print $4}')
|
|
KERNEL_VER=$(uname -r)
|
|
UPTIME=$(uptime | sed 's/.*up ([^,]*), .*/1/')
|
|
CORE_NUMBER=$(grep -c "model name" /proc/cpuinfo)
|
|
CPU_MODEL=$(grep -m1 "model name" /proc/cpuinfo | awk -F: '{print $2}')
|
|
MEM_FREE=$(grep MemFree /proc/meminfo | awk '{print $2}')
|
|
MEM_TOTAL=$(grep MemTotal /proc/meminfo | awk '{print $2}')
|
|
SWAP_FREE=$(grep SwapFree /proc/meminfo | awk '{print $2}')
|
|
SWAP_TOTAL=$(grep SwapTotal /proc/meminfo | awk '{print $2}')
|
|
# ]]]
|
|
|
|
#+++++++++++++++++++: System Data :+++++++++++++++++++
|
|
printf '%b' "${RESET}"
|
|
printf "${BLACKB}%33s${RESET}" | tr ' ' -
|
|
printf '%b' " ${CYAN}System Data${RESET} "
|
|
printf "${BLACKB}%34s${RESET}" | tr ' ' -
|
|
|
|
printf '%b' "
|
|
${BLACKB}+${WHITE} Hostname\\t\\t${BLACKB}= ${GREEN}${HOSTNAME}
|
|
${BLACKB}+${WHITE} Addresses\\t\\t${BLACKB}= ${GREEN}${NET_ADDR}
|
|
${BLACKB}+${WHITE} Kernel\\t\\t${BLACKB}= ${GREEN}${KERNEL_VER}
|
|
${BLACKB}+${WHITE} Uptime\\t\\t${BLACKB}=${GREEN}${UPTIME}
|
|
${BLACKB}+${WHITE} CPU\\t\\t\\t${BLACKB}= ${GREEN}${CORE_NUMBER}x${CPU_MODEL}
|
|
${BLACKB}+${WHITE} Memory\\t\\t${BLACKB}= ${GREEN}${MEM_FREE}(free)/${MEM_TOTAL}(total) kB
|
|
${BLACKB}+${WHITE} Swap\\t\\t\\t${BLACKB}= ${GREEN}${SWAP_FREE}(free)/${SWAP_TOTAL}(total) kB
|
|
"
|
|
|
|
printf '%b' "${RESET}"
|