Export metrics from ASCOM devices via Alpaca in a form that Prometheus can scrape.
- install requirements
- install all ASCOM drivers needed
- install Alpaca (ASCOM Remote)
- configure ASCOM Remote
# install required modules
pip3 install -r requirements.txt
Run the exporter with the port to expose metrics on, the base alpaca URL, and the device IDs of all devices to monitor. If you have more than one of a type of device simply use the device twice.
The following runs the exporter for one telescope and two cameras.
python src/alpaca-exporter.py --port 8001 --alpaca_base_url http://127.0.0.1:11111/api/v1/ --refresh_rate 10 --telescope 0 --camera 0 --camera 1
In your favorite browser look at the metrics endpoint. If it's local, you can use http://localhost:8001
Configure global labels. They are applied to every single device metric. Each of the configured labels must be available for all devices!
labels:
- alpaca_name: name of the alpaca property [required]
label_name: override alpaca name to something else [optional]
cached: 1 # if 1, values are cached for 60 seconds
The filename is used to group configuration for a specific device.
Three things to configure:
- base metric name
- device specific labels
- the metrics
The metric_prefix
is prepended to each metric name.
metric_prefix: alpaca_telescope_
The device specific labels behave the same as global.yaml labels, except specific to this device. See global.yaml.
The metrics are similar to labels but result in a metric at the end.
metrics:
- alpaca_name: name of the alpaca property [required]
metric_name: override alpaca name to something else [optional]
cached: 1 # if 1, values are cached for 60 seconds
And the metric_prefix
is prepended. For example, the alpaca_telescope_tracking_rage
metric is created from:
metric_prefix: alpaca_telescope_
metrics:
- alpaca_name: trackingrate
metric_name: tracking_rate
cached: 1
Note it overrides the property in Alpaca and caches the result (not expected to change often).
On startup the exporter lists what could be connected and what couldn't. In addition, there is a alpaca_device_connected
metric that indicates what is connected over time.
PR's welcome! The config/
directory contains all the configurations. Everything is device specific with the exception of global.yaml
. The global configuration applies labels to every metric you export.
Unfortunetly switches are special. There is an id
query param required for getting the individual switch device metrics. This is managed in the exporter code and you do not have to worry about it in the configuration. The downside is every switch device is queried, which may result in higher traffic.