Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

release
dump1090prom
docs
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SHELL := /bin/bash

GO := GO111MODULE=on go
GO_PATH = $(shell $(GO) env GOPATH)
APP_VERSION_DOT = "1.0.3"
APP_VERSION_DOT = "1.0.4"

.PHONY: all
all: help
Expand Down
125 changes: 45 additions & 80 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# Dump1090Prom – Aircraft data exporter for Prometheus

A Prometheus exporter for `readsb`/`dump1090` aircraft data.
This exporter converts dump1090 data into [prometheus](https://prometheus.io/) metrics, allowing to monitor and visualizing collected aircraft data in detail.
This repository contains a [Grafana dashboard](dashboards/dump1090prom-grafana-dashboard.json) for visualizing the collected data.
This exporter converts dump1090 data into [Prometheus](https://prometheus.io/) metrics, allowing you to monitor and visualize collected aircraft data in detail.
The repository includes a [Grafana dashboard](dashboards/dump1090prom-grafana-dashboard.json) for visualizing the metrics.

Tested with:
- [flightaware/dump1090](https://github.com/flightaware/dump1090)
- [wiedehopf/readsb](https://github.com/wiedehopf/readsb)

Version: 1.0.3
Version: 1.0.4

## Features

- Exports aircraft data as Prometheus metrics for each aircraft
- Supports multiple data sources via a base path:
- Local directory containing `aircraft.json` and `receiver.json`
- HTTP/HTTPS base URL exposing `aircraft.json` and `receiver.json`
- Enriches aircraft data with airline information (embedded from Wikipedia data)
- Calculates distance between receiver and aircraft when the receiver position is known (from receiver.json or -lat/-lon override)
- Includes a ready-to-use Grafana dashboard
- Exports aircraft data as Prometheus metrics.
- Supports multiple data sources:
- Local directory containing `aircraft.json` and `receiver.json`.
- HTTP/HTTPS base URL exposing `aircraft.json` and `receiver.json`.
- Enriches aircraft data with airline information (embedded from Wikipedia).
- Calculates the distance between the receiver and aircraft when the receiver position is known (from `receiver.json` or `-lat`/`-lon` override).
- Includes a ready-to-use Grafana dashboard.

## Installation

### Prerequisites

- *readsb* or *dump1090* with *rtlsdr* or compatible software generating `aircraft.json` and `receiver.json`
- `readsb` or `dump1090` (with `rtlsdr` or compatible hardware) generating `aircraft.json` and `receiver.json`.

### Option 1: Download a release file

Expand All @@ -46,7 +46,7 @@ go build

### Running permanently (Linux)

If you use Linux, you can use [this systemd unit file](./dev/dump1090prom.service) and copy it
If you use Linux with systemd, you can use [this systemd unit file](./dev/dump1090prom.service) and copy it
to `/etc/systemd/system/dump1090prom.service`. You may want to adjust the `port` and add custom parameters in `ExecStart`.
Look for the Configuration and CLI section below for more information.

Expand All @@ -69,28 +69,32 @@ env GOOS=linux GOARCH=arm go build -o dump1090prom

The exporter is configured via command-line flags:

- `-base-url` string
- `-base-url` `string`
Base URL to the directory where aircraft.json and receiver.json are available
- `-base-path` string
- `-base-path` `string`
Local filesystem directory containing aircraft.json and receiver.json, e.g. /var/www/html/data
- `-lat` float
- `-lat` `float`
Override receiver latitude (used for distance calculation)
- `-lon` float
- `-lon` `float`
Override receiver longitude (used for distance calculation)
- `-host` host (default: `127.0.0.1`)
- `-host` `host` (default: `127.0.0.1`)
Override host where /metrics is exposed
- `-port` port (default: `8080`)
- `-port` `port` (default: `8080`)
Override port where /metrics is exposed
- `-verbose` bool (default: `false`)
- `-verbose` `bool` (default: `false`)
Enable verbose logging
- `-distance-calc` bool (default: `true`)
- `-distance-calc` `bool` (default: `true`)
Enable distance calculation to aircraft
- `-airline-label` bool (default: `true`)
- `-airline-label` `bool` (default: `true`)
Enable airline labelling
- `-expose-files` bool (default: `true`)
- `-expose-files` `bool` (default: `true`)
Expose original aircraft.json and receiver.json files at /aircraft.json and /receiver.json
- `-rolling-map-size` int (default: `1000`)
- `-rolling-map-size` `int` (default: `1000`)
Default size of the rolling map for caching
- `-collector` `string` (default: `dump1090prom`)
Constant 'collector' label value of this instance
- `-labels` `string`
Global labels to add to all metrics (e.g., 'location=home,environment=testing')

Notes:
- When `-lat` and `-lon` are not provided, the exporter will try to read receiver position from `receiver.json`.
Expand Down Expand Up @@ -126,16 +130,20 @@ Expose metrics on a different port:
./dump1090prom -base-url http://your-dump1090-server:8080/data -port 9091
```

Typically `dump1090prom` uses `<lat>` and `<lon>` as defined in your `receiver.json`,
if you want to overwrite the receiver position, you can use the `-lat` and `-lon` flags.
Add global labels to all metrics:
```bash
./dump1090prom -base-url http://your-dump1090-server:8080/data -labels "environment=home"
```

Typically, `dump1090prom` uses the `<lat>` and `<lon>` values defined in your `receiver.json`. To override the receiver position, use the `-lat` and `-lon` flags.

```bash
./dump1090prom -base-url http://your-dump1090-server:8080/data -lat <lat> -lon <lon>
```

## Prometheus Configuration

Note: You have to replace `<host_ip>` (and port) with the IP address of your `dump1090prom` server.
Note: Replace `<host_ip>` and port with the IP address of your `dump1090prom` server.

```yaml
scrape_configs:
Expand Down Expand Up @@ -169,50 +177,16 @@ http://localhost:8080/receiver.json

All metrics are prefixed with `dump1090prom_`.

```
dump1090prom_aircraft_adsb_version, Type: GAUGE, Description: Version of the ADS-B protocol in use
dump1090prom_aircraft_altitude_baro_feet, Type: GAUGE, Description: Barometric altitude in feet
dump1090prom_aircraft_altitude_geom_feet, Type: GAUGE, Description: Geometric altitude in feet
dump1090prom_aircraft_barometric_vertical_rate_feet_per_minute, Type: GAUGE, Description: Barometric vertical rate in feet per minute
dump1090prom_aircraft_count, Type: GAUGE, Description: Number of different aircraft currently seen
dump1090prom_aircraft_distance_from_position_meters, Type: GAUGE, Description: Distance in meters from the recording position
dump1090prom_aircraft_flight_info, Type: GAUGE, Description: Metadata about the flight and aircraft
dump1090prom_aircraft_geometric_vertical_rate_feet_per_minute, Type: GAUGE, Description: Geometric vertical rate in feet per minute
dump1090prom_aircraft_ground_speed_knots, Type: GAUGE, Description: Ground speed in knots
dump1090prom_aircraft_gva, Type: GAUGE, Description: Geometric Vertical Accuracy
dump1090prom_aircraft_indicated_airspeed_knots, Type: GAUGE, Description: Indicated airspeed in knots
dump1090prom_aircraft_latitude, Type: GAUGE, Description: Latitude of aircraft
dump1090prom_aircraft_longitude, Type: GAUGE, Description: Longitude of aircraft
dump1090prom_aircraft_mach_number, Type: GAUGE, Description: Mach number
dump1090prom_aircraft_magnetic_heading_degrees, Type: GAUGE, Description: Magnetic heading in degrees
dump1090prom_aircraft_mode_a, Type: GAUGE, Description: Mode A (ident) capability (1 if present)
dump1090prom_aircraft_mode_c, Type: GAUGE, Description: Mode C (altitude) capability (1 if present)
dump1090prom_aircraft_nac_p, Type: GAUGE, Description: Navigation Accuracy Category for Position
dump1090prom_aircraft_nac_v, Type: GAUGE, Description: Navigation Accuracy Category for Velocity
dump1090prom_aircraft_nav_altitude_mcp_feet, Type: GAUGE, Description: MCP/FCU selected altitude in feet
dump1090prom_aircraft_nav_heading_degrees, Type: GAUGE, Description: Selected heading in degrees
dump1090prom_aircraft_nav_qnh_millibar, Type: GAUGE, Description: QNH setting in millibars
dump1090prom_aircraft_nic, Type: GAUGE, Description: Navigation Integrity Category
dump1090prom_aircraft_nic_baro, Type: GAUGE, Description: Navigation Integrity Category for barometric altitude
dump1090prom_aircraft_oat, Type: GAUGE, Description: Outside Air Temperature in Celsius
dump1090prom_aircraft_rc, Type: GAUGE, Description: Radius of containment
dump1090prom_aircraft_roll_degrees, Type: GAUGE, Description: Roll angle in degrees
dump1090prom_aircraft_rssi_dbm, Type: GAUGE, Description: Received Signal Strength Indicator in dBm
dump1090prom_aircraft_sda, Type: GAUGE, Description: System Design Assurance
dump1090prom_aircraft_seen_pos_seconds, Type: GAUGE, Description: Seconds since position was last updated
dump1090prom_aircraft_seen_seconds, Type: GAUGE, Description: Seconds since this aircraft was last seen
dump1090prom_aircraft_sil, Type: GAUGE, Description: Surveillance Integrity Level
dump1090prom_aircraft_spi, Type: GAUGE, Description: Special Position Identification (IDENT)
dump1090prom_aircraft_tat, Type: GAUGE, Description: Total Air Temperature in Celsius
dump1090prom_aircraft_track_degrees, Type: GAUGE, Description: Track angle in degrees (0-359)
dump1090prom_aircraft_track_rate_degrees_per_second, Type: GAUGE, Description: Rate of change of track angle in degrees per second
dump1090prom_aircraft_true_airspeed_knots, Type: GAUGE, Description: True airspeed in knots
dump1090prom_aircraft_true_heading_degrees, Type: GAUGE, Description: Selected true heading in degrees
dump1090prom_now_timestamp, Type: GAUGE, Description: Current timestamp in seconds since the epoch
dump1090prom_total_messages, Type: COUNTER, Description: Total number of messages received
```
| Metric Name | Type | Description |
| ----------- | ---- | ----------- |
| `aircraft_flight_info` | Gauge | Metadata about the flight and aircraft (includes airline, country, squawk, etc.). |
| `aircraft_altitude_baro_feet` | Gauge | Barometric altitude in feet. |
| `aircraft_ground_speed_knots` | Gauge | Ground speed in knots. |
| `aircraft_distance_from_position_meters` | Gauge | Distance from the receiver in meters. |
| `aircraft_count` | Gauge | Total number of aircraft currently seen. |
| `total_messages` | Counter | Total number of messages received. |

Additional metrics are available (see [metric.go](./metric.go) for the full list), including heading, vertical rates, ADS-B version, NAV data, and more.
Additional metrics are available for ADS-B version, vertical rates, navigation data, and more. See [metric.go](./metric.go) for a full list or visit the `/metrics` endpoint.

## Development

Expand All @@ -228,14 +202,5 @@ The `dev` directory contains resources for setting up a development environment:

- `dev/prometheus`: Prometheus configuration and Podman Compose setup

## License
```
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
```

This project is licensed under the terms of the license included in the [`LICENSE`](./LICENSE) file.
This project is licensed under the terms of the [GNU Affero General Public License v3.0](./LICENSE).
Wikipedia airline data is licensed under [CC-BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).
Loading
Loading