240 lines
8.0 KiB
C#
240 lines
8.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace BizTalkCheckmkPulse
|
|
{
|
|
/// <summary>
|
|
/// Definiert die von Checkmk erwarteten numerischen Service-Zustaende.
|
|
/// </summary>
|
|
internal enum CheckState
|
|
{
|
|
Ok = 0,
|
|
Warning = 1,
|
|
Critical = 2,
|
|
Unknown = 3
|
|
}
|
|
|
|
/// <summary>
|
|
/// Unterscheidet fortsetzbare und nicht fortsetzbare suspendierte Instanzen.
|
|
/// </summary>
|
|
internal enum SuspendedKind
|
|
{
|
|
Resumable,
|
|
NonResumable
|
|
}
|
|
|
|
/// <summary>
|
|
/// Kennzeichnet den technischen Bereich, in dem eine Diagnose entstanden ist.
|
|
/// </summary>
|
|
internal enum DiagnosticArea
|
|
{
|
|
Wmi,
|
|
Sql,
|
|
EventLog,
|
|
General
|
|
}
|
|
|
|
/// <summary>
|
|
/// Klassifiziert Fehler, damit Bediener eine passende Massnahme erhalten.
|
|
/// </summary>
|
|
internal enum DiagnosticCategory
|
|
{
|
|
Permission,
|
|
Connectivity,
|
|
Timeout,
|
|
Configuration,
|
|
Schema,
|
|
Provider,
|
|
Unexpected
|
|
}
|
|
|
|
/// <summary>
|
|
/// Strukturierte Diagnose mit Ursache und konkreter Handlungsempfehlung.
|
|
/// </summary>
|
|
internal sealed class ProbeDiagnostic
|
|
{
|
|
public DiagnosticArea Area { get; set; }
|
|
public DiagnosticCategory Category { get; set; }
|
|
public string Component { get; set; }
|
|
public bool Required { get; set; }
|
|
public string Summary { get; set; }
|
|
public string Action { get; set; }
|
|
public string TechnicalDetails { get; set; }
|
|
|
|
/// <summary>
|
|
/// Erstellt eine kompakte, fuer Checkmk geeignete Diagnosezeile.
|
|
/// </summary>
|
|
/// <returns>Menschenlesbarer Text mit Kategorie, Ursache und Massnahme.</returns>
|
|
public string ToDisplayText()
|
|
{
|
|
var text = Area + "/" + Category + " [" + (Component ?? "unknown") + "]: " + (Summary ?? "Unbekannter Fehler.");
|
|
if (!string.IsNullOrWhiteSpace(Action))
|
|
{
|
|
text += " Massnahme: " + Action;
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(TechnicalDetails))
|
|
{
|
|
text += " Technik: " + TechnicalDetails;
|
|
}
|
|
|
|
return text;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sammelt alle Ergebnisse eines Programmlaufs.
|
|
/// </summary>
|
|
internal sealed class ProbeResult
|
|
{
|
|
/// <summary>
|
|
/// Initialisiert leere Ergebnislisten und Zustandsobjekte.
|
|
/// </summary>
|
|
public ProbeResult()
|
|
{
|
|
Diagnostics = new List<ProbeDiagnostic>();
|
|
Platform = new PlatformState();
|
|
HostInstances = new List<HostInstanceState>();
|
|
SuspendedInstances = new List<SuspendedInstance>();
|
|
ReceiveLocations = new List<ReceiveLocationState>();
|
|
SendPorts = new List<SendPortState>();
|
|
Applications = new List<ApplicationRuntimeState>();
|
|
SqlTargets = new List<SqlAccessState>();
|
|
EventLog = new EventLogState();
|
|
}
|
|
|
|
public List<ProbeDiagnostic> Diagnostics { get; private set; }
|
|
public PlatformState Platform { get; private set; }
|
|
public List<HostInstanceState> HostInstances { get; private set; }
|
|
public List<SuspendedInstance> SuspendedInstances { get; private set; }
|
|
public List<ReceiveLocationState> ReceiveLocations { get; private set; }
|
|
public List<SendPortState> SendPorts { get; private set; }
|
|
public List<ApplicationRuntimeState> Applications { get; private set; }
|
|
public List<SqlAccessState> SqlTargets { get; private set; }
|
|
public string ExecutionIdentity { get; set; }
|
|
public string NetworkIdentityHint { get; set; }
|
|
public EventLogState EventLog { get; private set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Beschreibt Erreichbarkeit und Teilverfuegbarkeit der BizTalk-WMI-Daten.
|
|
/// </summary>
|
|
internal sealed class PlatformState
|
|
{
|
|
public bool WmiConnected { get; set; }
|
|
public bool PlatformDataAvailable { get; set; }
|
|
public bool HostInstancesDataAvailable { get; set; }
|
|
public bool SuspendedInstancesDataAvailable { get; set; }
|
|
public bool ReceiveLocationsDataAvailable { get; set; }
|
|
public bool SendPortsDataAvailable { get; set; }
|
|
public bool OrchestrationsDataAvailable { get; set; }
|
|
public string ServerName { get; set; }
|
|
public string GroupName { get; set; }
|
|
public string OperatorGroup { get; set; }
|
|
public string ReadOnlyUserGroup { get; set; }
|
|
public string ManagementDbServer { get; set; }
|
|
public string ManagementDbName { get; set; }
|
|
public string MessageBoxDbServer { get; set; }
|
|
public string MessageBoxDbName { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ergebnis der integrierten Anmeldung an einer BizTalk-Datenbank.
|
|
/// </summary>
|
|
internal sealed class SqlAccessState
|
|
{
|
|
public string Role { get; set; }
|
|
public string Server { get; set; }
|
|
public string Database { get; set; }
|
|
public bool Attempted { get; set; }
|
|
public bool Available { get; set; }
|
|
public DiagnosticCategory? FailureCategory { get; set; }
|
|
public string Failure { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Laufzeitzustand einer BizTalk Host Instance.
|
|
/// </summary>
|
|
internal sealed class HostInstanceState
|
|
{
|
|
public string InstanceName { get; set; }
|
|
public string HostName { get; set; }
|
|
public string RunningServer { get; set; }
|
|
public int ServiceState { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Relevante Daten einer suspendierten BizTalk Service Instance.
|
|
/// </summary>
|
|
internal sealed class SuspendedInstance
|
|
{
|
|
public string ApplicationName { get; set; }
|
|
public string ServiceName { get; set; }
|
|
public string HostName { get; set; }
|
|
public string ServiceClass { get; set; }
|
|
public string InstanceId { get; set; }
|
|
public string ErrorDescription { get; set; }
|
|
public DateTime? SuspendTime { get; set; }
|
|
public int ServiceClassId { get; set; }
|
|
public SuspendedKind Kind { get; set; }
|
|
|
|
public bool IsRoutingFailureReport
|
|
{
|
|
get { return ServiceClassId == 64; }
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Konfigurations- und Laufzeitzustand einer Receive Location.
|
|
/// </summary>
|
|
internal sealed class ReceiveLocationState
|
|
{
|
|
public string Name { get; set; }
|
|
public string ApplicationName { get; set; }
|
|
public bool? IsDisabled { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Laufzeitzustand eines Send Ports.
|
|
/// </summary>
|
|
internal sealed class SendPortState
|
|
{
|
|
public string Name { get; set; }
|
|
public string ApplicationName { get; set; }
|
|
public int Status { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Aggregierte Zustandszaehler einer BizTalk-Anwendung.
|
|
/// </summary>
|
|
internal sealed class ApplicationRuntimeState
|
|
{
|
|
public string ApplicationName { get; set; }
|
|
public int ReceiveLocationTotal { get; set; }
|
|
public int ReceiveLocationDisabled { get; set; }
|
|
public int SendPortTotal { get; set; }
|
|
public int SendPortStarted { get; set; }
|
|
public int SendPortStopped { get; set; }
|
|
public int SendPortBound { get; set; }
|
|
public int SendPortUnknown { get; set; }
|
|
public int OrchestrationTotal { get; set; }
|
|
public int OrchestrationStarted { get; set; }
|
|
public int OrchestrationStopped { get; set; }
|
|
public int OrchestrationBound { get; set; }
|
|
public int OrchestrationUnbound { get; set; }
|
|
public int OrchestrationUnknown { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ergebnis der Auswertung des lokalen Windows Application Event Logs.
|
|
/// </summary>
|
|
internal sealed class EventLogState
|
|
{
|
|
public bool Available { get; set; }
|
|
public int Errors { get; set; }
|
|
public int Warnings { get; set; }
|
|
public DateTime Since { get; set; }
|
|
public string Failure { get; set; }
|
|
}
|
|
}
|