Monitoring Apache HTTP Server in OpenNMS
- Created on Sunday, 06 October 2013 11:01
- Last Updated on Sunday, 03 November 2013 10:27
- Hits: 3046
How to monitor Apache HTTP Server in OpenNMS
The standard Apache HTTP Server does not include any functionality to expose statistics using SNMP, which I really miss. Using SNMP is an easy way of monitoring using OpenNMS and other NMSes, or even on command line using snmpwalk.
The approach used until now, was to enable the "mod_status" module on Apache, and then have the NMS, for example Cacti, parse the output. But the parsing "mod_status" output does not seem to be part of standard OpenNMS, and configuring it seemed like quite a bit of work, so I was looking for another solution.
Luckily, there is a new Apache module available, named "mod_statistics", that can expose a lot of statistics from Apache HTTP server via SNMP. The module is not part of the Apache project, so you will have to build and install it yourself for now.
The following is a how-to on how to add the Apache HTTP Server monitoring in OpenNMS, version 1.12.0, running on Debian 7 Wheezy.
Install Apache module and Net SNMP module
By using a freshly available Apache module combined with a Net SNMP module, it is possible to easily monitor the Apache Web Server in OpenNMS.
First download and install the Apache module and Net SNMP module from : http://sourceforge.net/projects/apachestatistics/. You have to compile and install the Apache module, and then install the NetSNMP module on the web server(s) you want to monitor.
The rest of this page describes how to use the data from version 1.0 of the module in OpenNMS.
Set up data collection in OpenNMS
Now you can either take full control, and decide what and how you want to collect the data from SNMP in OpenNMS, by importing the MIB file into OpenNMS. Or you can download my customized data collection file for Apache HTTP Server, and put it at /etc/opennms/datacollection-config.xml, and then include that file in the /etc/opennms/datacollection-config.xml file. You can read more about the details of the data collection.
Check that data is being generated by OpenNMS
Have a look at the /var/lib/opennms/rrd/snmp/<nodeid>/ on the OpenNMS server, for example the /var/lib/opennms/rrd/snmp/8/ directory, and check that you see files like :
You can either use the standard graphs generated by OpenNMS from the MIB file, or you can use my customized graph properties file for Apache HTTP Server.
Then you just have to let OpenNMS collect the data for some time, and then you can enjoy graphs like these :
The mod_statistics module even supports sending SNMP traps when Apache starts and stops, and this can also be monitored in OpenNMS. I have not tested this yet, and will give more info about that functionality in a future article.