Hello,
I'm looking for a way to identify from my Client if the target (connected) OPC-UA server was rebooted. I'm pretty new to the SDK so I'm unsure if this is something possible or not, because I understand it can be a very tricky scenario, for example if the reboot was not planned like when the physical machine where the server is running on was rebooted or a power outage occured.
In a more common scenario I think I can listen to the UnifiedAutomation.UaClient.Session.ConnectionStatusUpdate event, but I want to be sure if there is another way to try to identify this, for example, the OPC-UA Server SDK saves the last start-up time? or the time elapsed since the last successful start-up? That info (if available) could help to do a rough estimate about when happened the last reboot.
Regards
Identify if OPC-UA server was rebooted
Moderator: uasdknet
-
- Hero Member
- Posts: 21
- Joined: 14 Jun 2021, 23:39
- Support Team
- Hero Member
- Posts: 3071
- Joined: 18 Mar 2011, 15:09
Re: Identify if OPC-UA server was rebooted
Hi,
every OPC UA Server has a Node "StartTime" in it's address space. You could read out directly after being connected and check after reconnect. If StarTime is "unchanged", it was (oviously) just a network interuption that caused the reconnect, but if StarTime is different this would indicate that the server was shutdown and completely restarted. Furthermore the Node "ServerStatus" can give you information about the shutdown reason.
every OPC UA Server has a Node "StartTime" in it's address space. You could read out directly after being connected and check after reconnect. If StarTime is "unchanged", it was (oviously) just a network interuption that caused the reconnect, but if StarTime is different this would indicate that the server was shutdown and completely restarted. Furthermore the Node "ServerStatus" can give you information about the shutdown reason.
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Hero Member
- Posts: 21
- Joined: 14 Jun 2021, 23:39
Re: Identify if OPC-UA server was rebooted
Thanks for your reply.Support Team wrote: ↑15 Jun 2021, 09:04Hi,
every OPC UA Server has a Node "StartTime" in it's address space. You could read out directly after being connected and check after reconnect. If StarTime is "unchanged", it was (oviously) just a network interuption that caused the reconnect, but if StarTime is different this would indicate that the server was shutdown and completely restarted. Furthermore the Node "ServerStatus" can give you information about the shutdown reason.
Regarding this info contained inside the StartTime node, I'm wondering if the data is somehow persisted by the Server SDK or if is it needed to implement a custom logic to do it by our own?
For instance, let's say the Windows/Linux machine where the OPC-UA Server is running on was rebooted, then after reboot the OPC-UA server will be autostarted (by a Windows Service or a Linux Daemon) Does the data will be preserved?
- Support Team
- Hero Member
- Posts: 3071
- Joined: 18 Mar 2011, 15:09
Re: Identify if OPC-UA server was rebooted
Hi,
no the server decides himself what data to persist, some servers may even create some "history" of certain data points and store them in a database, but again that is an individual implementation decision on the server side.
Typically, if the server shuts down (for whatever reason) and it will come back later and again initialize or restart his datasource, it will get fresch values from his subsystem and continue with providing live data. In a first place the UA Server is just an casulation (and interface) of some data source. However OPC UA (Historical Access) has the ability provide time series of stored data and events (see historizing attribute of a node).
no the server decides himself what data to persist, some servers may even create some "history" of certain data points and store them in a database, but again that is an individual implementation decision on the server side.
Typically, if the server shuts down (for whatever reason) and it will come back later and again initialize or restart his datasource, it will get fresch values from his subsystem and continue with providing live data. In a first place the UA Server is just an casulation (and interface) of some data source. However OPC UA (Historical Access) has the ability provide time series of stored data and events (see historizing attribute of a node).
Best regards
Unified Automation Support Team
Unified Automation Support Team