...
How it works
AAGM already ships Prometheus, the push gateway, Grafana and a mysqld-exporter in docker-compose-promentheus.yml. The mysqld-exporter can be used to monitor AAGM's database.
After a "docker-compose -f docker-compose-promentheus.yml up -d" everything should connect automatically and after a few seconds metrics should be displayed in AAGM.
Drawio | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Configuration
Prometheus automatically pulls the metrics of all its targets every few seconds. The targets are configured in docker/prometheus/prometheus.yml. (13.08.2021)
Code Block | ||
---|---|---|
| ||
global:
scrape_interval: 15s
external_labels:
monitor: 'codelab-monitor'
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: [ 'host.docker.internal:9090' ]
- job_name: 'aagmdb'
static_configs:
- targets: [ 'host.docker.internal:9104' ]
- job_name: 'prometheus-pushgateway'
scrape_interval: 1s
honor_labels: true
static_configs:
- targets: [ 'host.docker.internal:9091' ]
|
Using an external Prometheus
The url of Prometheus and the Prometheus Pushgateway must be stored in the configuration of AAGM under general settings.
Prometheus must receive the push gateway as target as in line 16 above. Optionally, the database of AAGM can also be added.
View metrics directly in Prometheus
Here are a few examples of how to retrieve metrics directly in Prometheus.
Nodes:
cpuLoadPercentage{name="Docker GW 1"}
memoryLoadPercentage{hostPort="host.docker.internal:8444"}
cpuLoadPercentage
...
APIs:
allRequestsCount{name="APIIDA Metrics API"}
allRequestsCount{job="Docker GW 1 APIIDA Metrics API"}
allRequestsCount{nodeID="2"}
...
More filters can be added in the PrometheusPushGateway class. All possible filters can also be viewed there or directly on the PushGateway.
Useful
Grafan user: admin pass: admin
Links
https://github.com/prometheus/pushgateway
https://packagist.org/packages/promphp/prometheus_push_gateway_php