AWS Prometheus metrics from WordPress plugin

0

Hello,

Regarding Amazon Prometheus managed service from AWS, could you please specify if this can work with an external target that can provide data in Prometheus format ? The target works well with a standard Prometheus Server v2.52.

The target is a WordPress plugin that waits for Prometheus query on a REST API URL ending in /metrics.

If it does not work directly, could you please specify a workaround (including Grafana cloud) for this use case, so that the metrics to be ingested into Amazon Prometheus ?

Thank you,
Mihai ADAM

  • please accept the answer if it was helpful

asked 8 months ago209 views
2 Answers
5

Hello,

To ingest metrics into AWS Managed Prometheus from your WordPress plugin, you can follow this approach:

Deploy Prometheus Server: Set up a Prometheus server either on an EC2 instance or within a Kubernetes cluster (using Helm charts, for example).

Configure Remote Write: Configure your Prometheus server to use Remote Write to send metrics data to AWS Managed Prometheus (AMP).

  • Modify your Prometheus server configuration (prometheus.yml) to include a remote_write section that points to the AMP endpoint. example:
remote_write:
  - url: https://aps-workspaces.us-east-1.amazonaws.com/workspaces/ws-******/api/v1/remote_write
    sigv4:
      region: us-east-1
    queue_config:
      max_samples_per_send: 1000
      max_shards: 200
      capacity: 2500

Replace url with your AMP workspace endpoint and configure the appropriate AWS IAM credentials for sigv4 authentication.

WordPress Plugin Configuration: Configure your WordPress plugin to expose Prometheus metrics at a URL endpoint (e.g., /metrics) that your Prometheus server can scrape.

Prometheus Scrape Configuration: Update your Prometheus server configuration (prometheus.yml) to include a scrape job that targets your WordPress plugin's /metrics endpoint. Here’s an example:

scrape_configs:
  - job_name: 'wordpress_metrics'
    static_configs:
      - targets: ['wordpress-plugin-url/metrics']

Grafana Integration (Optional): Use Grafana (either self-hosted or Grafana Cloud) to visualize and monitor metrics stored in AWS Managed Prometheus. Grafana can connect to AMP to query and display your metrics.

profile picture
EXPERT
answered 8 months ago
1

You can not write metrics directly to AWS Managed Prometheus. AMP can be used as a persistent storage for Prometheus metrics via Remote Write

Prometheus server can be deployed in EC2 or Kubernetes cluster and after that, you can configure AMP for remote write

Here is an example of Kubernetes-based Prometheus configuration

## The following is a set of default values for prometheus server helm chart which enable remoteWrite to AMP
## For the rest of prometheus helm chart values see: https://github.com/prometheus-community/helm-charts/blob/main/charts/prometheus/values.yaml
##
serviceAccounts:
        server:
            name: "amp-iamproxy-ingest-service-account"
            annotations:
                eks.amazonaws.com/role-arn: "arn:aws:iam::******:role/amp-iamproxy-ingest-role"
server:
    remoteWrite:
        - url: https://aps-workspaces.us-east-1.amazonaws.com/workspaces/ws-*******/api/v1/remote_write
          sigv4:
            region: us-east-1
          queue_config:
            max_samples_per_send: 1000
            max_shards: 200
            capacity: 2500

So your Wordpress app will write metrics to the Prometheus server, after that Prometheus server will store metrics in AMP

profile picture
EXPERT
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions