Monitoring Apache Connections And Proceses With MRTG

David Horwitz 02 March, 2009 10:29 General, Sakai, Open Permalink Trackbacks (0)

When running web based applications with Apache as a front end it is useful to monitor the number of connections on Apache and number of Apache processes. Under certain conditions Apache can spawn extra proccesses and many of theem indicated reduced QOS for your end users. They include:

  1. The back end aplication taking too long to process requests
  2. network related problems
  3. resource contention on the box hosting Apache.
Its pretty easy to monitor this using MRTG.  First a simple perl script:


#! /usr/bin/perl

use strict;

my $connections = `netstat -n | grep EST | grep "137.158.155.8:443 " | wc -l`;
my $processes = `ps ax | grep -c httpd`;

chomp($connections);
chomp($processes);

print $connections . "\n";
print $processes . "\n";

Edit the ip address to match your host. This will give you a count of connections and processes. Next the MRTG conf:

 

# Created by
# /usr/local/bin/cfgmaker public@localhost

### Global Config Options

#  for UNIX
WorkDir: /srv/www/vhosts/vula.uct.ac.za/mrtg/
IconDir: /mrtg/icons/

### Global Defaults

#  to get bits instead of bytes and graphs growing to the right
Options[_]: growright, noinfo, nopercent, integer, gauge

EnableIPv6: no

### Interface 1 >> Descr: 'em0' | Name: '' | Ip: '137.158.128.44' | Eth: '' ###

MaxBytes[_]: 4061814272
ShortLegend[_]:  
YLegend[_]: https connections
AddHead[_]: <link href="/library/skin/default/tool.css" type="text/css" rel="stylesheet" media="all" />
PageFoot[_]: </div>
kilo[_]: 1024

Target[https-connections]: `/usr/local/sakaiscripts/https-connections.pl`
Title[https-connections]: HTTPS Connections
PageTop[https-connections]: <div class="portletBody"><H3>HTTPS Connections</H3>
LegendI[https-connections]: &nbsp;connections:
LegendO[https-connections]: &nbsp;httpd processes:
Legend1[https-connections]: HTTPS connections (5 min interval)
Legend2[https-connections]: httpd processes
Legend3[https-connections]: Maximal HTTPS connections (5 min interval)
Legend4[https-connections]: Maximal httpd processes
WithPeak[https-connections]: wmy

 

once again make sure the WorkDir and traget paths match the paths for your instalation. Workdir needs to be accesible via a browser (as MRTG will output to this directory). Now test your script by running:

env LANG=C /usr/bin/mrtg /usr/local/sakaiscripts/https-connections.cfg

Note MRTG will give warnings about the history files missing the first two times you run it. After that it should be silent. Finaly add the line to your crontab to run every 5 minute.

 

 


Patents, Patents, Patents

David Horwitz 29 March, 2008 10:55 General, Open Permalink Trackbacks (0)

Software patents seem to have dominated the news this week. First up the good news: the US patent office has overturned all 44 claims in Blackboard's patent, this is a prelimanary finding so open to apeal by Bb but still a very significant one.

Next up is a piece of news that is more confusing. The South African Minister of Public Services and Administration, Geraldine Fraser-Moleketi, gave a speech (video) at the opening of the Idlelo Conference in Dakar, Senegal.  In this she rightly savages thevery notion of software patents, highlightig that they pose a significant threat to software development in Africa. She hit the nail on the head with this line "there’s no reason to believe that society benefits from such monopolies being granted for computer programs [and inventions]” and corectly IMHO identified that the companies seeking patents where aiming to excleude compatition rather than foster inovation. 

Now if I agree so heartily with what she said why did I flag this as confusing? Well because it makes one wonder if our cabinet ministers are talking to each other. This is being directly contradicted by the "Intellectual Property Rights from Publicly Funded Research Bill", being promulgated by the Department of Science and Technology, This bill, which we are told has the backing of cabinet, will efectivly force all outputs of publicly funded reaearch to be patented. The latest draft in circulation (but not on the DST's website) includes software in its definition of research output. Now not only as the minister said this serves no public good it will prevent all public universities from taking part in open source projects, as it at the very least muddies the IPR in any code we may choose to contribute. Interestingly in this aspect the bill is in conflict with a number of the DST's policies


Why The Journal?

David Horwitz 08 March, 2008 11:01 General, Open Permalink Trackbacks (0)

This is a fight I have been looking to start for some time. It comes from discussion about where we should be looking to publish our research outputs and reading about the restoration period in Europe (triggered in turn by reading Neil Stephenson's Baroque Trilogy).

The central question is this: “Why are we still talking about Journal, particularly electronic journals in the age of the Internet?” The academy seems to have a fixation on this example of 18th Century technology, and seems loath to face up to the fact that this specific from of publishing is now redundant. Now what do I mean by journal, and I am talking here about scholarly journals:

  1. The are bound – they contain a set number of articles

  2. the are periodic – they are produced at set intervals

  3. the articles conform to set, and strict, guidelines as to their length

We can quite clearly see the format of the print world being mimicked in the electronic world. Now when producing a physical artifact that needs to be distributed over distances, publishers need to be aware of size and weight restrictions, the cost of production is influenced by the length. These are restrictions that have existed since the birth of the scholarly journal, in the late 17th century. The scholarly societies needed a way to communicate with members not at their meetings, and like minded individuals across Europe. Printing technology had reached a point where this could be done and by the start of the 18th Century journals where produced in London (Philosophical Transactions of the Royal Society), Paris and Berlin.

With the advent of the Internet the economics have changed radically, information is no longer a scarce commodity. The you publish a specific article doesn't mean that you won't be publishing another. The fossilized journal article also a poor form for a hypertext environment – why not link to your data, your sources, include video? With the opportunities offered by the Internet we have the potential to make scholarly information available on a scale never imagined a mere 20 years ago, instead we seem to be cleaving to forms that are guaranteed to ensure the ongoing scarcity of information while simultaneously ensuring that much important information is not made available till after its obsolete.


Deep Goolgle Dissapointment

David Horwitz 17 February, 2008 13:49 General, UCT, Open Permalink Trackbacks (0)

I've alway been a fan of Google from redefining search, the way they revolutionised webmail with Gmail, to Google maps and Google earth. So I was one of the people deeply exited when Google launched Gtalk based on the Jabber/XMPP protocol - rather than re-inventing the wheel used a well established open protocol, rather than a gaed community they created one that could interact with anyone th had a Jabber server. 

Now comes the disapointment - last Friday it seems Google's chat servers stoped talking to other chat server. The causes are not clear - our servers are talking to theirs theirs, but theirs are mute , refusing to talk back.  The problem has been discussed on the Gtalk-open forum, but it appears despite herding people that way on their support forums no one from Google actualy reads the list. As a system administrator I consider it a basic professional courtesey to inform other administrators that their systems appear not to be working. So after working through several pages of useless help information about the Gtalk client I finaly managed to submit a problem to Google and got the obligatory automated response [ref 240328311]. Four days later i actually got a response, problem was it completly missidentified the problem as a google apps problem, since then nothing. Well Google this is not the way to make friends and influence people!

While I'm gripping about commercial chat providers (IM/MSN/yahoo) let me vent my current peeve - most of these service will only allow you to login from one location, a policy that probably made sence in the early 90's, but in todays world just doesn't work. Microsoft why should I get errors when I switch my Xbox on because my computer is on at the same time? Get with the program - XMPPas a protocol has allowed people to log in from mulitiple locations for some time ...


1 2 3  Next»

Powered by LifeType
© 2006 - Design by Omar Romero (all rights reserved)