feat: Client last seen option
drtech981 opened this issue · 7 comments
Instead of just showing if the client is online or not, it would be nice to have a last seen time for the client, which helps to diagnose certain issues such as power failure or hardware failure from a remote site (just as it shows in zerotier central manager).
+1 for this feature, can help diagnose offline issues, knowing the time a node went offline.
Hello, @drtech981. It is not easy to implement such a feature, as the controller API does not return the last seen member value.
It would require consistent pinging from the server to the backend itself, and saving the "ONLINE" status. Current ZeroUI architecture would require some changes.
I agree that such a feature would be great for the user experience, so any help is welcome.
Yes, the controller API as currently available does not return this value. I have been trying to think about how to do this for a while, but haven't figured out a way yet. I will probably try to see if the ZeroTier implementation with the alternate database tracks online information.
I've made some research on this topic.
If the Postgres database is used, the controller does save the last online time. But maintaining and building each version of the controller from source and adding the Postgres to the setup would require much effort.
ZeroUI is trying to be as efficient and as easy to install as possible.
I think that the better way to implement such a feature is the way as I said before.
For reference, see the https://github.com/zerotier/ZeroTierOne/blob/master/controller/LFDB.cpp
@dec0dOS I was wondering if (when you have a chance) you could give me a basic overview of how the frontend and backend services interact? I'm new to these programming languages and I was specifically wondering if any of the backend services run in the background, or if everything only runs when the admin web pages are loaded. Just trying to see what the options are with saving the online state of ZT clients.
Hey, @timothyle97!
Check the following overview of the ZeroUI architecture:
Express server (backend) serves the frontend HTML/JS/CSS files (React-based application) to the user.
Backend transforms the request from ZeroTier Central API specification to the controller API specification and use the database to store and fetch the external data, that the controller itself does not store.
I see that there is two way to implement this feature: using the postgres controller build that already uses the additional thread on the controller level to store the last online time data. But that approach have several downsides.
So I think that the better way to implement this feature is to use the same technique on the backend level, not the controller level itself. Any nodejs recurring tasks scheduler should be okey for this task. To implement the following feature properly some backlog tasks should be done. Moving to the ES6 modules on the backend level, upgrading current dependencies, improving the developer experience (using the vite build tool).
Any help is welcome! I appreciate your involvement in the ZeroUI project.