Apache server 2.4 monitoring setup
Apache server Monitoring with Applicare
Note: Some of the modules may not be present in the apache conf file by default. In that case add the module lines manually below the Apache Listen line in the apache conf file.
#Listen 12.34.56.78:80
Listen 80
LoadModule status_module modules/mod_status.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule headers_module modules/mod_headers.so
Step 1: To enable server-status and custom log modules in apache. Go to <ApacheHomeDir>/conf and edit httpd.conf file as below.
1. Check status_module is enabled, if not enable it by just removing '#’ before the
LoadModule status_module modules/mod_status.so
2. Search for <Location /server-status> and add the "Required or Order" commands inside the <Location /server-status> based on the Apache version. If the <Location /server-status> is there then add the below modules at the end of the conf file based on the apache versions.
For Apache 2.2
<IfModule mod_status.c>
<Location /server-status>
SetHandler server-status
Order allow,deny
Allow from all
</Location>
</IfModule>
For Apache 2.4
<IfModule mod_status.c>
<Location /server-status>
SetHandler server-status
Require all granted
</Location>
</IfModule>
3. Check log_config_module is enabled, if not enable it by just removing '#’ before the
LoadModule log_config_module modules/mod_log_config.so
4. Check unique_id_module is enabled, if not enable it by just removing '#’ before the
LoadModule unique_id_module modules/mod_unique_id.so
5. Check setenvif_module is enabled, if not enable it by just removing '#’ before the
LoadModule setenvif_module modules/mod_setenvif.so
6. Check headers_module is enabled, if not enable it by just removing '#’ before the
LoadModule headers_module modules/mod_headers.so
For Apache version 2.2
7. Create a new log folder inside the apache home directory.
8. Add the below 4 lines inside the log_config_module and comment other ‘CustomLog's inside the log_config_module in the httpd.conf file.
SetEnvIfNoCase Request_URI "^/server-status/pingFromApplicare" dontlog
SetEnvIfNoCase Request_URI "^/applicare_agent/*" dontlog
SetEnvIf _ap_trace_id ^[a-zA-Z0-9].* HAVE_AP_ID
RequestHeader set _ap_trace_id "%{UNIQUE_ID}e" env=!HAVE_AP_ID
RequestHeader set _ap_apache_id "Apache"
For Windows add the below line next to the RequestHeader set _ap_apache_id "Apache" line.
CustomLog "|<ApacheHomeDir>/bin/rotatelogs.exe <ApacheHomeDir>/newlogfolder/apl_log 60" "%t %h %s %B %D %U :%{_ap_trace_id}i" env=!dontlog
For Linux add the below line next to the RequestHeader set _ap_apache_id "Apache" line.
CustomLog "|<ApacheHomeDir>/bin/rotatelogs <ApacheHomeDir>/newlogfolder/apl_log 60" "%t %h %s %B %D %U :%{_ap_trace_id}i" env=!dontlog
Note:
1. Replace the "<ApacheHomeDir>" with your apache installed path (Need to remove the angle brackets also).
2. Replace the "Apache" with Apache servername (without space) and double quotes should be there. You can give any name in the Apache servername, But it should be unique.
3. Replace the newlogfolder with the folder name which you have created inside the apache home directory.
Windows:
Linux :
For Apache version 2.4 and above
7. Create a new log folder inside the apache home directory.
8. Add the below 4 lines inside the log_config_module and comment other ‘CustomLog's inside the log_config_module in the httpd.conf file.
SetEnvIfNoCase Request_URI "^/server-status/pingFromApplicare" dontlog
SetEnvIfNoCase Request_URI "^/applicare_agent/*" dontlog
SetEnvIf _ap_trace_id ^[a-zA-Z0-9].* HAVE_AP_ID
RequestHeader set _ap_trace_id "%{UNIQUE_ID}e" env=!HAVE_AP_ID
RequestHeader set _ap_apache_id "Apache"
For Windows add the below line next to the RequestHeader set _ap_apache_id "Apache" line.
- CustomLog "|<ApacheHomeDir>/bin/rotatelogs.exe -n 1440 <ApacheHomeDir>/newlogfolder/apl_log 60" "%t %h %s %B %D %U :%{_ap_trace_id}i" env=!dontlog
For Linux add the below line next to the to the RequestHeader set _ap_apache_id "Apache" line.
- CustomLog "|<ApacheHomeDir>/bin/rotatelogs -n 1440 <ApacheHomeDir>/newlogfolder/apl_log 60" "%t %h %s %B %D %U :%{_ap_trace_id}i" env=!dontlog
Note:
1. Replace the "<ApacheHomeDir>" with your apache installed path (Need to remove the angle brackets also).
2. Replace the "Apache" with Apache servername (without space) and double quotes should be there. You can give any name in the Apache servername, But it should be unique.
3. Replace the newlogfolder with the folder name which you have created inside the apache home directory.
Windows :
Linux :
9. Finally Restart Apache server.
Note:
After restarting the apache server hit the below request in the browser url. It will display some information about apache server.
<Apache_Protocol>://<Apache_IP>:<Apache_Port>/server-status?auto
<Apache_Protocol> - http (or) https
<Apache_IP> - Apache server running IP
<Apache_Port> - Apache server running port
ServerVersion: Apache/2.4.37
ServerMPM: event
Server Built: Jan 27 2021 07:22:47
CurrentTime: Monday, 28-Jun-2021 18:11:40 EDT
RestartTime: Monday, 28-Jun-2021 18:08:24 EDT
ParentServerConfigGeneration: 1
ParentServerMPMGeneration: 0
ServerUptimeSeconds: 195
ServerUptime: 3 minutes 15 seconds
Installing Applicare Stand-alone Agent Application
1. First, you will have to build the stand-alone collector. Once you install Applicare you can build
the stand-alone agent by running
<ApplicareServer Install Dir>/agent/Standalonecollector/build/ build_collector.bat/sh
This will create a new folder,
<Applicare Server Install Dir>/agent/Standalonecollector/Applicare
and,
<Applicare Install Dir>/agent/Standalonecollector/Applicare.jar
2. If you are going to deploy the agent in the new machine then copy the "Applicare" folder or "Applicare.jar " from the Applicare server machine to agent machine and extract in any directory.
Please make sure that on Linux environment you assign appropriate read/write permission to extracted/copied Applicare folder/jar. Additionally, run the following command from the extracted/copied folder to assign execute permission to all the .sh script files.
chmod +x *.sh
3. To start the agent application run,
Applicare/server/bin/startup.bat/sh
4. Please note that the agent by default runs on port 9880. You can change the port number by modifying
Applicare /server/conf/server.xml
5. Set "SERVER_NAME" and "JAVA_HOME" property in the agent "Catalina.bat/sh" file before starting the agent.
Go to the path Applicare/server/bin/catalina.bat/sh
Edit Catalina.bat/sh and set the "SERVER_NAME" &
"JAVA_HOME" and save the file.
SERVER_NAME - You can give any name without spaces.
JAVA_HOME - Java JDK path of the Agent machine.
Note: For every agent, the SERVER_NAME should be unique.
For Windows edit Catalina.bat file and save
For Linux edit, Catalina.sh file and save
Running Applicare server and Agent:- (Run as Administrator)
To start Applicare Server:
1. Go to the Aplicare server installed directory.
2. Open a command prompt in "Administrator mode".
3. Go to the path <ApplicareServerHomeDir>/server/bin.
4. Execute the "startup.bat/sh" script file.
For Windows execute "startup.bat" and for Linux execute "startup.sh" script file.
To start Agent:
1. Go to the Aplicare Agent installed directory.
2. Open a command prompt in "Administrator mode".
3. Go to the path <ApplicareAgentHomeDir>/server/bin.
4. Execute the "startup.bat" script file.
Adding the Agent in Applicare server
1. Open the overview screen in the Applicare console and click the “Add server” button to add the Standalone agent.
For Apache version 2.2
For Apache version 2.4 and above
2. Add the App name to the Standalone agent.
Enterprise
Apache
HTTP
Log consolidated HTTP data
Errors
Business Transactions
Top Business Transactions
Adding URL as KBT
Key Business Transactions Load
Key Business Transactions Load Distributions
Transactions
Enabling Apache User Experience Analyzer
By enabling this each and every individual transaction will be logged into the database as a separate one. So a huge amount of data will be logged into the database.
Please follow the below steps to add Apache User Experience Analyzer
1. Go to Menu and select Configure Dynamic Instrumentation.
2. Select the server and add "End User Experience Profiling" aspect to that server.
3. In the next few minutes, you can see the data in "Apache User Experience Analyzer".
Dashboard
Transactions
To Restrict only specific URL's to be logged in Apache User Experience Analyzer screen
1. Go to User Experience --> Settings (icon) --> UEM URL Exclusion/Inclusion
2. Add the URL's in the UEM Include and Exclude
UEM Include & Exclude
If the UEM Include list is not empty then only the URL's specified in that list will be logged.
Click "OK"
Note: After applying the changes Standalone Agent restart is required. So please add all the needed URL's in UEM Include, Exclude and apply the change and restart the Standalone Agent.
OS
CPU Cores
Processes
Disk
Network Connections
Mbean Browser
Port Requirements:
Applicare controller IP -> Applicare Agent IP and Port (Default - 9880)
Applicare controller IP -> Apache IP and Port
Applicare Agent IP -> Applicare controller IP and Port (Default - 8880) and Applicare Database Ports (Defaults Derby - 1527, Mysql - 3306, Oracle - 1521)
Applicare Agent IP -> Apache IP and Port
Please sign in to leave a comment.
Comments
0 comments