Traccar 3.8 - offline events

nickthesloth7 years ago

Hi,

I setup a quick server a couple of days ago to experiment with and then yesterday setup a Linux installation to put into use. I didn't realise 3.8 had been released between my two installs till I noticed the web interface had moved about.

Anyway - on the previous version, I seemed to get offline events fairly rapidly from my experimenting with Traccar Client. With 3.8, I can't seem to get any online or offline events when I close the client and wait. I'd set the client to update every 30 seconds, and then put the following in my config to see if I could make it easier to persuade:

<entry key='osmand.timeout'>45</entry>

If I kill the client app, I can see from the traccar log that 45 seconds after the last update, it does timeout and disconnect. But the web side doesn't seem to pay attention and stays green for 10 minutes before going yellow for at least another 20 minutes (it seems, will leave it longer and see). Not sure if I need to wait longer before it decides its offline and generate an event?

If I restart the server, the device is red. If I then start the client, it sends its position and goes green, but I also never get a notification/event of it coming online either. If I remove the device entrely, I sometimes get a notification of the device moving, but after that I get nothing.

Might be missing something, would like to know reasonably quickly if a device does lose coverage/connection.

Thanks

Anton Tananaev7 years ago

Offline state has been disabled for HTTP-based protocols because it doesn't make sense. Session can be closed after every HTTP request, so it doesn't make sense to generate online/offline event for each of them. It will never go offline (only after server restart).

I guess we should add notification for "unknown" (yellow) state. The timeout is configurable and is 10 minutes by default.

Anton Tananaev7 years ago

I have implemented "unknown" status event. It will be available in the next release.

nickthesloth7 years ago

Ahh, that explains it :)

10 minutes works for me - the unknown event sounds good, thanks!

nickthesloth7 years ago

Hi,

What would be the default timeout before considering a non-HTTP device goes offline?

I have another device now using the TK103 protocol, that hasn't been on for some time today. It went yellow after 10 minutes.

Thanks

Anton Tananaev7 years ago

Devices go offline only when connection is closed. If you don't explicitly specify timeout in the server config, connection usually timeout after about 2 hours. That's OS level timeout.

nickthesloth7 years ago

Okay - I've done that, and in the web interface, I see the device go red/offline. But no event gets recorded in the database, and I don't get any notification?

Before adding the timeout, I'd left the tracker powered off for 6 hours and it was still showing as 'unknown'.

Anton Tananaev7 years ago

To receive notifications. make sure you have following line in the config:

<entry key='event.statusHandler'>true</entry>

If status is unknown after 6 hours, it means either offline status is not applicable to the particular protocol, or connection is still in open state.

nickthesloth7 years ago

Ahh... that'll do it. Getting the notifications now!

Was that removed / default changed between 3.7 and 3.8 possibly? On the 3.7 version (on Windows, whereas on ubuntu now) I had for a few hours, the only thing I did in the config was add SMTP settings. Not complaining at all, just wondering.

Anton Tananaev7 years ago

That was accidentally removed with some modifications in the config. It will be back starting from next release.