birmingham@ic.fbi.gov , phoenix@ic.fbi.gov , fbise@leo.gov
NickSoft Linux Cookbook Index NickSoft Linux Cookbook
Quick howto's, Real live examples.
 
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Monitor established TCP connections with mrtg

 
Post new topic   Reply to topic    NickSoft Linux Cookbook Index -> MRTG
View previous topic :: View next topic  
Author Message
NickSoft
Site Admin


Joined: 13 Nov 2006
Posts: 22

PostPosted: Wed Apr 18, 2007 10:40 pm    Post subject: Monitor established TCP connections with mrtg Reply with quote

It's good to monitor established TCP connections. For example if you have web server and you see too many connections it means that you may have troubles with web spiders or spider like software for downloading whole sites. This doesn't always cost you more bandwidth, but it can overload apache server (or other web server software).
To monitor established connections you need started snmp daemon. For redhat based (or other yum enabled) OSs you can use yum to install net-snmp package:
Code:
yum install net-snmp


Be carefull - on fedora core 5 net-snmp continuously consumes more memory. If you use FC 5 you should restart snmpd periodically. You can put this in your crontab:
0 6 * * * /sbin/service snmpd restart >/dev/null 2>/tmp/snmpd-restart-error.log

Configuration of snmpd is simple:
edit /etc/snmp/snmpd.conf (default location on most distros) and write this:
Code:
rocommunity  public 127.0.0.1


Then enable the snmp daemon.
For redhat based distributions:
Code:
chkconfig --level 345 snmpd on
service snmpd restart

or just start it in your rc.local

here is example mrtg.cfg for monitoring tcp connections():

Code:
# you may need to change paths.
HtmlDir: /var/www/mrtg
ImageDir: /var/www/mrtg
LogDir: /var/lib/mrtg
ThreshDir: /var/lib/mrtg
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt,/usr/share/snmp/mibs/TCP-MIB.txt

Target[server.estabcons]: tcpCurrEstab.0&tcpCurrEstab.0:public@localhost
Title[server.estabcons]: Currently Established TCP Connections
PageTop[server.estabcons]: <H1>Established TCP Connections</H1>
MaxBytes[server.estabcons]: 10000000000
ShortLegend[server.estabcons]:
YLegend[server.estabcons]: Connections
LegendI[server.estabcons]: In
LegendO[server.estabcons]:
Legend1[server.estabcons]: Established connections
Legend2[server.estabcons]:
Options[server.estabcons]: nopercent,gauge


Then create indexes:

Code:
indexmaker /etc/mrtg/mrtg.cfg >/var/www/mrtg/index.html


Start mrtg as daemon or in crontab (See mrtg howto)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NickSoft Linux Cookbook Index -> MRTG All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




MLDb.org Magic Eight Ball Croler Web Search Croler Web Directory Bianca Ryan MyBestMatch.net Microlab.info Digger Services Sofia

Powered by 220V

AbuseIPDB Contributor Badge