//===================================================================== Static API

        /// <summary>
        /// Periodically calles the Heartbeat client method for providing state information about task agents. The message is sent to all clients.
        /// </summary>
        public static void Heartbeat(string machineName, string agentName, SnHealthRecord healthRecord)
        {
            SnTrace.TaskManagement.Write("TaskMonitorHub Heartbeat. MachineName: {0}, agentName: {1}, healthRecord: {2}", machineName, agentName, healthRecord);

            // heartbeat is sent to every monitor client
            var hubContext = GlobalHost.ConnectionManager.GetHubContext <TaskMonitorHub>();

            hubContext.Clients.All.Heartbeat(agentName, healthRecord);
        }
Esempio n. 2
0
 public void Heartbeat(string machineName, string agentName, SnHealthRecord healthRecord)
 {
     SnTrace.TaskManagement.Write("AgentHub Heartbeat. Agent: {0}, data: {1}.", agentName, healthRecord);
     try
     {
         TaskMonitorHub.Heartbeat(machineName, agentName, healthRecord);
     }
     catch (Exception ex)
     {
         SnLog.WriteException(ex, "AgentHub RefreshLock failed.", EventId.TaskManagement.General);
     }
 }
 /// <summary>
 /// Periodically calls the Heartbeat client method for providing state information
 /// about task agents. The message is sent to all clients.
 /// </summary>
 public static async Task Heartbeat(this IHubContext <TaskMonitorHub> hubContext,
                                    string machineName, string agentName, SnHealthRecord healthRecord)
 {
     try
     {
         // the heartbeat is sent to every monitor client
         await hubContext.Clients.All.SendAsync("heartbeat", agentName, healthRecord)
         .ConfigureAwait(false);
     }
     catch (Exception ex)
     {
         SnLog.WriteException(ex, "TaskMonitorHub Heartbeat failed.", EventId.TaskManagement.General);
     }
 }
Esempio n. 4
0
 public async Task Heartbeat(string machineName, string agentName, SnHealthRecord healthRecord)
 {
     SnTrace.TaskManagement.Write($"AgentHub Heartbeat. Machine: {machineName}, Agent: " +
                                  $"{agentName}, Process id: {healthRecord.ProcessId}, " +
                                  $"RAM: {healthRecord.RAM}, CPU: {healthRecord.CPU}.");
     try
     {
         await _monitorHub.Heartbeat(machineName, agentName, healthRecord).ConfigureAwait(false);
     }
     catch (Exception ex)
     {
         SnLog.WriteException(ex, "AgentHub Heartbeat failed.", EventId.TaskManagement.General);
     }
 }
Esempio n. 5
0
        // ===================================================================== Client Hub API (called by the server)

        /// <summary>
        /// Periodically calles the Heartbeat client method for providing state information about task agents. The message is sent to all clients.
        /// </summary>
        public void Heartbeat(string agentName, SnHealthRecord healthRecord)
        {
            SnTrace.System.Write("SNTaskMonitorHub Heartbeat. AgentName: {0}, healthRecord: {1}", agentName, healthRecord);

            Clients.All.Heartbeat(agentName, healthRecord);
        }