using System;
using System.Collections.Generic;
namespace BizTalkCheckmkPulse
{
///
/// Definiert die von Checkmk erwarteten numerischen Service-Zustaende.
///
internal enum CheckState
{
Ok = 0,
Warning = 1,
Critical = 2,
Unknown = 3
}
///
/// Unterscheidet fortsetzbare und nicht fortsetzbare suspendierte Instanzen.
///
internal enum SuspendedKind
{
Resumable,
NonResumable
}
///
/// Kennzeichnet den technischen Bereich, in dem eine Diagnose entstanden ist.
///
internal enum DiagnosticArea
{
Wmi,
Sql,
EventLog,
General
}
///
/// Klassifiziert Fehler, damit Bediener eine passende Massnahme erhalten.
///
internal enum DiagnosticCategory
{
Permission,
Connectivity,
Timeout,
Configuration,
Provider,
Unexpected
}
///
/// Strukturierte Diagnose mit Ursache und konkreter Handlungsempfehlung.
///
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; }
///
/// Erstellt eine kompakte, fuer Checkmk geeignete Diagnosezeile.
///
/// Menschenlesbarer Text mit Kategorie, Ursache und Massnahme.
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;
}
}
///
/// Sammelt alle Ergebnisse eines Programmlaufs.
///
internal sealed class ProbeResult
{
///
/// Initialisiert leere Ergebnislisten und Zustandsobjekte.
///
public ProbeResult()
{
Diagnostics = new List();
Platform = new PlatformState();
HostInstances = new List();
SuspendedInstances = new List();
Applications = new List();
SqlTargets = new List();
EventLog = new EventLogState();
}
public List Diagnostics { get; private set; }
public PlatformState Platform { get; private set; }
public List HostInstances { get; private set; }
public List SuspendedInstances { get; private set; }
public List Applications { get; private set; }
public List SqlTargets { get; private set; }
public string ExecutionIdentity { get; set; }
public string NetworkIdentityHint { get; set; }
public EventLogState EventLog { get; private set; }
}
///
/// Beschreibt Erreichbarkeit und Teilverfuegbarkeit der BizTalk-WMI-Daten.
///
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 RuntimeArtifactsDataAvailable { get; set; }
public string ServerName { get; set; }
public string GroupName { get; set; }
public string ManagementDbServer { get; set; }
public string ManagementDbName { get; set; }
public string MessageBoxDbServer { get; set; }
public string MessageBoxDbName { get; set; }
}
///
/// Ergebnis der integrierten Anmeldung an einer BizTalk-Datenbank.
///
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; }
}
///
/// Laufzeitzustand einer BizTalk Host Instance.
///
internal sealed class HostInstanceState
{
public string InstanceName { get; set; }
public string HostName { get; set; }
public string RunningServer { get; set; }
public int ServiceState { get; set; }
}
///
/// Relevante Daten einer suspendierten BizTalk Service Instance.
///
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 SuspendedKind Kind { get; set; }
}
///
/// Aggregierte Zustandszaehler einer BizTalk-Anwendung.
///
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; }
}
///
/// Ergebnis der Auswertung des lokalen Windows Application Event Logs.
///
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; }
}
}