LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-19-2009, 04:16 AM   #1
Roko
LQ Newbie
 
Registered: Sep 2008
Posts: 14

Rep: Reputation: 0
iptables help


hello. i have iptables rules on my home linux router and i want to do a statistic from it.

is it posible to send variables from iptables to web server and then work with this variables?

example:
when i type iptables -nvL on my router, this come up:

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

446K 91M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0

it say, that 91Mbyt has passed through my linux router to my PC. and i want to send value 91M to my web server and make statistic from it...

thanks
 
Old 01-19-2009, 06:16 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
You can use mrtg to create statistics from the router ( if the router support this)
http://oss.oetiker.ch/mrtg/
 
Old 01-19-2009, 07:57 AM   #3
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58
You might try:
BYTES_IN=$(/sbin/iptables -nvL INPUT | grep -m1 "ACCEPT all" | cut -b 7-11); echo $BYTES_IN > /tmp/bytesin

and refer to /tmp/bytesin on a web page. You could set a root cron to run the above every couple of minutes to have updated information in /tmp/bytesin

Dave

Last edited by david1941; 01-19-2009 at 05:22 PM. Reason: cut statement to use -b 7-11 as field size changes
 
Old 01-20-2009, 02:46 AM   #4
Roko
LQ Newbie
 
Registered: Sep 2008
Posts: 14

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by repo View Post
You can use mrtg to create statistics from the router ( if the router support this)
http://oss.oetiker.ch/mrtg/
but when i want to monitor two PC behind router, mrtg can not help me


david1941: thanks, this ist the right way
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables v1.2.9: Unknown arg `/sbin/iptables' Try `iptables -h' or 'iptables --help' Niceman2005 Linux - Security 4 12-29-2005 08:20 PM
Iptables - Couldn't load target `ACCPET':/lib/iptables/libipt_ACCPET.so: z00t Linux - Security 3 01-26-2004 02:24 AM
IPtables Log Analyzer from http://www.gege.org/iptables/ brainlego Linux - Software 0 08-11-2003 06:08 AM
iptables book wich one can you pll recomment to be an iptables expert? linuxownt Linux - General 2 06-26-2003 04:38 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration