Configuring Prometheus
Prometheus is a time series database. NXLog Agent Minder provides a compatible api endpoint at https://minder-server:8080/api/v0.5/metrics.
Prometheus can be set up to regularly scrape this endpoint and collect metrics using the following configuration:
scrape_configs:
- job_name: 'nxlog'
scrape_interval: 60s
scheme: https
static_configs:
- targets: ['192.168.1.1:8080']
tls_config:
insecure_skip_verify: true
Creating a data source in Grafana
Grafana is a popular data visualization tool that works well with Prometheus. A data source must be set up in Grafana to access Prometheus' time series data.
The Bearer token is specific to your local installation.
You will need to have the following:
-
Working authentication for Grafana API
-
Grafana host’s name, port and protocol
-
Prometheus host’s name, port, protocol
The example below shows a way for creating a data source.
curl -H "Authorization: Bearer BASE64_TOKEN_STRING" \
-H "content-type: application/json" -X POST \
"http://minder-graphana-2:3000/api/datasources/" \
-d '{
"name": "Prometheus-import",
"type": "prometheus",
"url": "http://minder-prometheus-2:9090",
"access": "proxy"
}'
If you used the example docker setup provided in the guide the host name in the data source definition above should work.
The host name where curl connects should be changed to match your docker host.
You will need to create an API key with admin rights and use that to perform this operation.
|