Measuring server load with collectd, Part II

Back to Part I

15 Jun 2010 by Misha Dragojevic

In previous post, Part 1 we explained how to configure “collectd” daemon on client machines and on a server. In this post we will explain how to configure Apache to present the data.

Let’s start by clarifying that “collectd” is not used to visualize the data, only to collect and store. However, as part of “collectd” distribution, you get “collection3” set of Perl scripts that can be installed under Apache. If you are using Ubuntu (or Debian), those files are in /usr/share/doc/collectd/examples/collection3/.

This assumes that Apache is configured and works fine. Second assumption is that Apache document root is in “/var/www” (default location). If that location is somewhere else, you need to adjust the process accordingly. All steps below need to be followed on collectd server (in step 1 we called it “myserver.mydomain”)

Step 1: Install Perl modules

*Step 2*: Copy Perl scripts from "collectd" distribution location to Apache DocumentRoot location.

Step 3: Configure Apache. Create configuration file /etc/apache2/sites-available/collection3

Notes: # Exact syntax is dependent on what you have at the moment. Above assumes that it's the one and only virtual host. Lines 15-37 are "collection3" specific. # Lines 28-31 are optional and provide basic form of security via Apache BasicAuth. If you disable these lines anyone that has access to your server will be able to see the graphs. If protected via BasicAuth, only users that you add to password file (/etc/apache2/collectd.htpasswd) will be able to access the site. You can create users via Apache "htpasswd" utility. Above file needs to be properly linked to be recognized by Apache:

Restart Apache

*Try it out*

Graphs

If everything went fine, you should see some nice looking graphs. Few examples are below:




blog comments powered by Disqus