Any suggestion to monitor the server time on windows server. I need an alert when the time and date on the server is incorrect.
This is a stickier question that it appears because determining what the "right" time is when you actually get to the point in the code to compare is almost impossible. And at least in my case when I addressed this issue, it wasn't so much a concern that the time was wrong but more how different it was from the nearby servers that depended on having a same time.
In my case what I did was to take advantage of the controller get_info callback to query the current time and timezone of the robot(s) in question. Then I could compare that in a script run by the nas.
If you wanted to go for local monitoring, you could use logmon or nexec to run a powershell or cmd script. For example this would compare time to one common time provider in my area. In real world, you'd probably like to point it towards a domain controller:
[double](w32tm /stripchart /computer:time1.mikes.fi /samples:1 /dataonly | select-string -Pattern "(\d+\.\d+)s$").Matches.Groups.Value -gt 60
So this will return True if time difference between local computer and time provider is more than 60 seconds and false if not.
if a robot is running on this server you can use a short LUA script (within Auto Operator of NAS) which can retrieve the "current_time" of the server with controllers callback "get_info" and compare this with the current_time of the UIM/NMS-Server.
Retrieving data ...