Power Outage Data in Grafana

To get power outage data into Grafana, add the Infinity data source plugin, give it your PowerOutage.us API key as a bearer token, and query the v2 REST API with its JQ parser. One query turns /geojson/outages into a table of outage markers for a Geomap panel; another returns customers out per county for a Grafana-managed alert rule. Both run in Grafana's backend, so the key never reaches the browser, and the same data source serves dashboards and alerting.

What you'll have

  • A Geomap panel with a marker for every active outage in your states, sized by customers out, with the cause and estimated restoration in its tooltip.
  • A Grafana-managed alert rule with one alert instance per county, firing when a county passes 5,000 customers out.
  • The API key stored encrypted in the data source and sent only to poweroutage.us.
  • The same setup on Grafana Cloud, where Infinity is preinstalled, and on self-hosted Grafana 11.6 or later.

What you need

An API key (request one with the form below) and these endpoints. Full details are in the API reference.

EndpointMethodUsed forPackage
/geojson/outagesGETActive outages with their shapes, customersOut, cause and estimatedRestorationAt, turned into one map marker per outage.Standard
/outages/countiesGETCounty customersOut for the alert rule, one alert instance per county.Core

Step 1: Install the Infinity data source

Grafana Cloud stacks come with Infinity installed, so skip to the next step. On self-hosted Grafana, an admin installs it from Administration > Plugins and data > Plugins, or with the CLI, and restarts Grafana. The queries in this guide use the JQ parser, which arrived in Infinity 3.6, so update an older copy. Infinity runs the queries on the Grafana server, which needs outbound HTTPS to poweroutage.us; adding the data source needs the Admin role in your organization.

bash
# Self-hosted Grafana 11.6 or later; then restart Grafana
grafana cli plugins install yesoreyeram-infinity-datasource

# Docker: install it when the container starts
docker run -d -p 3000:3000 -e GF_INSTALL_PLUGINS=yesoreyeram-infinity-datasource grafana/grafana

Step 2: Add the data source with your key

Add an Infinity data source and set Authentication to Bearer Token, which sends Authorization: Bearer <key> on every request. Grafana stores the token encrypted and never sends it to the browser. Infinity requires Allowed hosts whenever authentication is set and refuses requests to any other host, so a dashboard cannot send the key elsewhere. When you provision data sources from files instead, the same settings are auth_method: bearerToken and allowedHosts under jsonData, and bearerToken under secureJsonData.

text
Connections > Data sources > Add new data source > Infinity
  Name                    PowerOutage.us
  Authentication          Bearer Token
  Token                   <your API key>
  Allowed hosts           https://poweroutage.us
Save & test

Step 3: Query outages as map markers

Create a dashboard and add a visualization with the PowerOutage.us data source, then set the query as shown. Outages come back as points and polygons, and the JQ expression gives each one a single marker: it flattens the geometry's coordinates and averages the longitudes and latitudes, which is the point itself for a point outage and roughly the middle of a polygon; for an irregular or multi-part shape it can fall outside the shape. outage joins utilityId and outageId, the pair that identifies an outage between refreshes. Choose JQ from the Backend group of the Parser list; the Backend parsers are the ones Grafana can also use for alerting. Change stateId to your states. /geojson/outages is in the Standard package; the county query in the alert step needs only Core.

text
Data source   PowerOutage.us
Type          JSON
Parser        JQ (Backend)
Source        URL
Format        Table
Method        GET
URL           https://poweroutage.us/api/v2/geojson/outages?stateId=44,45&minCustomersOut=1

Rows/Root
.features[] | (.geometry.coordinates | flatten) as $c | {
  outage: "\(.properties.utilityId):\(.properties.outageId)",
  customersOut: (.properties.customersOut // 0),
  cause: (.properties.cause // "Not reported"),
  estimatedRestorationAt: .properties.estimatedRestorationAt,
  lat: ([$c[range(1; $c | length; 2)]] | add / length),
  lon: ([$c[range(0; $c | length; 2)]] | add / length)
}

Step 4: Build the Geomap panel

Set the visualization to Geomap. Under Map layers, use a Markers layer with Location mode Auto, which finds the lat and lon fields. Set Size to the customersOut field with a minimum and maximum, and Color to customersOut with thresholds such as 100 and 1,000. Hovering a marker shows the outage key, customers out, cause and estimated restoration (UTC). The data updates every minute. Set the dashboard to refresh every 15 minutes, or every 1 or 2 minutes for the latest numbers; every refresh by every viewer is a request against your key, which allows 10 requests per 10 seconds.

Step 5: Alert when a county passes 5,000 customers out

Create a Grafana-managed alert rule with this query. It returns a table with two string columns and one number per county, which Grafana alerting reads as one alert instance per row: county and countyId become labels, and customersOut is the value the condition checks. The county id is turned into a string so it becomes a label too, which keeps rows unique when two states have a county with the same name. Grafana evaluates the rule on the server with the token stored in the data source, so alerting needs no other key. Leave out minCustomersOut so every county stays in the result and recovers to Normal on its own. Add your contact point under notifications.

text
Alerting > Alert rules > New alert rule

Query A
  Data source   PowerOutage.us
  Type          JSON
  Parser        JQ (Backend)
  Source        URL
  Format        Table
  URL           https://poweroutage.us/api/v2/outages/counties?stateId=44,45
  Rows/Root     .data[] | {county: .name, countyId: (.id | tostring), customersOut}

Expressions
  Threshold, input A, IS ABOVE 5000   (set as the alert condition; no Reduce needed)

Evaluation
  Folder and evaluation group, evaluated every 15m
  Pending period 0s

Summary annotation
  {{ $labels.county }} county (id {{ $labels.countyId }}) has {{ $values.A.Value }} customers out

Tips for Grafana

  • The API allows 10 requests per 10 seconds per key, and Infinity does not retry a 429; a rate-limited panel shows an error until its next refresh. Keep dashboards at 15-minute refreshes, and use a separate key for Grafana so other tools do not compete with it.
  • A marker shows where an outage is, not its full shape. To draw outage polygons, load them into PostGIS and add it as a data source, or use a GIS tool.
  • Utilities that report counts by area only have no outage shapes, so their outages are missing from the map but still counted in /outages/counties.
  • Each state can include a county named Unknown for customers a utility could not place in a county. It gets its own alert instance like any other county.

Used by

Related integrations

FAQ

Here are some commonly asked questions

Request API access

Tell us what you're building and we'll set you up with a trial key.