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

unbelivable again you used the WRONG path with directory ‘run’

I tried that earlier and it works. I don’t know what is going on with it.

{ “now” : 1507801726.0,
“messages” : 159880,
“aircraft” : [
{“hex”:“7c3ef4”,“altitude”:5975,“vert_rate”:0,“track”:200,“speed”:148,“mlat”:,“tisb”:,“messages”:16,“seen”:3.9,“rssi”:-26.0},
{“hex”:“7cf331”,“type”:“adsb_icao_nt”,“mlat”:,“tisb”:,“messages”:4,“seen”:76.2,“rssi”:-26.6},
{“hex”:“7c6de3”,“squawk”:“1173”,“flight”:"QFA635 ",“lat”:-35.009674,“lon”:146.458012,“nucp”:7,“seen_pos”:51.0,“altitude”:38000,“vert_rate”:0,“track”:220,“speed”:419,“category”:“A0”,“mlat”:,“tisb”:,“messages”:111,“seen”:1.6,“rssi”:-19.9},

etc etc etc

whats the ip you used for above output?

Aha! Damn, I thought I removed that!

Ok, it is working now :slight_smile:

pi@zeropi:~ $ php /home/pi/ac_counter.php
upt(us): 0045569 - 1.000000000000 loops/s avg - since 0 days 00:00:00 - run(s) 0 => 0027 aircraft(s) @ 0 messages today (UTC)
upt(us): 0044025 - 1.000000000000 loops/s avg - since 0 days 00:00:01 - run(s) 1 => 0032 aircraft(s) @ 17 messages today (UTC)
upt(us): 0029375 - 1.000000000000 loops/s avg - since 0 days 00:00:02 - run(s) 2 => 0032 aircraft(s) @ 44 messages today (UTC)
^C

Thanks Tom.
I’ll see how it goes at the change of day.

HALLELUJAH :slight_smile:

1 Like

I had that in the beginning (you can see that in my PM that you posted above), I don’t know why it didn’t work then but it is now.

nope - you had ‘dump1090’ what is the standard for dump1090-mutability. but obviously you use the flightaware sd-card that uses dump1090-fa and so your path is ‘dump1090-fa’

you had: http://127.0.0.1/dump1090/data/aircraft.json
you have now: http://127.0.0.1/dump1090-fa/data/aircraft.json

Oh yes, I did. I thought I tried -fa as well. I mustn’t have. Any way, hopefully it is working now. :slight_smile:

if you setup email and cronjob proper and rebooted the pi after setting up the cronjob no question it will work. i have my excel list every morning in email

@comet123

line 28 and 54 from all lines incl. empty ones - comment out to send test-mails. don’t forget to uncomment after test. run the script just 3-5 seconds in terminal - otherwise you get hundreds of e-mails:

#if ($seconds_of_day > time() - strtotime('today')) {

and the closing gap

#}

Thank you so much for the help, it really is appreciated. Is it possible to include the aircraft registration as well?

possible yes - but i don’t want this because the tail number is not part of the messages but comes from databases which are often incomplete, not up-to-date or wrong. you can always do this at your end using e.g. the databases from vrs/planeplotter or others …

edit: for example you could import the csv-data to a database of your choice, import one of those databases (e.g. basestation) and then run a select with join over both tables using the hex-code as unique identifier

I’ve added a squawk column into the code,

“\t” . ‘“Squawk”’ .

and

isset($row[‘squawk’]) ? $ac_squawk = $row[‘squawk’] : $ac_squawk = ‘’;

The column name is showing up in excel but not the information.

How do you fix it?

you have to add it to the array too …

p.s. fwiw the squawk could change over the day and only the last value will be recorded

Tom,

Would I be right in concluding that sendmail is too much for a zeroW that’s already feeding PA, PF, RB + FR24?

I still am not receiving emails, either waiting for the change of day or commenting out those lines in your script as a test. I’ve been right through the script and I’m sure it is correct. Running php /home/pi/ac_counter.php will give an output, but I can’t get an email.

I tried sudo service sendmail status and got the following;
pi@zeropi:~ $ sudo service sendmail status
● sendmail.service - LSB: powerful, efficient, and scalable Mail Transport Agent Loaded: loaded (/etc/init.d/sendmail) Active: active (running) since Sat 2017-10-14 18:17:26 AEDT; 1h 6min ago Process: 483 ExecStart=/etc/init.d/sendmail start (code=exited, status=0/SUCCESS) CGroup: /system.slice/sendmail.service └─938 sendmail: MTA: accepting connections

Oct 14 18:17:08 zeropi su[789]: pam_unix(su:session): session opened for user smmsp by (uid=0)
Oct 14 18:17:15 zeropi sm-mta[938]: starting daemon (8.14.4): SMTP+queueing@00:10:00
Oct 14 18:17:26 zeropi systemd[1]: Started LSB: powerful, efficient, and scalable Mail Transport Agent.
Oct 14 18:17:26 zeropi sendmail[483]: .
Oct 14 18:18:35 zeropi sm-mta[938]: rejecting connections on daemon MTA-v4: load average: 12
Oct 14 18:18:35 zeropi sm-mta[938]: rejecting connections on daemon MSP-v4: load average: 12
Oct 14 18:18:50 zeropi sm-mta[938]: rejecting connections on daemon MTA-v4: load average: 12
Oct 14 18:18:50 zeropi sm-mta[938]: rejecting connections on daemon MSP-v4: load average: 12
Oct 14 18:19:05 zeropi sm-mta[938]: accepting connections again for daemon MTA-v4
Oct 14 18:19:05 zeropi sm-mta[938]: accepting connections again for daemon MSP-v4

Google says that rejecting connections is due to excessive load, uptime shows;
pi@zeropi:~ $ uptime 19:25:13 up 1:08, 3 users, load average: 1.27, 1.01, 1.05
It is sometimes higher. I know the zero runs pretty hard but usually around the 0.8-1.0 mark unless I’m doing other stuff on it.

I haven’t tried it on the RPi3 so I’m just guessing that sendmail is pushing the load up and then rejecting connections due to high load??

As you know, this is not my forte, I have spent the whole afternoon googling and experimenting.

Would changing the nice setting for sendmail help at all to try and give it priority for a few moments?

sorry but i cannot really see the logic behind all that. your first post was about ‘the pi zero does not even manage one feed the same way your pi3 does’. now you setup 4 feeds on the zero (maybe with mlat) and additional tasks …

to test whether overload is the problem simply kill the 3 additional feeds/tasks, comment out the specified two lines, run the script in terminal for 3-5 seconds and look into your google email account (maybe spam folder too) while viewing top command in a second terminal.

what i also wonder always why all ask their questions here, use the most performant dump1090 flavor that is developed here and then feed their data to those they get nothing from beside the ridiculous premium website blah.

Well, the first post has been solved and zero /=/RPi3, that’s never been a question. The zero has always run the 4 feeds and does so nicely now that I’ve solved the original problem. The 4 feeds combined use about 15% cpu max. I’ll just leave it how it is and forget about the emails, that was just an experiment. BTW uninstalling sendmail saw the load drop from 1.00-2.00 down to 0.60-0.80

my zero w runs with 8% cpu load while receiving more than 300 aircrafts and even while sends out one email with csv attachment per second in parallel climbs to max 20% cpu. having sendmail just installed has about zero influence to cpu load.

edit: and the script under working condition has to send out 1 email per day! not 1 per second what i’ve tested just to show that even this were no problem at all

I don’t know how that works. On my zero, dump1090 uses 31% cpu by itself. With the system + 4x feeders, all up its running around 42-55%.

1 Like