it-novum / openitcockpit-agent-go

Cross-Platform Monitoring Agent for openITCOCKPIT written in Go
https://openitcockpit.io/download_agent/
Apache License 2.0
5 stars 2 forks source link

OA-55 Implement a Prometheus Exporter Proxy (similar to the exporter_exporter) #87

Open nook24 opened 4 months ago

nook24 commented 4 months ago

This feature lets the openITCOCKPIT Agent act as a proxy for Prometheus Exporters installed on the same system. The idea is to have one central HTTP endpoint that can be queried by openITCOCKPIT (the Agent itself) and a /prometheus target that can be scraped by Prometheus.

Exporters like for example the node_exporter do not have to be exposed to the network, instead they can be bind to 127.0.0.1 because the openITCOCKPIT Agent will scrape the exporters.

The new API endpoint /prometheus will return a list of all available exporters Unbenannt

To get the data of a specific exporter, just add a query parameter /prometheus?exporter=mysqld_exporter Unbenannt

If the Agent is using AutoTLS (default) the /prometheus endpoint is encrypted and will also require a TLS certificate for authentication. So everything is secure by default.

The exporter configuration in openITCOCKPIT is pretty straightforward

Unbenannt

params:
    exporter: [mysqld_exporter]
scheme: https
tls_config:
    insecure_skip_verify: true
    ca_file: /opt/openitc/agent/server_ca.pem
    cert_file: /opt/openitc/agent/server_ca.pem
    key_file: /opt/openitc/agent/server_ca.key

Currently only Pull Mode is supported, but I think this could also be implemented into the Push Mode.