◢◢ Grafana-Prometheus
Setting up metrics
Create an API token in Strapi
- Create a new API token from the admin panel
- Call the token
Prometheus, duration Unlimited, token type Read-only
- Save the generated token somewhere
Setup Prometheus
- Create a new Web Service in Render
- Deploy from an existing image, use
prom/prometheus
- Create a persistent disk,
1GB mount path /var/data
- SSH into the service, using the Render
Shell sidebar (takes a little while to
connect)
- Configure Prometheus via
vi /var/data/prometheus.yml & paste the
following, altering STRAPI_API_TOKEN & targets as required:
global:
scrape_interval: 60s
scrape_configs:
- job_name: 'api'
metrics_path: '/api/metrics'
bearer_token: 'STRAPI_API_TOKEN'
static_configs:
- targets: ['api.justabout.com']
- Set the
Docker Command in Settings to /bin/prometheus --config.file=/var/data/prometheus.yml
Setup Grafana
- Create a new Web Service in Render
- Deploy from an existing image, use
grafana/grafana
- Create a persistent disk on the service,
1GB on /var/lib/grafana
- Set the environment variables on the service:
GF_SECURITY_ADMIN_USER=admin
GF_SECURITY_ADMIN_PASSWORD=whatever_you_want
- Navigate to Grafana via the link on the service, e.g. https://grafana-ldr1.onrender.com
- Log in & configure a new Prometheus data source at
/connections/datasources/new
- Setup the datasource with the server URL being that of the URL of the just
created Prometheus service, e.g.
https://prometheus-86k2.onrender.com
- Create dashboards as you wish!