Код скрипта cgi-snmp.sh


#!/bin/bash
# CGI script for SNMP statistic
# UUID: e5a1d8cd-d049-46aa-9745-c750f44cfdd2
echo Content-type: text/plain
echo ""

LOG_FILE=/var/www/stat/snmp.log

# Show NUM lines
if [ -n "$QUERY_STRING" ]; then
    NUM=$QUERY_STRING
else
    if [ -n "$1" ]; then
        NUM=$1
    else
	NUM=10
    fi
fi

echo "Current statistic:"
tail -n $NUM "$LOG_FILE" | sort -r
#------------------------------------------------------------