FlightAware Discussions

API for user stats / status

Is there an API that gives access to user status information - broadly equivalent to
https://flightaware.com/adsb/stats/user/xxxxxxxxxx

Reason - I would like to be able to periodically check the last data feed time and probably the number of aircrasft reported for each of last 24 hours so that I could have a script detect when things are not working correctly … and potentially feed that as an alert into something else … so that I can investigate/fix quicker than waiting for an email alert from FA.

Things were running smoothly for a long time but over recent months there have been some outages that took 12 hours to notice and resolve.

(I have just moved from old software running in Docker to the new 3.8 as a local install in an attempt to make things run better and also make it easier to diagnose stuff).

if you’re running a self-created feeder, e.g. Raspberry you might have other options to react automatically if something stops working.

My device is losing network connection from time to time. So i am using a script which pings a specific IP adress frequently and restart the network interface if ping is not working.
Based on the data/feed you’re uploading you could generate a script as well. That would be faster than reacting on the stats page.

If it is indeed a network connectivity issue, you don’t even have to write your own script. Just use the one in this post. PiAware WiFi looses connection randomly - Work-round found

Thanks for the suggestions.
I had seen that script and the one that handles dump1090 “wedging” (not a term I had come across in this context before).
In my case, when data was no longer reaching FA I simply ssh’d into the RPi and restarted both Docker images (dump1090 and piaware). So networking, at least at a local level, was working fine (because I was able to SSH in).
Also - that RPi (Zero) was connected by Ethernet (usb to Ethernet) rather than WiFi.

As of yesterday I am running dump1090/piaware on RPi4 over Ethernet and have stopped the Docker images on the other system.

Anyway - I’d still like to see an API to the user stats … it could then also be used by the mobile app to show user stats.

I am using this script:

Nope, because the app from FA does have a complete different scope.

Maybe I’ll see if I can get the data from /var/log/piaware.log … like

Jan  8 08:07:53 hostname piaware[620]: 72221 msgs recv'd from dump1090-fa (888 in last 5m); 71293 msgs sent to FlightAware

then push the timestamp and some of the numbers to Home-Assistant … could then show them on graph (for previous 80 hours) and, more importantly, trigger an alert if no data received or numbers are 0.

You might want to look at /run/piaware/status.json and /run/dump1090-fa/stats.json (both of these are actually exposed over HTTP too if you’d rather do it remotely)

Thanks - I have
http://faserver:8080/data/stats.json
and I presume that the status.json is on port 80 (rather than 8080) but can you tell me the prefix as I cannot find it … I tried looking in /etc/lighttpd/conf-enabled but did not spot it.

It’s at /status.json on port 80 on piaware sdcard images (it’s exposed to support the top-level status/landing page that sdcard images provide). For package installs you’ll need to add something to the lighttpd config by hand (or install the piaware-web package if you don’t mind it taking over the top level index):

alias.url += (
    "/status.json" => "/run/piaware/status.json"
)

Thanks - that did it.
sudo apt install piaware-web