LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-06-2010, 03:01 PM   #1
sanketdangi
LQ Newbie
 
Registered: Jan 2010
Posts: 4

Rep: Reputation: 0
Store Network Traffic in MySql Database ???


Hey all,
I am working on a project on Green Computing.What i need to do is store the no. of requests hitting server during in a day in database.That is,in every 15 mins i have to store total hits during that duration in database,so that i can obtain network traffic pattern !!!

I am not able to find a way to do so....

Plz suggest sumthing !!!

Regards
Sanket !!!
 
Old 03-06-2010, 05:11 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Assuming you're running Apache, have you considered parsing the http requests log?

Something like (shell example):
Code:
count = $(sed -e "/$START,$END/" $LOGFILE | wc -l)
Also, I'd strongly recommend writing this in something like Perl or Python:

a) scripts are faster/easier for jobs like this
b) Python and Perl have all the flexibility of shell scripts, but they also make it easy to talk to mySQL
c) examples/tutorials for Python and Perl are abundant - you can literally have something up/running in an afternoon (if you've never used them before), or an hour or less (if you already know one or both of these languages).

'Hope that helps .. PSM
 
Old 03-06-2010, 05:25 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by sanketdangi View Post
Hey all,
I am working on a project on Green Computing.What i need to do is store the no. of requests hitting server during in a day in database.That is,in every 15 mins i have to store total hits during that duration in database,so that i can obtain network traffic pattern !!!

I am not able to find a way to do so....

Plz suggest sumthing !!!

Regards
Sanket !!!
I'll suggest you spell out your words.

And if you need this, consider looking into Nagios, or other system-monitoring tools for Linux that are out there. They already providing trending, graphs, etc., and are ready to go.

Also, you don't say what KIND of requests, hitting what kind of server, running what version/distro of Linux, etc.
 
Old 03-07-2010, 04:27 AM   #4
sanketdangi
LQ Newbie
 
Registered: Jan 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Hey,

Thanks for your replies....

I am working on Ubuntu....have to do this project on heterogeneous servers...so basically whenever there is some low load on servers,we have to switch some servers to hibernation and switch them back to normal working mode when no. of requests is high...hav to take this decision using historical data .. thats why want the no. of requests hitting any server(webserver,ftp,mail etc etc )....and from requests i mean to say client requests !!!!

I have looked into various tools but none of them provides no of requests hitting any server..they talk about bytes of data transferred,network usage etc...

Plz suggest sumthing !!!
 
Old 03-07-2010, 11:37 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by sanketdangi View Post
Hey,

Thanks for your replies....

I am working on Ubuntu....have to do this project on heterogeneous servers...so basically whenever there is some low load on servers,we have to switch some servers to hibernation and switch them back to normal working mode when no. of requests is high...hav to take this decision using historical data .. thats why want the no. of requests hitting any server(webserver,ftp,mail etc etc )....and from requests i mean to say client requests !!!!

I have looked into various tools but none of them provides no of requests hitting any server..they talk about bytes of data transferred,network usage etc...

Plz suggest sumthing !!!
Again SPELL OUT YOUR WORDS. And "client requests" is very broad.

Nagios and other tools measure throughput, but if you want to measure the different protocols, you'll have to install something like MRTG, and write something to monitor all the different network protocols, and graph them.
 
Old 03-07-2010, 01:31 PM   #6
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Or you can follow my original suggestion and "grep" the darned http access log
 
Old 03-07-2010, 08:29 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
... and for all services, use the LOG option in iptables and use Perl to pull out nums for each service and put in DB. Note that this is going to use a fair bit of disk space, so be prepared to tweak the logrotate settings
 
  


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
store list items written in cgi script to mysql database gsr_kashyap Programming 5 01-28-2009 01:08 AM
Should I store CC numbers in my database? NaCo General 7 12-30-2008 09:51 AM
How to configure Sendmail to store mail in a MySQL database moenterprise Linux - Server 0 08-24-2007 11:59 PM
Store IMAP emails in mySQL database dlublink Linux - Networking 1 01-07-2005 04:00 PM
libnss-mysql (Store your UNIX user accounts in MySQL) markus1982 Linux - Security 0 01-26-2003 02:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:23 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