*
* 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
The peculiarity of the architecture, that uses MMAP and the atomic operations, ensures:
* Minimum overhead ever possibile for Apache, no locks, no process coordination are required.
* SNMP values are served in real-time.
- 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>
(more than one file are supported)
Enable the possibility to show the mib to the externals adding in (snmpd.conf) a line similar to this
view systemonly included .1.3.6.1.4.1.19786
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
And enable the loading of the mib in the snmp.conf or snmp.local.conf adding:
mibs +APACHE2-MIB
or
mibs +ALL
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