Advertisment

Monitor Linux 

author-image
PCQ Bureau
New Update

Monitoring a Linux server is considered a big task. But a careful search over the Internet will reveal some tools, which are quite easy to set up. We look at three such packages.

Advertisment

If you want a quick peak on the system information such as load, users logged in, disk space etc, phpSysInfo comes handy. Following are the steps to set it up on a server running PCQLinux 2004. Download the latest version of phpSysInfo from

http://phpsysinfo. sourceforge.net.

Extract the downloaded archive, which will generate a directory named phpsysinfo-dev. Assuming that you are running Apache Web server on the Linux server, you will need to install PHP to run phpSysInfo. For this install the RPM named php-4.3.3-6.i386.rpm found in the directory PCQLinux/RPMS on PCQLinux CD 1. Move the contents of the directory phpsysinfo-dev to a directory named phpsysinfo under /var/ www/html.

Direct Hit!
Applies

to:
System Administrators
USP:

Easy to install monitoring tools
Links:

http://phpsysinfo.sourceforge



net/, http://awstats.sourceforge.net/,
http://web.wt.net/~billw/gkrellm/gkrellm.html 
Advertisment

Launch a Web browser and load up http:///phpsysinfo/.

A simple, almost page long information, will greet you. But don't get intimidated by the length. If you skim through the page, you will find all the vital information about your server-load average, number of logged in users, free space, memory usage, network usage and kernel version (do you need to upgrade?).

AWStats comes in to the picture when you want to know how well the Apache Web server serves your website visitors-how many hits, unique visitors, what kind of browsers are accessing your Web server, IP addresses of the visitors, data transfer and so on. You can download the RPM for AWStats from

http://prdownloads.sourceforge.net/awstats/

awstats-6.2-1.noarch.rpm. Issue the following commands to install it.

rpm -ivh awstats-6.2-1.noarch.rpm

Advertisment

Change to the directory /usr/local/awstats/tools and issue:

./awstats_configure.pl

Monitoring packages

  • phpSysInfo
  • AWStats
  • GKrellM
Advertisment

This will ask you a couple of questions to set up AWStats. When prompted for 'Config file path' type in /etc/httpd/conf/httpd.conf. For 'Build a new AWStats config/profile file', type in y. For profile name, type in Web. Press Enter for the config file path, which installs the configuration files at /etc/awstats. Finally, press Enter to finish.



Open the file awstats.web.conf found in /etc/awstats in a text editor. Change the line:

LogFile="/var/log/httpd/mylog.log"

to

Advertisment

LogFile="/var/log/httpd/access_log"

Save the file. Again change to the /usr/local/awstats/tools directory and issue:

./awstats_updateall.pl now

Advertisment

Now you can see the stats of your Web server by loading up the following URL in a Web browser

http:///awstats/awstats.pl?config=web.

You will have to run the awstats_updateall.pl every time you want the latest statistics. Alternatively you can create a file called awstats.sh with the following content:

/usr/local/awstats/tools/awstats_updateall.pl now

Advertisment

Give the file executable permissions as

chmod +x awstats.sh

and place it in the directory /etc/cron.hourly. This will automatically run the awstats_updatell.pl after every hour.

The previous two packages- phpSysInfo and AWStats-are both Web based and you will need to launch a Web browser and load up the URL to the stats page to see the reports. Think of a small application, which always runs on your desktop, reflecting the latest stats without refreshing the page and without running any stats update script. GKrellM does exactly this.



Download its latest version from http://web.wt.net/~billw/gkrellm/gkrellm-2.2.4.tar.bz2.
Extract the downloaded archive as:

tar -jxvf gkrellm-2.2.4.tar.bz2

This will generate a directory named gkrellm-2.2.4. Change to this directory and issue the following:

make



make install

GKrellM is a client-server based application. That is, you will need to run the GKrellM server on the Linux machine you want to monitor. The client part of GKrellM is a graphical desktop application that will sit on a Windows or Linux desktop and show the stats delivered to it by the GKrellM server. To run the GKrellM server, issue the following on the Linux machine you want to monitor.

gkrellmd &

Note that by default the client can connect to the server from any machine. In case you want to restrict connection (for example, from clients with IPs 192.168.0.2 and 192.168.0.3), issue the following to launch the server, instead of gkrellmd &.

gkrellmd -a 192.168.0.2 -a 192.168.0.3 &

To run the client part on Linux, first install GKrellM in the same way as mentioned above. Fire X Window. Open a terminal window within X and issue:

gkrellm --server

For example,

gkrellm --server 192.168.0.1

This will show up a sleek bar with real-time information delivered from the Linux server. GKrellM shows a plethora of information, which includes real-time processor load, disk activity of all partitions on the server, logged in users and mail received.

To run the GKrellM client on a Windows machine, first download and install GTK (a graphics library) for Windows from http://www. dropline.net/gtk/. Subsequently, download GKrellM for Windows from http://www.redbog.com/ downloads/gkrellm/Setup-GKrell M.exe. Double click on the setup file and follow the on-screen instructions and reboot when prompted. Default installs it at C:\Program Files\GKrellM. Next, create a shortcut to gkrellm.exe (found in F:\Program Files\ GKrellM) on the desktop. Right click on the shortcut and select properties. Click on the Shortcut tab and append the following to the Target.

--server 192.168.0.1

Substitute 192.168.0.1 with the IP address of the Linux server. Double click on the shortcut to launch GKrellM and it will begin showing up the stats from the Linux server.

Shekhar Govindarajan



T4Enterprise

Advertisment