FlightAware Discussions

Dump1090 MySQL Database Script with Alert and Filter


#42

that’s for sure :slight_smile:
… understand “<>” as a placeholder for my local adresse my piaware.

nevertheless - I cannot manage to get any DB-insert.

upt(us): 0009202 - 0.989262 loops/s avg - since 0 days 00:12:25 - run 737 @ 201,5 msg/s -> 000 dataset(s) =>
upt(us): 0009467 - 0.989276 loops/s avg - since 0 days 00:12:26 - run 738 @ 200,3 msg/s -> 000 dataset(s) =>
upt(us): 0009261 - 0.989290 loops/s avg - since 0 days 00:12:27 - run 739 @ 198,3 msg/s -> 000 dataset(s) =>
upt(us): 0009454 - 0.989305 loops/s avg - since 0 days 00:12:28 - run 740 @ 200,8 msg/s -> 000 dataset(s) =>


#43

So is your local map reachable via
http://<>/dump1090-fa
?

Did you by any chance install anything else like the adsb-receiver project?


#44

no man … just a simple install like documented : https://de.flightaware.com/adsb/piaware/install
and yes … my dump is up and running, map is reachable in a perfect way.

if you follow that, you will notice that the …./dump-fa/html/ directory has no …html/data directory anymore. however the feeder is doing a good job over month.

-> therefore my initial question if http://<192…my ip>/dump1090-fa/data/ is the correct config. with my understanding the aircraft.json is expected to be there and able to be accessed/shown over a http-request.

the output is the same when placing http://<.my ip.>p/dump1090-fa/data/ or /run/dump1090-fa/ - - > no date is chached to become parsed.

question …
… is for tom’s script a dump1090-mutability neccessary and not a dump1090-fa. that would be sad for the simplicity of installation.


#45

You still didn’t answer my question:

Is the local map accessible?

Does this address (modified for your ip) work?

http://pi/dump1090-fa/data/aircraft.json

Yes that’s where it is supposed to be with the default setup.

It may be a problem with the json format. Some filed names changed, altitude to alt-baro for example i believe.
The 3.5 version didn’t have it yet but 3.6 has it.


#46

i did (2nd line) … map is reachable - but that is not my question:

  • i have no issue with my dump1090.
  • i have an issue with the stream, documented by http://<.my ip.>p/dump1090-fa/data /

#47

So the first thing to do is accessing aircraft.json manually with a browser to make sure that it loads.

If it does indeed load the problem may be of another variety. (dataformat as i wrote in the edit of the previous message)

Oh you are having problems with understanding the webserver:
It just transparently uses /run/dump1090-fa and serves it under /dump1090-fa/data on the web.

See the config files in /etc/lighttpd/conf-enabled if you are interested.


#48

thanks for the tip with "http://< 192…my ip>/dump1090-fa/data/aircraft.json"
this i checked already and you run into any error message… +**

also thanks for that claification regarding lighttpd, did not notice that so far.
you are right with /etc/lighttpd/conf-enabled/sudo nano 89-dump1090-fa.conf (checked)

your last tip with the change to v3.6 could be the trick … .
WChouBoston mentioned something like that already, but did not reply anymore to TomMuc :cry:


#49

This file should be accessible no matter the dump1090-fa version. What error are you getting?

If this file isn’t working the local map shouldn’t be working either.

Regarding the variable changes i’m sure it’s not rocket science.
Maybe i’ll take a look at it.


#50

just in time … sort before to check out with v3.5.3.
with /aircraft.json in the file I get following error:

… failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found

with just the path, i do not get an error message at all.
((b.t.w. as well not when I am using the path to run/dump-fa))


#51

What was the exact path you used.
How do you reach the local map.

Regarding the versions i’m making the necessary changes to radar.php and will share them with you shortly.


#52

@TomMuc

Here is a snippet of the new aircraft.json as used by dump1090-fa

{"hex":"484132","flight":"KLM1976 ","alt_baro":36675,"alt_geom":37175,"gs":514.3,"ias":259,"tas":452,"mach":0.792,"track":301.4,"track_rate":0.00,"roll":-0.2,"mag_heading":293.0,"baro_rate":896,"geom_rate":896,"squawk":"1000","category":"A0","nav_qnh":1013.2,"nav_altitude":38000,"lat":50.450103,"lon":11.966784,"nic":7,"rc":371,"seen_pos":0.8,"version":0,"nac_v":0,"mlat":[],"tisb":[],"messages":1384,"seen":0.1,"rssi":-19.8},
    {"hex":"4d02f5","alt_baro":25400,"mlat":[],"tisb":[],"messages":39,"seen":6.0,"rssi":-33.1},
    {"hex":"8852a1","flight":"THA921  ","alt_baro":11500,"alt_geom":11700,"gs":367.1,"ias":314,"tas":372,"mach":0.580,"track":88.8,"track_rate":0.03,"roll":-0.4,"mag_heading":89.3,"baro_rate":832,"geom_rate":800,"squawk":"7647","emergency":"none","category":"A5","nav_qnh":1013.6,"nav_altitude":23008,"nav_heading":89.3,"lat":50.064789,"lon":9.341125,"nic":8,"rc":186,"seen_pos":0.3,"version":2,"nic_baro":1,"nac_p":10,"nac_v":1,"sil":3,"sil_type":"perhour","gva":2,"sda":2,"mlat":[],"tisb":[],"messages":1420,"seen":0.3,"rssi":-6.6},
    {"hex":"44065b","version":0,"mlat":[],"tisb":[],"messages":17,"seen":177.4,"rssi":-33.1},

