Cannot change the short template for deviceInactive

Victor Butler7 months ago

Hello,

I have a very strange issue - I cannot seem to change the text in the deviceInactive short template. I have uploaded the new template and restarted the server several times but still all inactive alerts are being sent using the default template.

All other templates can be changed without any issues. It's the default traccar installation.

Is there anything in addition that needs to be done to change the inactive template?
Or any suggestion where to look for issue root cause?

Thank you!

Anton Tananaev7 months ago

There's no caching for templates, so if you changed the right file, it will pick up the update even without restart. If you still have old template, it means you haven't updated the right file.

Victor Butler7 months ago

I am literally downloading the template from the sever, the updated text is correct but when the notification is triggered the notification text is wrong.

This the the filepath: traccar/templates/short/deviceInactive.vm.

No other ideas of what might be wrong?

Anton Tananaev7 months ago

I'm pretty sure you're missing something. Again, there's no other place for server to get that template from.

Victor Butler7 months ago

It is strange indeed. I am now trying to troubleshoot and I changed the Device Inactivity Period from 5 days down to 1 minute and no notifications are triggered. The change was done via the modern interface. Any idea why no notification is triggered? Is there any other condition to be met?
Test and other notifications work.

Anton Tananaev7 months ago

It cannot be triggered in a minute. The task is run once every 15 minutes or so.

Victor Butler7 months ago

Ok, I didn't know that. So should I change the inactivity period for the device to 15 min or it's ok if I leave it at 60000 milliseconds, i.e. 1 min?

Anton Tananaev7 months ago

You can see if it works with 1 minute after 15 minutes. Let us know.

Victor Butler7 months ago

It didn't work, so I will try with 15 min period now. There isn't a way to trigger the inactivity notification manually, is it?

Anton Tananaev7 months ago

No. The way we test it locally is changing the period in the code to something like 1 minute.

Victor Butler7 months ago

Thanks for the feedback!
So I did some more tests and also looked at the code to better understand how the feature is supposed to work.
There is something irregular about the task that should be running every 15 minutes, see below:

I have a device that has been inactive since the beginning of August, it is configured as follows from the very start (no changes made since then):
deviceInactivityStart: 7200000
deviceInactivityPeriod: 86400000

With the following setup the deviceInactive event should be recorded every 24 hours but instead there are quite sizable gaps in the event logs, on occasions 2 months+ without any inactive event being recorded:
Inactive Events

No error/warning logs in the log file which repeat every 15 min or so.

What can be preventing the task from running / recording the events regularly?

Anton Tananaev7 months ago

If you do a restart, it could mess up with the task.

Victor Butler7 months ago

Like just one restart or regular restarts?

Anton Tananaev7 months ago

Like a restart when the event should be generated.

Victor Butler7 months ago

Well, there might have been an occasional restart during the last 3 months, but the event for this particular device should be generated every 24h. There are gaps of 2 months without an event and there definitely haven't been daily restarts at the same time.

I also changed the deviceInactivityPeriod to 1 hour after our discussion yesterday and there hasn't been a single event generated since then.

Couple of questions to hopefully point me in the right direction:

  1. Is the task entirely a java process or is it like a cron job task?
  2. If the task fails to trigger for any reason would there be a log and where should I look for one?