Archive for the ‘linux’ category

Automatic Web Server Monitoring

February 15th, 2011

Hi there! Here’s another quick suggestion for all of you out there who have to deal with a lot of web server environments and need to make sure that they’re all alive and responsive. Sure there are all sorts of tools for server monitoring and performance tracking, but I found that most of the time you just need to know if the server is up & running. And of course you should be notified if it’s not. Here’s my short Python script that does just that. You will need to tweak it a little to use in your environment. First of all I’ve set the content threshold to 2000 Bytes which means that the expected length of the page content returned is no less than 2000 Bytes. If it’s below this value, one could assume that something’s fishy going on. You might want to change this value to something else depending on what your web server returns. Another thing that you’ll want to change is the servers dictionary in the main() method. The logic behind this is that each of the web servers is assigned a responsible person that you would need to inform if something is wrong with the server. You should list all your servers that need to be monitored and the responsible person’s e-mails. The final change is on the line where you instantiate the HeartbeatMonitor class. The first parameter admins is a list of e-mails of the people who will receive the notification if any of the servers are down. You can leave this list empty if you want, but I usually put my e-mail in there since I like to be in the loop. The second parameter mailServer is the SMTP server which will be used to send notifications so make sure this one is set correctly. This parameter is actually optional and localhost will be used as the default mail server if you decide to skip it.

Linux GUI on Your Windows Desktop Through the Magic of Xming

May 18th, 2010

I decided to write down a short introduction to Xming. For those not in the know Xming is an implementation of the X Window System for Microsoft Windows operating systems. This means that you can install this software on Windows, run a remote linux program that requires a graphical interface and see the result on your local computer. Visit the Xming home page and see the screenshots if it seems difficult to wrap your mind around the concept.

Download the latest version of Xming software from their home page and install it. Prepare the remote linux machine by connecting to it via SSH and checking if the file /etc/ssh/sshd_config contains an uncommented line

Compiling Apache httpd from Sources

May 17th, 2010

This is yet another post on Apache httpd server installation and configuration. I say another because I’ve already written about how to install the packaged version of Apache for two specific linux distros. This time I’ll quickly jot down how I configured and compiled Apache for my needs. There are a few reasons to do this. One of the more important ones being to have a newer version of Apache. It seems that prepackaged Apache versions for some linux distributions can be quite out of date. This in turn means that you don’t get the benefits of the improved newer version and more importantly leave your server vulnerable to know exploits. While having the newest version of Apache is not a guarantee that your server is well secured it sure helps. Download the unix source file httpd-2.2.15.tar.gz from the Apache httpd page to your linux server where you’ll be compiling it. Explode the downloaded file and change the directory using the commands

Apache HTTP server (SSL) + Tomcat 6.x on Ubuntu and CentOS

April 25th, 2010

The Environment

From time to time I need to do some Apache httpd + Tomcat installations on Linux servers and usually they come in different flavors. While you’re still experimenting it’s a good idea to use a pre-installed Linux on a virtual machine. I’m using the free VMware player to run virtual appliances, a list of which can be found on VMware page. Personally I like the clean Linux installations without any extras, this way you can install anything you need and create multiple virtual machines of the same Linux flavor with different purposes if you need to. My preferred versions are the Debian based Ubuntu 9.04 server and the CentOS which is a community-supported OS based on Red Hat Enterprise Linux. Sometimes you get a pre-installed server for development and you’re not sure what kind of Linux flavor is on it. Usually a simple uname -a helps, but sometimes it spits out something vague like