Skip to content

Grafana Setup

This guide explains how to connect Grafana to a SafeCall server running on the same machine.

Prerequisites

  • SafeCall server is running with the "sensors" feature enabled (or "safecall" legacy alias).
  • Grafana is running on the same host.
  • SafeCall HTTP port is reachable locally (default: 8088).

1) Verify SafeCall Grafana endpoints

For same-host requests, no JWT is required on these datasource endpoints:

  • POST /grafana/search
  • POST /grafana/metrics (compatibility alias for newer simPod versions)
  • POST /grafana/query

Quick checks:

bash
curl -sS http://localhost:8088/grafana
curl -sS -X POST http://localhost:8088/grafana/search -H "Content-Type: application/json" -d '{}'
curl -sS -X POST http://localhost:8088/grafana/metrics -H "Content-Type: application/json" -d '{}'

Expected /search and /metrics response:

json
["Humidity", "Temperature", "Battery"]

2) Add datasource in Grafana

  1. Install/add the JSON datasource plugin (simPod JSON datasource).
  2. Create a datasource and set:
    • URL: http://localhost:8088/grafana
    • Access: Server
  3. Save and test.

Access: Server is important so Grafana performs requests from the server side (loopback), which matches SafeCall's local no-JWT policy.

3) Build a first panel

  • Create a panel using the SafeCall JSON datasource.
  • Query one metric first (Temperature, then Humidity / Battery).
  • Select a recent time range (for example, last 1h or 12h).

Expected result:

  • Empty series when no sensor data exists in range.
  • Otherwise one series per sensor MAC, e.g. Temperature - AA:BB:CC:DD:EE:FF.

Security model

  • Loopback requests (127.0.0.1 / ::1) to Grafana datasource endpoints are allowed without JWT.
  • Non-loopback requests still require SafeCall JWT auth.

If Grafana and SafeCall are on different machines, configure JWT for the datasource requests.

Troubleshooting

  • 401/403 from /grafana/*: request is not seen as loopback and no valid JWT was provided.
  • 404 for /metrics or /search: verify datasource base URL is http://<host>:<port>/grafana (no extra path segments).
  • No data in panel: verify sensor readings exist in selected time range.