Add WMI and SQL permission diagnostics

This commit is contained in:
2026-07-22 15:26:51 +02:00
parent 31222ad28f
commit 78e8881d38
16 changed files with 1243 additions and 89 deletions
+109 -3
View File
@@ -3,6 +3,9 @@ using System.Collections.Generic;
namespace BizTalkCheckmkPulse
{
/// <summary>
/// Definiert die von Checkmk erwarteten numerischen Service-Zustaende.
/// </summary>
internal enum CheckState
{
Ok = 0,
@@ -11,35 +14,113 @@ namespace BizTalkCheckmkPulse
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,
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<string>();
Diagnostics = new List<ProbeDiagnostic>();
Platform = new PlatformState();
HostInstances = new List<HostInstanceState>();
SuspendedInstances = new List<SuspendedInstance>();
Applications = new List<ApplicationRuntimeState>();
SqlTargets = new List<SqlAccessState>();
EventLog = new EventLogState();
}
public List<string> Diagnostics { get; private set; }
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<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 RuntimeArtifactsDataAvailable { get; set; }
public string ServerName { get; set; }
public string GroupName { get; set; }
public string ManagementDbServer { get; set; }
@@ -48,6 +129,23 @@ namespace BizTalkCheckmkPulse
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; }
@@ -56,6 +154,9 @@ namespace BizTalkCheckmkPulse
public int ServiceState { get; set; }
}
/// <summary>
/// Relevante Daten einer suspendierten BizTalk Service Instance.
/// </summary>
internal sealed class SuspendedInstance
{
public string ApplicationName { get; set; }
@@ -68,6 +169,9 @@ namespace BizTalkCheckmkPulse
public SuspendedKind Kind { get; set; }
}
/// <summary>
/// Aggregierte Zustandszaehler einer BizTalk-Anwendung.
/// </summary>
internal sealed class ApplicationRuntimeState
{
public string ApplicationName { get; set; }
@@ -86,6 +190,9 @@ namespace BizTalkCheckmkPulse
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; }
@@ -95,4 +202,3 @@ namespace BizTalkCheckmkPulse
public string Failure { get; set; }
}
}