Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2002 15:36:17 -0500
From:      Sean O'Neill <sean@seanoneill.info>
To:        Patrick Thomas <root@utility.clubscholarship.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: per IP traffic statistics (totals)
Message-ID:  <5.1.0.14.0.20020516153114.00b17e90@postoffice.swbell.net>
In-Reply-To: <20020516131649.C79837-100000@utility.clubscholarship.com>
References:  <20020516214027.L58681-100000@lion.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
At 01:17 PM 5/16/2002 -0700, Patrick Thomas wrote:

>Do you know of any tools (like ipa) that will collect per-IP traffic
>totals and allow me to display on the web ?  I am not a cgi programmer..
>
>thanks.

It really not that hard - at a simple level its pathetically easy.

Create a script that displays your stats.  I have one to display stats for 
IPFilter on my Solaris box.  Make sure CGIs are enabled in your apache 
config, stick the script in your apache cgi-bin directory (or where ever 
CGI's are enabled for you), make the script executable, and hit the cgi-bin 
URL for the script.

This is my script.  See - its easy.

#!/bin/ksh

# disable filename globbing
set -f

echo Content-type: text/plain
echo

IPFLOG=/var/adm/ipflog

echo "BLOCK"
echo "-----"
grep "$(date "+%b %e")" ${IPFLOG} | grep -v qpopper | /usr/local/bin/perl 
/opt/ipf/bin/plog -nAF block
echo "PASS"
echo "----"
grep "$(date "+%b %e")" ${IPFLOG} | grep -v qpopper | /usr/local/bin/perl 
/opt/ipf/bin/plog -nAF pass
echo "LOG"
echo "---"
grep "$(date "+%b %e")" ${IPFLOG} | grep -v qpopper | /usr/local/bin/perl 
/opt/ipf/bin/plog -nAF log
echo "SHORT"
echo "-----"
grep "$(date "+%b %e")" ${IPFLOG} | grep -v qpopper | /usr/local/bin/perl 
/opt/ipf/bin/plog -nAF short
echo "NOMATCH"
echo "-------"
grep "$(date "+%b %e")" ${IPFLOG} | grep -v qpopper | /usr/local/bin/perl 
/opt/ipf/bin/plog -nAF nomatch

You want fancy HTML formatting around your output - have at it.  Simple to 
update this script to include HTML formatting for tables, frames, whatever.


--
........................................................
......... ..- -. .. -..- .-. ..- .-.. . ... ............
.-- .. -. -... .-.. --- .-- ... -.. .-. --- --- .-.. ...

Sean O'Neill


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.1.0.14.0.20020516153114.00b17e90>