tencent cloud

All product documents
Tencent Cloud Observability Platform
Apache Exporter Integration
Last updated: 2024-10-24 17:53:57
Apache Exporter Integration
Last updated: 2024-10-24 17:53:57

Overview

Apache Exporter is a tool used for collecting data on Apache HTTP server metrics. The data of core metrics reported by the Exporter can used to trigger alarms and is displayed on the monitoring dashboard. TMP on Tencent Cloud Observability Platform (TCOP) provides the Apache Exporter connection feature and an out-of-the-box Grafana monitoring dashboard.
Note:
To ensure the Exporter can collect data, make sure the Apache HTTP server is running. For details, see this document.

Connection Method

Method 1: One-Click Installation (Recommended)

Directions

1. Log in to TMP Console.
2. Select the corresponding Prometheus instance from the instance list.
3. Go to the instance details page, select Data Collection > Integration Center.
4. Search for Apache in the integration center, and click it to pop up the installation window.
5. On the Installation tab of the pop-up window, fill in the metric name, address, path, and other information, and click Save.
Search for the required CAM policy as needed, and click to complete policy association.




Configuration Instructions

Parameters
Note
name
Exporter name, which should meet the following requirements:
The name should be unique.
The name should conform to the following regular expression: '^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$'.
address
Address of the connected Apache HTTP server.
path
Path for viewing the Apache HTTP Server Status page. Default value: /server-status.
user name
Username for accessing the Apache HTTP server.
password
Password for accessing the Apache HTTP server.
tag
Custom labels for metrics.

Method 2: Custom Installation

Note:
TKE is recommended for convenient installation and management of the Exporter.

Prerequisites

A TKE cluster has been created in the region and VPC of the corresponding Prometheus instance, and a namespace has been created for the cluster.
In the TMP Console > select the corresponding Prometheus instance > Data Collection > Integrate with TKE to find the corresponding container cluster and complete the cluster association operation. See the guide Associate Cluster for reference.

Directions

