1
0
Fork 0
mirror of https://github.com/emqx/emqx-exporter.git synced 2024-12-14 11:37:36 +00:00
Prometheus exporter for EMQX
Find a file
Rory Z 9f8ab8216a chore: sync grafana dashboard and EMQX dashboard
fix: https://github.com/emqx/emqx-exporter/issues/88

Signed-off-by: Rory Z <16801068+Rory-Z@users.noreply.github.com>
2024-05-06 09:26:22 +08:00
.github/workflows chore: push release tag to ghcr.io 2024-04-17 09:41:32 +08:00
collector chore: sync grafana dashboard and EMQX dashboard 2024-05-06 09:26:22 +08:00
config chore: fix case error 2023-11-22 00:38:36 +08:00
docs/_assets docs: update figure (#45) 2023-06-08 17:53:01 +08:00
examples docs: update example 2023-11-14 18:34:27 +08:00
grafana-dashboard chore: sync grafana dashboard and EMQX dashboard 2024-05-06 09:26:22 +08:00
prober refactor: refactor mqtt probe 2024-01-11 20:56:16 +08:00
.gitignore fix: fix can not get license in emqx 4 2023-11-14 18:34:27 +08:00
.golangci.yml ci: more better golang lint check (#62) 2023-10-17 14:40:01 +08:00
CONTRIBUTING.md feat: implement emqx-exporter 2023-04-07 19:35:05 +08:00
Dockerfile chore: change default config path 2023-10-18 16:12:44 +08:00
go.mod test: refactor test suite 2023-11-07 11:29:47 +08:00
go.sum test: refactor test suite 2023-11-07 11:29:47 +08:00
LICENSE feat: implement emqx-exporter 2023-04-07 19:35:05 +08:00
main.go refactor: refacor collector 2023-11-07 18:13:41 +08:00
main_test.go chore: fix case error 2023-11-22 00:38:36 +08:00
Makefile build: disable CGO 2023-11-15 16:36:31 +08:00
README.md docs: update example 2023-11-14 18:34:27 +08:00
RELEASE.md docs: update README 2023-11-08 13:55:52 +08:00

EMQX Exporter

GitHub Release Docker Pulls codecov

The `emqx-exporter` is designed to expose partial metrics that are not included in the EMQX Prometheus API.

It is compatible with EMQX 4.4 and EMQX 5, both open-source and enterprise.

Dashboard

Structure

Structure

Metrics

See the documentation Instruction for an explanation of the metrics on the dashboard

Building and running

The emqx-exporter listens on HTTP port 8085 by default. See the --help output for more options.

Required

EMQX exporter requires access to the EMQX dashboard API with basic auth, so you need to sign in to the dashboard to create an API secret Note that it is different to create a secret between EMQX 5 and EMQX 4.4 on the dashboard.

Build

make build

Running

./bin/emqx-exporter <flags>

Docker Compose

Refer to the example to deploy a complete demo by docker compose.

Kubernetes

Refer to the example to learn how to deploy emqx-exporter on the Kubernetes.

Configuration

Sample config file like this

metrics:
  target: 127.0.0.1:18083
  api_key: "some_api_key"
  api_secret: "some_api_secret"
probes:
  - target: 127.0.0.1:1883

The metrics and the probes are not required configuration items, if not set metrics, the metrics feature will disable, and if not set probes, the probe feature will disable.

Prometheus Config

The scrape config below is available for EMQX 5

scrape_configs:
- job_name: 'emqx-self-metrics'
  metrics_path: /api/v5/prometheus/stats
  scrape_interval: 5s
  honor_labels: true
  static_configs:
    # a list of addresses of all EMQX nodes
    - targets: [${your_emqx_addr}:18083]
      labels:
        # label the cluster name of where the metrics data from
        cluster: ${your_emqx_addr}
        # fix value, don't modify
        from: emqx
- job_name: 'exporter-metrics'
  metrics_path: /metrics
  scrape_interval: 5s
  static_configs:
    - targets: [${your_exporter_addr}:8085]
      labels:
        # label the cluster name of where the metrics data from
        cluster: ${your_cluster_name}
        # fix value, don't modify
        from: exporter
- job_name: 'exporter-probe'
  metrics_path: /probe
  params:
    target:
      # must equal the `probes[$index].taget` in config file
      - "127.0.0.1:1883"
  scrape_interval: 5s
  static_configs:
    - targets: [${your_exporter_addr}:8085]
      labels:
        # label the cluster name of where the metrics data from
        cluster: ${your_cluster_name}
        # fix value, don't modify
        from: exporter

Grafana Dashboard

Import all templates to your Grafana, then browse the dashboard EMQX and enjoy yourself!

The templates of dashboard ares JSON files, about how to upload a dashboard JSON file, you can check out here.

TLS endpoint

EXPERIMENTAL

The exporter supports TLS via a new web configuration file.

./emqx-exporter --web.config.file=web-config.yml

See the exporter-toolkit https package for more details.