[ previous ] [ next ] [ threads ]
 From:  Paul Taylor <ptaylor at addressplus dot net>
 To:  m0n0wall dash dev at lists dot m0n0 dot ch
 Subject:  ipfstat diags page - termcap issue
 Date:  Thu, 11 Aug 2005 20:34:18 -0400

     Today I started working on an ipfstat diagnostics page for  
Monowall so we can easily see what's going on inside Monowall.  If  
you have SSH in your Monowall installation, then you should try  
running "ipfstat -t" if you aren't already aware of it, and if you  
have a termcap file.  It runs in interactive mode, sort of like top,  
except it shows the state table.  You can watch a particular session  
as bytes and packets increment up, change the sort order, etc.

     Anyhow, I found a way to execute it via php, providing that I  
have an appropriate termcap file on the monowall machine...  The  
command is something like this:  export TERM=dumb && echo q | /sbin/ 
ipfstat -t

     Now, you don't want to run it like that in exec.php because you  
would need to heavily parse the data to see what's happening.

     That command will cause it to run and immediately exit after  
putting up the first page of data.

     Now, if you don't have a termcap file (which I believe is the  
case by default with monowall) that won't work...  Running it just as  
"echo q | /sbin/ipfstat -t" won't work either, complaining about not  
knowing what an "unknown" terminal is.

     In the termcap file, there is a terminal definition for a "dumb"  
terminal, which is a very minimal definition.  I've figured out how  
to parse the data nicely into a table when called via this "dumb"  
terminal.  To really see what is going on in the state table,  
however, you need the li# option set to a large number.. (Default is  
25 lines, but that doesn't show you much about the state table,  
unless you just have a home network behind your monowall)...  With it  
set to something like 1000 lines or so, you can get a good bit of the  
state table displayed nicely.   We had over 130 entries this evening  
displayed this way.

     Anyhow, I'm looking for a way to be able to define a termcap  
definition from a command line, so that I can put together a single  
command line which sets up the terminal properly and executes the  
commands to give me an ipfstat page...  This would let it work  
without having to put a termcap file on a monowall image...  (My  
partner put one on our image, which is how we found out what a nice  
tool this is.)

     For my image, I've already got a basic diags page working in  
this manner.  I'm still working on this page, but at this point I  
have it sorting by column header...  I plan to put in the ability to  
click on an icon to filter for a particular source or destination IP  

     Any assistance would be greatly appreciated.