NetAdminTools.com
 
SignalQ Sites:
NetAdminTools - Coprolite - SpotBridge - NAW
RoboCoop - AreWeDown - SolarPower - SysAdminTools
Xfig - Gold Loaf - GeekPapa - FixGMC - FixRambler
Categories:
GNU/Linux | Homebrew designs | Perl | Ruby | Administration | Backup/Recovery | Bugs/Fixes | Certification | Database | Email | File/Print | Hardware | Information Grab Bag | Interoperability | GNU/Linux ABCs | Monitoring | Name Resolution | Network Services | Networking | Remote Control | Security | Desktop | Web | BSD | Solaris | GIAGD | ERP | REALbasic

Last 30 Days | Last 60 Days | Last 90 Days | All Articles | GNU/Linux Reference OS Build | MCJ How-to | MCJ Presentation Config | Keywords | RSS



Categories:
·GNU/Linux
·Homebrew designs
·Perl
·Ruby
·Administration
·Backup/Recovery
·Bugs/Fixes
·Certification
·Database
·Email
·File/Print
·Hardware
·Information Grab Bag
·Interoperability
·GNU/Linux ABCs
·Monitoring
·Name Resolution
·Network Services
·Networking
·Remote Control
·Security
·Desktop
·Web
·BSD
·Solaris
·GIAGD
·ERP
·REALbasic
·All Categories


Monitoring HTTP Connections
Topic:Monitoring   Date: 2006-04-25
Printer Friendly: Print

spacerspacer
<<  <   >  >>

Subject

NetAdminWorld is a simple console that can display network/systems statistics. Here is a perl script that determines the number of HTTP connections on a server, and displays the rusults on one of the seven segment displays on the NetAdminWorld console:

 
open (HC, "ssh -p <port> root\@example.com 'netstat | grep http | wc -l '|");
while (<HC>){
$count=$_/6
}
use IO::Socket;
my $sock = new IO::Socket::INET (
PeerAddr => 'localhost',
PeerPort => '27183',
Proto => 'tcp',
);
die "Error: $!\n" unless $sock;
print $sock "g01r1Primary External Web..";
print $sock "g01t3HTTPC/6..";
$answer=<$sock>;
if ($count << 1){
printf $sock ("g01s316..");
$answer=<$sock>;
printf $sock ("led010..");
}
elsif ($count > 15){
printf $sock ("g01s317..");
$answer=<$sock>;
printf $sock ("led013..");
}
elsif ($count < 10){
printf $sock ("g01s3%.1u..",$count);  
$answer=<$sock>;
printf $sock ("led010..");
}
else {
printf $sock ("g01s317..");
$answer=<$sock>;
printf $sock ("led012..");
}
$answer=<$sock>;
close($sock);

This is what the result looks like:



For results higher than 9, an H is written, and the LED flashes slowly as an alert. For results lower than 1, an L is written, and for results higher than 15, an H is written, and the LED flashes quickly. This can be tailored specifically to what you want to monitor. Really, the scale of anything should be 1-9, with alerts at either end that escalate. Further logic could be built in for alerting, etc. If you find canned packages to be too limiting in your scrappy environment, perhaps this will help.


People:
Places:
Things:
Times:





Please read our Terms of Use and our Privacy Policy
Microsoft, Windows, Windows XP, Windows 2003, Windows 2000, and NT are either trademarks or registered trademarks of Microsoft Corporation. NetAdminTools.com is not affiliated with Microsoft Corporation. Linux is a registered trademark of Linus Torvalds, and refers to the Linux kernel. The operating system of most distributions that contain the Linux kernel is GNU/Linux. All logos and trademarks in this site are property of their respective owner. Copyright 1997-2010 NetAdminTools.com