Step 1: Enabling the mod_status Module of the Apache Server
Note:
For TKE-related operations, see the TKE documentation.
The Apache Exporter collects data via the mod_status module of the Apache server. Therefore, you need to ensure that the mod_status module is enabled for the Apache server. The specific steps are as follows:
1. Log in to the TKE console.
2. Click Cluster in the left sidebar, find the cluster where the Apache server is located, enter the cluster, and find the Apache server.
3. If no ConfigMap is configured in the Apache server, log in to the Apache server, copy the configuration files such as httpd.conf, mime.types, and extra/httpd-info.conf in the configuration directory, create a ConfigMap, and add the configuration files to the ConfigMap. For ConfigMap-related operations, see ConfigMap Management.
4. In httpd.conf, delete the comment for the line LoadModule status_module modules/mod_status.so (remove that part starting with #). If extra-related configurations exist for the server, enable them in httpd.conf by deleting corresponding comments. Example:
Search for the required CAM policy as needed, and click to complete policy association.



5. Modify httpd-info.conf as required and enable ExtendedStatus. If no extra-related configuration exists, modify httpd.conf directly. Example:
Search for the required CAM policy as needed, and click to complete policy association.



6. Verify whether the mod_status module is enabled by accessing the /server-status path of the server. If data is returned normally, the module is enabled successfully. Example:
Search for the required CAM policy as needed, and click to complete policy association.


Step 2: Deploying the Exporter
1. Log in to the TKE console.
2. Click Cluster in the left sidebar.
3. Click the ID/name of the cluster whose access credential is required to go to the management page of the cluster.
4. Following the steps below to deploy the Apache Exporter and verify the deployment status.
Step 3: Deploying the Apache Exporter
1. Choose Workload > Deployment in the left sidebar to enter the Deployment page.
2. Click Create via YAML in the upper right corner of the page to create a YAML file, and select the corresponding namespace for server deployment. The following part shows how to deploy the Exporter by using a YAML file. Sample configurations are as follows:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
k8s-app: apache-exporter # Use the actual name based on the business needs. It is recommended to include the information on the corresponding Prometheus instance.
name: apache-exporter # Use the actual name based on the business needs. It is recommended to include the information on the corresponding Prometheus instance.
namespace: apache-demo # Use the actual name based on the business needs.
spec:
replicas: 1
selector:
matchLabels:
k8s-app: apache-exporter # Use the actual name based on the business needs. It is recommended to include the information on the corresponding Prometheus instance.
template:
metadata:
labels:
k8s-app: apache-exporter # Use the actual name based on the business needs. It is recommended to include the information on the corresponding Prometheus instance.
spec:
containers:
- args:
- --web.listen-address=:9117
- --scrape_uri=http://192.1.1.2:8080/server-status?auto # Use the address of the corresponding Prometheus instance based on business needs.
image: ccr.ccs.tencentyun.com/rig-agent/common-image:apache-exporter-v1.0.7
name: apache-exporter
ports:
- containerPort: 9117
name: metric-port
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: qcloudregistrykey
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30

Validation
1. Click the Deployment created in the previous step on the Deployment page to go to the Deployment management page.
2. Click the Log tab. The Exporter is started, and the corresponding access address is exposed, as shown below:
Search for the required CAM policy as needed, and click to complete policy association.



3. Click the Pod tab to enter the Pod page.
4. Click Remote Login in the operation bar to log in to the Pod. Execute the following curl command in the command line window to access the exposed address. In this way, data of corresponding Apache server metrics can be collected. If no data is collected, check if the connection string is correct. The command is as follows:
curl localhost:9117/metrics
The successful outcome is shown in the following figure:
Search for the required CAM policy as needed, and click to complete policy association.


Step 4: Adding a Collection Task
1. Log in to the TMP console and select the corresponding Prometheus instance to go to the management page.
2. Choose Data Collection > Integrate with TKE, select the associated cluster, and choose Data Collection Configuration > Customize Monitoring Configuration > Via YAML to add a collection task.
3. Add a PodMonitor via service discovery to define the collection task. The YAML example is as follows:
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: apache-exporter # Enter a unique name.
namespace: cm-prometheus # Pay-as-you-go instance: Use the namespace of the cluster. Monthly subscription instance (no longer available): The namespace is fixed. Do not change it.
spec:
podMetricsEndpoints:
- interval: 30s
port: metric-port # Enter the port of the Prometheus Exporter in the Pod YAML file.
path: /metrics # Enter the path of the Prometheus Exporter. Default value: /metrics.
relabelings:
- action: replace
sourceLabels:
- instance
regex: (.*)
targetLabel: instance
replacement: 'crs-xxxxxx' # Enter the information on the corresponding Prometheus instance.
namespaceSelector: # Select the namespace where the Pod to be monitored is located.
matchNames:
- apache-demo
selector: # Enter the labels of the Pod to be monitored to locate the target Pod.
matchLabels:
k8s-app: apache-exporter


Viewing Monitoring Information

Prerequisites

The Prometheus instance has been bound to a Grafana instance.

Directions

1. Log in to the TMP console and select the corresponding Prometheus instance to go to the management page.
2. Choose Data Collection > Integration Center, find the Apache Exporter, and install the corresponding Grafana dashboard to display related monitoring data, as shown below:
Search for the required CAM policy as needed, and click to complete policy association.




Configure Alarm

TMP supports configuring alert rules based on the actual business situation. For details, see Creating Alerting Rules.

Appendix: Data Collection Parameters of Apache Exporter

Global Configuration Parameters

Name
Description
telemetry.endpoint
Path for exposing metrics. Default value /metrics.
scrape_uri
URL of the Apache Server Status page. Default value: http://localhost/server-status/?auto.
host_override
String for overriding the HTTP Host request header. A null string indicates that the header is not overridden.
[no-]insecure
Ignore the server certificate if HTTPS is used.
custom_headers
Add custom headers to the Exporter.
[no-]web.systemd-socket
Use a systemd socket listener instead of a port listener (Linux only).
web.listen-address
Listening address. Default value: 9117.
web.config.file
Configuration file path. TLS or authentication can be enabled. (This parameter is used for testing.)
log.level
Log level. Default value: info.
log.format
Log message output format. Valid values: logfmt and json. Default value: logfmt.
version
Printed version information.

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon