#!/usr/bin/cbsi <% . /etc/version && . /etc/openwrt_release MEM_FREE=$(sed -e '/^MemFree: /!d; s#MemFree: *##; s# kB##g' /proc/meminfo | awk '{printf "%.2f", $1/1000}') MEM_TOTAL=$(sed -e '/^MemTotal: /!d; s#MemTotal: *##; s# kB##g' /proc/meminfo | awk '{printf "%.2f", $1/1000}') MEM_PERCENT=$(echo "${MEM_FREE} ${MEM_TOTAL}" | awk '{printf "%.2f", $1*100/$2}') UPTIME=$(cat /proc/uptime | cut -d '.' -f1) UPTIME_S=$(printf "%02d" $((UPTIME%60))) UPTIME_M=$(printf "%02d" $((UPTIME/60%60))) UPTIME_H=$(printf "%02d" $((UPTIME/60/60%24))) UPTIME_D=$((UPTIME/60/60/24)) if [ -f /sbin/swconfig ]; then BOARD=$(cat /tmp/sysinfo/board_name) case "${BOARD}" in routerstation-pro) SWPORTS="4 3 2" WANPORT="eth0";; *) SWPORTS="";; esac if [ "${SWPORTS}" != "" ]; then if [ "$(ethtool ${WANPORT} | grep "Link detected" | cut -d" " -f3)" == "no" ]; then STATUS="-----" IMG="off" else LINK=$(ethtool ${WANPORT} | grep "Speed" | cut -d" " -f2) IMG="on" case "${LINK}" in "1000Mb/s") STATUS="1 Gbit/s";; "100Mb/s") STATUS="100 Mbit/s";; *) STATUS="10 Mbit/s";; esac fi PORTNO="${PORTNO}
<%@ Router Model %> | <% [ -e /tmp/sysinfo/model ] && cat /tmp/sysinfo/model || %><%@ Unknown %> |
<%@ Chipset %> | <% cat /proc/cpuinfo | sed 2,20d | cut -c16- %> |
<%@ CPU Frequency %> | <% dmesg | grep Clocks: | awk -F: '{print $3}' | cut -d. -f1 %> MHz |
<%@ Flash Size %> | <% dmesg | grep m25p80 | grep Kbytes | cut -d '(' -f2 | cut -d ' ' -f1 | awk '{print $1/1024}' %> MB |
<%@ Firmware Version %> | <%: ${SYSTEM_VERSION} %>, <%@ built on %> <%: ${SYSTEM_BUILDDATE} %> |
<%@ OpenWrt Revision %> | <%: ${DISTRIB_REVISION} %> |
<%@ Current Date & Time %> | <% date "+%d/%m/%Y %H:%M:%S %Z" %> |
<%@ System Uptime %> | <%: ${UPTIME_D} %> <%@ days %>, <%: ${UPTIME_H}:${UPTIME_M}:${UPTIME_S} %> |
<%@ Total / Free Memory %> | <%: ${MEM_TOTAL} %> MB / <%: ${MEM_FREE} %> MB (<%: ${MEM_PERCENT}% %>) |
<%@ CPU Load (1 / 5 / 15 mins) %> | <% awk '{print $1 " / " $2 " / " $3}' /proc/loadavg %> |