I’m thinking the php can probably be adapted to accept both json data formats?
I’ll probably download it just to test it :slight_smile:


#53

ok …
i can reach my map under:

even when asked for the url in the php-file, i tried with /run/dump-fa/
here, as mentioned, I do not run into error messages but as well noc success with that trial.
before being asked - also checked: http://192.168.178.113:8080/data/

so going back to : http://192.168.178.113/dump1090-fa/data/


#54

So does this link work for you:

http://192.168.178.113/dump1090-fa/data/aircraft.json

Because it should :wink:


#55

This signifies that you are getting data. There is just nothing being fed into the database i’m not sure why.
It may be due to the json format but it might also have to do with the rest of your setup.
Not sure when something is put into the database at all.

I’ll try the script locally but i need to check how it works first it might be a day :slight_smile:


#56

@ZMS i’ve figured out a solution

So below this line (line 132 for me, the end of a block of lines starting with “isset”)

                 isset($row['tisb']) ? $ac_tisb = implode(' ', $row['tisb']) : $ac_tisb = '';

add the following 3 lines

                isset($row['gs']) ? $ac_speed = $row['gs'] : false;
                isset($row['baro_rate']) ? $ac_vert_rate = $row['baro_rate'] : false;
                isset($row['alt_baro']) ? $ac_altitude = $row['alt_baro'] : false;  

Basically without altitude the filter for adding stuff to the database does not trigger.
Also make sure you have the minlat and maxalt and stuff set properly :wink:

@TomMuc
I guess you don’t need a pull request on github for this do you? :slight_smile:
Otherwise i can make one.
It also spits out nac_p instead of nuc_p now but i don’t know if it is the same data format.


Daily Log/E-Mail Aircraft Report directly on your RaspberryPi
#57

thx … however, still the same on my side :frowning:

no error messages:

upt(us): 0005437 - 0.993056 loops/s avg - since 0 days 00:09:36 - run 572 @ 65,5 msg/s -> 000 dataset(s) =>
upt(us): 0005717 - 0.993068 loops/s avg - since 0 days 00:09:37 - run 573 @ 66,2 msg/s -> 000 dataset(s) =>
upt(us): 0005934 - 0.993080 loops/s avg - since 0 days 00:09:38 - run 574 @ 67,5 msg/s -> 000 dataset(s) =>

code changed:

isset($row[‘tisb’]) ? $ac_tisb = implode(’ ', $row[‘tisb’]) : $ac_tisb = ‘’;
isset($row[‘gs’]) ? $ac_speed = $row[‘gs’] : false;
isset($row[‘baro_rate’]) ? $ac_vert_rate = $row[‘baro_rate’] : false;
isset($row[‘alt_baro’]) ? $ac_altitude = $row[‘alt_baro’] : false;

and lon/lat expanded to almost “half of Bavaria”:

$user_set_array['max_lat'] = 48.5;    $user_set_array['min_lat'] = 47.9;    $user_set_array['max_alt'] = 30000;
$user_set_array['max_lon'] = 10.5;    $user_set_array['min_lon'] = 12.5;

I will try a new install of v3.5.3 and test again.


#58

The aircraft.json is being read just fine.
We can check if if the reading works with this below the code you already inserted

                 var_dump($ac_altitude);                                                                                            
                 var_dump($ac_lat);

Then when you run it quite a bit of stuff will be displayed. It should be some altitudes and latitudes.
Some values may be 0 but if all values are 0 it’s bad.

I think the error is somewhere in radar.php

Did you by chance set filter_mode_database_limited to true?
That needs to be false otherwise only the aircrafts matching your txt files will be stored in the database.


#59

highliy arpeciate yout efforts on this …

sure, all filters are on “false” :wink:
moved the output into a file … better instead of a description:

Datei von filehorst.de laden


#60

That looks just fine it should be working.

Oh you have reversed max and min lon.

That is the problem.

@tomMuc Placing max before min … do you wan’t to confuse people? :wink:


#61

caramba!! I was sure i chcked that several times …

guess what - i have entries in DB :grinning:
let me do some more tests … and i will finally revert after that.

thanks a lot !

upt(us): 2580497 - 0.293578 loops/s avg - since 0 days 00:03:38 - run 64 @ 88,9 msg/s -> 004 dataset(s) => inserted
upt(us): 3355022 - 0.292793 loops/s avg - since 0 days 00:03:42 - run 65 @ 90,5 msg/s -> 004 dataset(s) => inserted
upt(us): 2532945 - 0.293333 loops/s avg - since 0 days 00:03:45 - run 66 @ 92,3 msg/s -> 004 dataset(s) => inserted