Restart Service
Hello! I was wondering if there was a way to have a Service in HealthConnect restart if there have not seen any messages in a certain amount of time? I have a connection problem that requires me to restart services often and I was hoping to create a task that would automatically restart the services. Thank you!
In this article @Eduard Lebedyuk creates a production monitor to check the inactivities for the different components
You can modify the following code:
If (tDiff > tTimeout) && ((lastActivityReported="") || ($system.SQL.DATEDIFF("s",lastActivityReported,lastActivity)>0)) { Set tText = $$$FormatText("InactivityTimeoutAlert: Inactivity timeout of '%1' seconds exceeded for host '%2'", +$fn(tDiff,,0), tHost) Do ..SendAlert(##class(Ens.AlertRequest).%New($LB(tHost, tText))) Set $$$EnsJobLocal("LastActivity", tHost) = lastActivity }
Replacing the SendAlert by:
If (tDiff > tTimeout) && ((lastActivityReported="") || ($system.SQL.DATEDIFF("s",lastActivityReported,lastActivity)>0)) { Set tText = $$$FormatText("InactivityTimeoutAlert: Inactivity timeout of '%1' seconds exceeded for host '%2'", +$fn(tDiff,,0), tHost) Set tSC = ##class(Ens.Director).EnableConfigItem(tHost,0) Set tSC = ##class(Ens.Director).EnableConfigItem(tHost,1) Set $$$EnsJobLocal("LastActivity", tHost) = lastActivity }