Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Tree [d69b4e] master /
History



File Date Author Commit
mod_statistics 2013-10-16 Marco Serantoni Marco Serantoni [030dd5] Adding TRAP
netsnmp-apache2 2013-10-16 Marco Serantoni Marco Serantoni [d69b4e] Update compile.sh
LICENSE-2.0.txt 2013-09-20 Marco Serantoni Marco Serantoni [b332fc] Adding license
README-debian.txt 2013-10-06 Marco Serantoni Marco Serantoni [b2150d] Documentation for compiling on Debian from Alf ...
README.txt 2013-10-16 Marco Serantoni Marco Serantoni [d00a42] Corrected misspell
RELEASE.txt 2013-10-16 Marco Serantoni Marco Serantoni [030dd5] Adding TRAP
snmptable-example.txt 2013-10-16 Marco Serantoni Marco Serantoni [030dd5] Adding TRAP
snmpwalk-example.txt 2013-10-16 Marco Serantoni Marco Serantoni [030dd5] Adding TRAP

Read Me

*
* RELEASE 1.0
*

* Early Adopters (0.xx) users are kindly requested to delete their StatisticsFile and
* replace their MIB
*

This project is composed of two parts.

The mod_statistics module for Apache and a Dynamic Loading library for net-snmp.

The mod_statistics module writes to a file that contains all the Statistics.
The net-snmp Library reads this file and shows the statistics via snmpd

- How to Compile
  * mod_statistics 
    Enter in the mod_statistics directory and execute:
    apxs -ci mod_statistics.c
  
    This will compile and install the module in the Current Apache
  
  * netsnmp-apache2
    Enter in the netsnmp-apache2 and execute:
    ./compile.sh
  
    This will create the apache2_mib.so dynamic loading plugin for net-snmpd
  

- How to Configure
  o mod_statistics
    apxs should have already set this line in httpd.conf:
      LoadModule mod_statistics_module <path>/mod_statistics.so

    Now We have to instruct the module where to place the Statistics File
    and choose if treat each Alias/WildAlias as a separate entity
    Moreover, you can choose to show the handler at some url

    This can be accomplish with the Directives in httpd.conf:

      * StatisticsFile <path>
        Sets the Path where to place the Statistics File (to be placed in the global configuration)

      * StatisticsRecordAlias On/Off
        Records (v)server Aliases/Wildaliases as separate entities (Could be placed for each (v)Server ad libitum)

      * StatisticsServerDisable On/Off
        Enable or disable each (v)Server statistics (Could be placed for each (v)Server ad libitum)

      * <Location /test>
      *   SetHandler statistics-handler
      * </Location>
        Puts an handler showing data, warning this was used mainly for development
        is uglier than what i want, anyway is optional and if enabled pleas 
        add limits to access as required by your security policies

  o netsnmp-apache2

     This is the Module that enables net-snmpd to show data via snmp
     Now we have to teach to net-snmpd in snmpd.conf to load the module and tell it where is our StatisticFile
  
       dlmod apache2_mib <path to>/apache2_mib.so
  
       StatisticsFile <path to Statistics File>
  
     You need also to add our MIB (APACHE2-MIB.TXT) in the default paths, 
     to know which are the paths that contains the MIBS you can see it executing:

       net-snmp-config --default-mibdirs

     Is also possible enable SNMP Traps, using the directive

       StatisticsTrap [ SERVER | VIRTUAL | ALIAS | WILD] 

     This enables the send of traps using different degrees

       SERVER : Sends SNMP Trap when there are events about the ENTIRE server
       VIRTUAL: Sends SNMP Trap when above more each VirtualServer is threaded separatelly
       ALIAS  : Sends SNMP Trap when above more the change of each Alias
       WILD   : Sends SNMP Trap when above more the canghe of each WildchardAlias
 
     Only ONE of these level can be choose 

** DONE ** 

Now you should be able to test the system
Start your Apache , Then start your snmpd daemon

  snmpwalk localhost -v 1 -c public APACHE2-MIB 

  snmptable localhost -v 1 -c public APACHE2-MIB::apache2MIBvserverTable 

Example of the outputs are contained in the files: snmpwalk-example.txt and snmptable-example.txt 

Marco