Step 1: Follow the steps for installing Applicare SingleAgent .
Monitoring Apache Server with Applicare
Some modules may not be included in the Apache conf file by default. If this is the case, manually add the module lines below the Listen directive in the Apache configuration 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 2: To enable the server-status and custom log modules in Apache. navigate to <ApacheHomeDir>/conf and edit httpd.conf file as follow.
1. Verify that the status_module is enabled, if it is not, enable it by just removing '#’ before the line
LoadModule status_module modules/mod_status.so
This module provides server performance and status information. Since the Applicare Agent will be installed on the same machine where Apache is running, allowing server status access from the local machine is sufficient.
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 not available 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 deny,allow
Deny from all
Allow from 127.0.0.1 ::1 localhost
</Location>
</IfModule>
For Apache 2.4
<IfModule mod_status.c>
<Location /server-status>
SetHandler server-status
Require local
</Location>
</IfModule>
3. Ensure that the log_config_module is enabled, if it is not enable it by removing '#’ before the line
LoadModule log_config_module modules/mod_log_config.so
This module is used for configuring and customizing Apache’s logging behavior, allowing administrators to specify the details of what information is logged, the format, and the destination.
4. Verify that unique_id_module is enabled, if not enable it by just removing '#’ before the
LoadModule unique_id_module modules/mod_unique_id.so
It is used to generate unique identifiers for each request processed by the server.
5. Check setenvif_module is enabled, if it is not, enable it by just removing '#’ before the
LoadModule setenvif_module modules/mod_setenvif.so
It is used to set environment variables based on the characteristics of the client request.
6. Check headers_module is enabled, if not enable it by just removing '#’ before the
LoadModule headers_module modules/mod_headers.so
It is used to add, modify, or remove headers based on various conditions, giving administrators fine-grained control over the behavior of their web server.
For Apache version 2.2
7. Create a new log folder within the Apache home directory..
8. Insert the following 5 lines into the log_config_module section of the ‘httpd.conf' and comment out any other CustomLog directives within this section.
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"
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
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
1. Replace the "<ApacheHomeDir>" with your Apache installed path (remove the angle brackets also).
2. The "_ap_trace_id" is just a environment variable appended to every request. The value of this variable will be a random id.
3. Replace the "Apache" with Apache servername (without space) and including double quotes should be there. You can give any name in the Apache servername, But it should be unique.
4. Replace newlogfolder with the name of the folder you created within the Apache home directory.
Windows:
Linux :
For Apache version 2.4 and above
7. Create a new log folder within the Apache home directory.
8. Add the following 5 lines 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"
Windows
Add the following 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
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
1. Replace the "<ApacheHomeDir>" with your Apache installed path (Remove the angle brackets also).
2. The "_ap_trace_id" is an environment variable appended to every request with its value being a randomly generated ID.
3. Replace "Apache" with your Apache server name (without space, ensuring it is enclosed in double quotes. You can use give any unique name for the Apache server name, But it should be distinct.
4. Replace the newlogfolder with the folder name which you have created inside the Apache home directory.
Windows :
Linux :
9. Finally Restart Apache server.
After restarting the Apache server, enter the following URL in your browser. This will display information about the 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
Step 3: Start the agent by executing the startAgent.bat (Administrator mode for windows) and startAgent.sh (sudo for linux) within the ApplicareSingleAgent.zip extracted directory.
Step 4: Once the agent is running, it will be automatically registered with the Applicare controller. Log in to the Applicare console and navigate to the Overview menu.
Step 5: Select the newly added agent and click the Edit button and check the "Add Apache Configuration" box and configure the setting as shown below. Then, Click the update button to save.
Comments
0 comments
Article is closed for comments.