Monitoring of Cherokee Web Server using collectd

On 2010年09月14日, in linux, by netoearth

via:http://damnpeople.fr/articles/monitoring_cherokee_with_collectd.html

author:Baptiste Mille-Mathias

Cherokee is a lightweight web server which replace perfectly apache; its memory footprint is also small, and it is resistant to attacks like slowloris where apache needed specific modules.
Cherokee is also easy to configuration with its web interface for the administration. This is on what runs this site.

Collectd is a small daemon which collects system information, it comes with various plugins, to parse infomation from various sources, for df, apache, memory, /procs, …

The problem is collectd doesn’t provide a plugin to monitor directly cherokee activity, althought starting with version 4.8 it is possible to monitor it using the plugin curl_json as cherokee expose its statistics in a json format file.

First we edit the file /etc/collectd/collectd.conf

We enable the json_curl plugin

    LoadPlugin json_curl

Then we setup the monitoring

    <Plugin json_curl>
      <URL "http://127.0.0.1/about/info/js">
      Instance "cherokee"

        <Key "traffic/tx">
        Type "httpd_bytes"
        </Key>

        <Key "traffic/rx">
          Type "httpd_bytes"
        </Key>

        <Key "connections/number">
            Type "httpd_connections"
        </Key>

    </Plugin>

We define an URL to use, in my case the collectd and cherokee servers are on the same server; then we gave an instance name. Then with the Key markup we match the path from the root node to the leaf, and the type of the value expected (more about the type later).

We need to create a file that will store our custom counter types (as defined previously).
Create a file

/etc/collectd/types.db.custom

and put this content:


    httpd_bytes             count:COUNTER:0:134217728
    httpd_connections       count:GAUGE:0:65535
    httpd_requests          count:COUNTER:0:134217728
    httpd_scoreboard        count:GAUGE:0:65535

Finally modify the configuration file/etc/collectd/collectd.conf to add at the beginning

    TypesDB "/usr/share/collectd/types.db" "/etc/collectd/types.db.custom"

Restart the collectd server to take the new monitoring in account.
You should get something like .

Tagged with:  

Comments are closed.