Harden endpoint reachability resolution

This commit is contained in:
2026-08-06 15:58:18 +02:00
parent 82584473e8
commit ac51714a88
19 changed files with 556 additions and 152 deletions
+2
View File
@@ -18,6 +18,8 @@
<add key="ProbeEndpointConnectivity" value="true" />
<add key="EndpointCatalogPath" value="%ProgramData%\BizTalkCheckmkPulse\data\endpoints.xml" />
<add key="EndpointCatalogMaxBytes" value="1048576" />
<!-- Artefaktgrenze; das Netzwerkbudget wird separat ueber eindeutige Ziele begrenzt. -->
<add key="EndpointCatalogMaxEntries" value="1000" />
<!-- 168 Stunden = woechentlicher Abgleich mit der BizTalk-Umgebung. -->
<add key="EndpointDiscoveryIntervalHours" value="168" />
<add key="EndpointProbeTimeoutMilliseconds" value="3000" />
@@ -381,7 +381,7 @@ namespace BizTalkCheckmkPulse
var failed = endpointState.Results.Where(x => !x.Available).ToArray();
var available = endpointState.Results.Count(x => x.Available);
var incomplete = endpointState.Results.Count != endpointState.Active
|| endpointState.UnsupportedActive > 0
|| endpointState.UnresolvedActive > 0
|| endpointState.RefreshRequired && !endpointState.RefreshSucceeded
|| !string.IsNullOrWhiteSpace(endpointState.Failure);
var state = failed.Length > 0
@@ -391,14 +391,16 @@ namespace BizTalkCheckmkPulse
: CheckState.Ok;
var metrics = string.Format(
CultureInfo.InvariantCulture,
"biztalk_endpoints_configured={0};;;0|biztalk_endpoints_active={1};;;0|biztalk_endpoints_unique_targets={2};;;0|biztalk_endpoints_tested={3};;;0|biztalk_endpoints_available={4};;;0|biztalk_endpoints_failed={5};;1;0|biztalk_endpoints_unsupported={6};;1;0|biztalk_endpoints_inactive_skipped={7};;;0|biztalk_endpoint_probe_duration_ms={8};;;0",
"biztalk_endpoints_configured={0};;;0|biztalk_endpoints_active={1};;;0|biztalk_endpoints_unique_targets={2};;;0|biztalk_endpoints_tested={3};;;0|biztalk_endpoints_available={4};;;0|biztalk_endpoints_failed={5};;1;0|biztalk_endpoints_unresolved={6};;1;0|biztalk_endpoints_expected_non_socket={7};;;0|biztalk_endpoints_manual_overrides={8};;;0|biztalk_endpoints_inactive_skipped={9};;;0|biztalk_endpoint_probe_duration_ms={10};;;0",
endpointState.Configured,
endpointState.Active,
endpointState.UniqueTargets,
endpointState.Results.Count,
available,
failed.Length,
endpointState.UnsupportedActive,
endpointState.UnresolvedActive,
endpointState.ExpectedNonProbeableActive,
endpointState.ManualOverridesActive,
endpointState.SkippedInactive,
endpointState.ProbeDurationMilliseconds);
var detail = new StringBuilder();
@@ -406,6 +408,8 @@ namespace BizTalkCheckmkPulse
{
detail.Append("Alle ").Append(endpointState.Active).Append(" aktiven, pruefbaren Send-/Receive-Endpunkte sind erreichbar")
.Append(" (unique_targets=").Append(endpointState.UniqueTargets)
.Append(", expected_non_socket=").Append(endpointState.ExpectedNonProbeableActive)
.Append(", manual_overrides=").Append(endpointState.ManualOverridesActive)
.Append(", probe_ms=").Append(endpointState.ProbeDurationMilliseconds).Append(")");
}
else
@@ -414,7 +418,9 @@ namespace BizTalkCheckmkPulse
.Append(", tested=").Append(endpointState.Results.Count)
.Append(", available=").Append(available)
.Append(", failed=").Append(failed.Length)
.Append(", unsupported_external=").Append(endpointState.UnsupportedActive)
.Append(", unresolved=").Append(endpointState.UnresolvedActive)
.Append(", expected_non_socket=").Append(endpointState.ExpectedNonProbeableActive)
.Append(", manual_overrides=").Append(endpointState.ManualOverridesActive)
.Append(", unique_targets=").Append(endpointState.UniqueTargets)
.Append(", probe_ms=").Append(endpointState.ProbeDurationMilliseconds);
AppendLimitedList(detail, "unavailable", failed.Select(x =>
@@ -423,6 +429,8 @@ namespace BizTalkCheckmkPulse
{
detail.Append("; catalog_or_probe_error=").Append(endpointState.Failure);
}
AppendLimitedList(detail, "unresolved_endpoints", endpointState.ResolutionIssues);
}
if (endpointState.CatalogSynchronizedUtc.HasValue)
+151 -54
View File
@@ -21,33 +21,77 @@ namespace BizTalkCheckmkPulse
out EndpointCatalogEntry entry,
out string reason)
{
entry = null;
reason = string.Empty;
var resolution = Analyze(candidate);
entry = resolution.Entry;
reason = resolution.Reason ?? string.Empty;
return resolution.Status == EndpointResolutionStatus.Probeable;
}
/// <summary>
/// Trennt sicher pruefbare Ziele von erwartbar lokalen/adapterinternen Adressen und echten Aufloesungsluecken.
/// </summary>
public static EndpointResolution Analyze(EndpointCandidate candidate)
{
if (candidate == null)
{
reason = "Endpoint-Kandidat fehlt.";
return false;
return Unresolved("Endpoint-Kandidat fehlt.");
}
if (candidate.Dynamic)
{
reason = "Dynamischer Send Port besitzt kein statisch pruefbares Ziel.";
return false;
return Expected("Dynamischer Send Port besitzt kein statisch pruefbares Ziel.");
}
var address = (candidate.Address ?? string.Empty).Trim();
if (address.Length == 0)
{
reason = "Transportadresse ist leer.";
return false;
return Unresolved("Aktive statische Transportadresse ist leer.");
}
if (LooksLikeEmailRecipients(address) || Contains(candidate.AdapterName, "SMTP"))
{
return Expected("SMTP-Empfaenger beziehungsweise Adapteradresse enthaelt nicht den SMTP-Server.");
}
if (Regex.IsMatch(address, @"^[a-zA-Z]:[\\/]", RegexOptions.CultureInvariant)
|| Contains(candidate.AdapterName, "FILE") && !address.StartsWith("\\\\", StringComparison.Ordinal))
{
return Expected("Lokaler Dateipfad benoetigt keine Netzwerkprobe.");
}
if (address.StartsWith("net.pipe:", StringComparison.OrdinalIgnoreCase)
|| address.StartsWith("npipe:", StringComparison.OrdinalIgnoreCase))
{
return Expected("Named Pipes besitzen kein TCP-/UDP-Ziel.");
}
if (address.StartsWith("/", StringComparison.Ordinal)
&& IsInboundListener(candidate))
{
return Expected("Relative Receive-Listener-Adresse enthaelt keine eindeutige Site-Bindung.");
}
EndpointCatalogEntry entry;
string protocol;
string host;
int port;
if (!TryResolve(address, candidate.AdapterName, out protocol, out host, out port, out reason))
string reason;
if (!TryResolve(
address,
candidate.AdapterName,
IsInboundListener(candidate),
out protocol,
out host,
out port,
out reason))
{
return false;
if (address.StartsWith("file:", StringComparison.OrdinalIgnoreCase)
|| address.StartsWith("mailto:", StringComparison.OrdinalIgnoreCase))
{
return Expected(reason);
}
return Unresolved(reason);
}
entry = new EndpointCatalogEntry
@@ -64,7 +108,12 @@ namespace BizTalkCheckmkPulse
Enabled = true,
AutoDiscovered = true
};
return true;
return new EndpointResolution
{
Status = EndpointResolutionStatus.Probeable,
Entry = entry,
Reason = string.Empty
};
}
/// <summary>
@@ -72,52 +121,13 @@ namespace BizTalkCheckmkPulse
/// </summary>
public static bool IsPotentialExternalEndpoint(EndpointCandidate candidate)
{
if (candidate == null || candidate.Dynamic)
{
return false;
}
var address = (candidate.Address ?? string.Empty).Trim();
if (address.Length == 0
|| LooksLikeEmailRecipients(address)
|| Regex.IsMatch(address, @"^[a-zA-Z]:[\\/]", RegexOptions.CultureInvariant)
|| address.StartsWith("/", StringComparison.Ordinal)
|| address.StartsWith("net.pipe:", StringComparison.OrdinalIgnoreCase)
|| address.StartsWith("npipe:", StringComparison.OrdinalIgnoreCase))
{
return false;
}
if (Contains(candidate.AdapterName, "SMTP")
|| Contains(candidate.AdapterName, "FILE") && !address.StartsWith("\\\\", StringComparison.Ordinal))
{
return false;
}
if (address.StartsWith("\\\\", StringComparison.Ordinal)
|| HostPortPattern.IsMatch(address)
|| Regex.IsMatch(address, @"(?:FORMATNAME:)?DIRECT=(?:OS|TCP):", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
{
return true;
}
Uri uri;
if (Uri.TryCreate(address, UriKind.Absolute, out uri))
{
return !string.Equals(uri.Scheme, "file", StringComparison.OrdinalIgnoreCase)
&& !string.Equals(uri.Scheme, "mailto", StringComparison.OrdinalIgnoreCase);
}
return Contains(candidate.AdapterName, "SFTP")
|| Contains(candidate.AdapterName, "FTP")
|| Contains(candidate.AdapterName, "HTTP")
|| Contains(candidate.AdapterName, "SOAP")
|| Contains(candidate.AdapterName, "WCF");
return Analyze(candidate).Status == EndpointResolutionStatus.Unresolved;
}
private static bool TryResolve(
string address,
string adapterName,
bool allowWildcardListener,
out string protocol,
out string host,
out int port,
@@ -128,6 +138,12 @@ namespace BizTalkCheckmkPulse
port = 0;
reason = string.Empty;
if (allowWildcardListener
&& TryResolveWildcardListener(address, out protocol, out host, out port, out reason))
{
return true;
}
if (LooksLikeEmailRecipients(address))
{
reason = "SMTP-Empfaengerliste ist kein pruefbarer Netzwerk-Endpunkt.";
@@ -210,14 +226,14 @@ namespace BizTalkCheckmkPulse
if (Contains(adapterName, "SFTP"))
{
host = address.Trim('/');
host = ExtractBareAdapterHost(address);
port = 22;
return Validate(host, port, out reason);
}
if (Contains(adapterName, "FTP"))
{
host = address.Trim('/');
host = ExtractBareAdapterHost(address);
port = 21;
return Validate(host, port, out reason);
}
@@ -248,10 +264,91 @@ namespace BizTalkCheckmkPulse
case "imap": return 143;
case "imaps": return 993;
case "msmq": return 1801;
case "net.tcp": return 808;
case "mssql": return 1433;
// Ohne Pfad ist der Hostteil ein tnsnames.ora-Alias und kein sicher pruefbarer DNS-Host.
case "oracledb": return uri.AbsolutePath.Trim('/').Length > 0 ? 1521 : 0;
default: return uri.Port > 0 ? uri.Port : 0;
}
}
/// <summary>
/// Reduziert lokale HTTP-/WCF-Wildcard-Listener auf einen nebenwirkungsfreien Loopback-Porttest.
/// </summary>
private static bool TryResolveWildcardListener(
string address,
out string protocol,
out string host,
out int port,
out string reason)
{
protocol = "TCP";
host = string.Empty;
port = 0;
reason = string.Empty;
var match = Regex.Match(
address,
@"^(?<scheme>https?|net\.tcp)://(?:\+|\*)(?::(?<port>\d{1,5}))?(?:[/\\].*)?$",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
if (!match.Success)
{
return false;
}
var scheme = match.Groups["scheme"].Value.ToLowerInvariant();
if (!string.IsNullOrWhiteSpace(match.Groups["port"].Value)
&& !int.TryParse(match.Groups["port"].Value, out port))
{
port = 0;
}
if (port <= 0)
{
port = scheme == "https" ? 443 : scheme == "net.tcp" ? 808 : 80;
}
host = "127.0.0.1";
return Validate(host, port, out reason);
}
private static string ExtractBareAdapterHost(string address)
{
var value = (address ?? string.Empty).Trim().Trim('/');
var separator = value.IndexOfAny(new[] { '/', '\\' });
return separator < 0 ? value : value.Substring(0, separator);
}
/// <summary>
/// Erkennt Adapter, deren relative Receive-Adresse eine lokale Listenerbindung statt eines Remoteziels beschreibt.
/// </summary>
private static bool IsInboundListener(EndpointCandidate candidate)
{
return string.Equals(candidate.ArtifactType, "ReceiveLocation", StringComparison.OrdinalIgnoreCase)
&& (Contains(candidate.AdapterName, "HTTP")
|| Contains(candidate.AdapterName, "SOAP")
|| Contains(candidate.AdapterName, "WCF"));
}
private static EndpointResolution Expected(string reason)
{
return new EndpointResolution
{
Status = EndpointResolutionStatus.ExpectedNonProbeable,
Reason = reason
};
}
private static EndpointResolution Unresolved(string reason)
{
return new EndpointResolution
{
Status = EndpointResolutionStatus.Unresolved,
Reason = string.IsNullOrWhiteSpace(reason)
? "Transportadresse konnte nicht sicher auf Host und Port reduziert werden."
: reason
};
}
private static bool HasExplicitPort(string address)
{
var authorityEnd = address.IndexOfAny(new[] { '/', '?' }, address.IndexOf("://", StringComparison.Ordinal) + 3);
@@ -90,14 +90,14 @@ namespace BizTalkCheckmkPulse
EnvironmentName = catalogEnvironment,
SynchronizedUtc = synchronizedUtc,
ActiveCandidates = ReadInt(root, "activeCandidates", 0, 100000),
UnsupportedCandidates = ReadInt(root, "unsupportedCandidates", 0, 100000)
UnresolvedCandidates = ReadInt(root, "unsupportedCandidates", 0, 100000)
};
foreach (var node in root.Elements("Endpoint"))
{
if (catalog.Entries.Count >= _maxEntries)
{
throw new InvalidDataException("Endpoint catalog exceeds EndpointMaxCount.");
throw new InvalidDataException("Endpoint catalog exceeds the configured entry limit.");
}
var entry = new EndpointCatalogEntry
@@ -135,7 +135,7 @@ namespace BizTalkCheckmkPulse
if (catalog.Entries.Count > _maxEntries)
{
throw new InvalidDataException("Endpoint catalog exceeds EndpointMaxCount.");
throw new InvalidDataException("Endpoint catalog exceeds the configured entry limit.");
}
foreach (var entry in catalog.Entries)
@@ -150,7 +150,8 @@ namespace BizTalkCheckmkPulse
new XAttribute("environment", catalog.EnvironmentName ?? string.Empty),
new XAttribute("synchronizedUtc", catalog.SynchronizedUtc.ToUniversalTime().ToString("o", CultureInfo.InvariantCulture)),
new XAttribute("activeCandidates", catalog.ActiveCandidates),
new XAttribute("unsupportedCandidates", catalog.UnsupportedCandidates));
// Der XML-Attributsname bleibt fuer vorhandene Katalogdateien der Version 1 stabil.
new XAttribute("unsupportedCandidates", catalog.UnresolvedCandidates));
foreach (var entry in catalog.Entries
.OrderBy(x => x.ApplicationName, StringComparer.OrdinalIgnoreCase)
.ThenBy(x => x.ArtifactType, StringComparer.OrdinalIgnoreCase)
@@ -44,7 +44,7 @@ namespace BizTalkCheckmkPulse
var store = new EndpointCatalogStore(
_options.EndpointCatalogPath,
_options.EndpointCatalogMaxBytes,
_options.EndpointMaxCount);
_options.EndpointCatalogMaxEntries);
EndpointCatalog catalog = null;
string readFailure = null;
try
@@ -76,7 +76,7 @@ namespace BizTalkCheckmkPulse
"Endpoint catalog synchronized. path=" + _options.EndpointCatalogPath
+ " active_candidates=" + catalog.ActiveCandidates
+ " configured=" + catalog.Entries.Count
+ " unsupported_external=" + catalog.UnsupportedCandidates);
+ " unresolved_candidates=" + catalog.UnresolvedCandidates);
}
catch (Exception ex)
{
@@ -104,19 +104,28 @@ namespace BizTalkCheckmkPulse
state.CatalogAvailable = true;
state.CatalogSynchronizedUtc = catalog.SynchronizedUtc;
state.Configured = catalog.Entries.Count;
state.UnsupportedActive = CountUnsupportedExternal(result.EndpointCandidates);
var activeEntries = ResolveActiveEndpoints(catalog, result.EndpointCandidates, state);
var activeTargetCount = activeEntries
.Select(TargetKey)
.Distinct(StringComparer.OrdinalIgnoreCase)
.Count();
if (activeTargetCount > _options.EndpointMaxCount)
{
state.Failure = "Eindeutige aktive Netzwerkziele=" + activeTargetCount
+ " ueberschreiten EndpointMaxCount=" + _options.EndpointMaxCount + ".";
return;
}
var activeKeys = new HashSet<string>(
result.EndpointCandidates.Where(x => x.Active).Select(x => x.Key),
StringComparer.OrdinalIgnoreCase);
var activeEntries = catalog.Entries
.Where(x => x.Enabled)
.Where(x => string.Equals(x.ArtifactType, "Manual", StringComparison.OrdinalIgnoreCase)
|| activeKeys.Contains(x.Key))
.Take(_options.EndpointMaxCount)
.ToArray();
state.Active = activeEntries.Length;
state.SkippedInactive = catalog.Entries.Count(x => x.Enabled) - activeEntries.Length;
// Detailwarnungen nur beim Katalogabgleich schreiben; der Minutensnapshot
// enthaelt die aktuelle begrenzte Liste bereits und das Tageslog bleibt kompakt.
foreach (var issue in state.RefreshRequired
? state.ResolutionIssues.Take(20)
: Enumerable.Empty<string>())
{
_logger.Warning("Endpoint target unresolved. " + issue);
}
try
{
@@ -155,26 +164,26 @@ namespace BizTalkCheckmkPulse
var active = (candidates ?? Enumerable.Empty<EndpointCandidate>())
.Where(x => x != null && x.Active)
.ToArray();
var discovered = new List<EndpointCatalogEntry>();
var unsupported = 0;
foreach (var candidate in active)
{
EndpointCatalogEntry entry;
string reason;
if (EndpointAddressParser.TryCreate(candidate, out entry, out reason))
{
discovered.Add(entry);
}
else if (EndpointAddressParser.IsPotentialExternalEndpoint(candidate))
{
unsupported++;
}
}
var manual = existing == null
? new EndpointCatalogEntry[0]
: existing.Entries.Where(x => !x.AutoDiscovered).ToArray();
var manualKeys = new HashSet<string>(manual.Select(x => x.Key), StringComparer.OrdinalIgnoreCase);
var discovered = new List<EndpointCatalogEntry>();
var unresolved = 0;
foreach (var candidate in active)
{
var resolution = EndpointAddressParser.Analyze(candidate);
if (resolution.Status == EndpointResolutionStatus.Probeable)
{
discovered.Add(resolution.Entry);
}
else if (resolution.Status == EndpointResolutionStatus.Unresolved
&& !manualKeys.Contains(candidate.Key))
{
unresolved++;
}
}
var merged = manual
.Concat(discovered.Where(x => !manualKeys.Contains(x.Key)))
.GroupBy(x => x.Key, StringComparer.OrdinalIgnoreCase)
@@ -187,7 +196,8 @@ namespace BizTalkCheckmkPulse
EnvironmentName = existing == null ? string.Empty : existing.EnvironmentName,
SynchronizedUtc = synchronizedUtc.ToUniversalTime(),
ActiveCandidates = active.Length,
UnsupportedCandidates = unsupported
// Attributsname bleibt fuer die Rueckwaertskompatibilitaet des Katalogformats bestehen.
UnresolvedCandidates = unresolved
};
catalog.Entries.AddRange(merged);
return catalog;
@@ -200,29 +210,107 @@ namespace BizTalkCheckmkPulse
{
var catalog = SynchronizeCatalog(existing, candidates, synchronizedUtc);
catalog.EnvironmentName = _options.EnvironmentName ?? string.Empty;
if (catalog.Entries.Count > _options.EndpointMaxCount)
if (catalog.Entries.Count > _options.EndpointCatalogMaxEntries)
{
throw new InvalidDataException("Probeable endpoints exceed EndpointMaxCount.");
throw new InvalidDataException("Endpoint catalog exceeds EndpointCatalogMaxEntries.");
}
return catalog;
}
private static int CountUnsupportedExternal(IEnumerable<EndpointCandidate> candidates)
/// <summary>
/// Ermittelt aus aktuellen WMI-Kandidaten und manuellen Overrides die in diesem Lauf zu pruefenden Ziele.
/// Automatisch erkannte Katalogeintraege werden bewusst nicht als veraltete Laufzeitquelle verwendet.
/// </summary>
internal static EndpointCatalogEntry[] ResolveActiveEndpoints(
EndpointCatalog catalog,
IEnumerable<EndpointCandidate> candidates,
EndpointConnectivityState state)
{
var count = 0;
foreach (var candidate in candidates.Where(x => x.Active))
if (catalog == null)
{
EndpointCatalogEntry ignored;
string reason;
if (!EndpointAddressParser.TryCreate(candidate, out ignored, out reason)
&& EndpointAddressParser.IsPotentialExternalEndpoint(candidate))
throw new ArgumentNullException("catalog");
}
if (state == null)
{
throw new ArgumentNullException("state");
}
var activeCandidates = (candidates ?? Enumerable.Empty<EndpointCandidate>())
.Where(x => x != null && x.Active)
.GroupBy(x => x.Key, StringComparer.OrdinalIgnoreCase)
.Select(x => x.First())
.ToArray();
var activeKeys = new HashSet<string>(activeCandidates.Select(x => x.Key), StringComparer.OrdinalIgnoreCase);
var manualOverrides = catalog.Entries
.Where(x => x.Enabled && !x.AutoDiscovered)
.Where(x => !string.Equals(x.ArtifactType, "Manual", StringComparison.OrdinalIgnoreCase))
.GroupBy(x => x.Key, StringComparer.OrdinalIgnoreCase)
.ToDictionary(x => x.Key, x => x.First(), StringComparer.OrdinalIgnoreCase);
var selected = catalog.Entries
.Where(x => x.Enabled && string.Equals(x.ArtifactType, "Manual", StringComparison.OrdinalIgnoreCase))
.ToList();
foreach (var candidate in activeCandidates)
{
EndpointCatalogEntry manual;
if (manualOverrides.TryGetValue(candidate.Key, out manual))
{
count++;
selected.Add(manual);
state.ManualOverridesActive++;
continue;
}
var resolution = EndpointAddressParser.Analyze(candidate);
if (resolution.Status == EndpointResolutionStatus.Probeable)
{
// Immer das aktuelle WMI-Ziel pruefen; der Wochenkatalog darf keine alte Adresse erzwingen.
selected.Add(resolution.Entry);
}
else if (resolution.Status == EndpointResolutionStatus.ExpectedNonProbeable)
{
state.ExpectedNonProbeableActive++;
}
else
{
state.UnresolvedActive++;
state.ResolutionIssues.Add(DisplayResolutionIssue(candidate, resolution.Reason));
}
}
return count;
state.SkippedInactive = catalog.Entries.Count(x =>
x.Enabled
&& !string.Equals(x.ArtifactType, "Manual", StringComparison.OrdinalIgnoreCase)
&& !activeKeys.Contains(x.Key));
return selected
.GroupBy(x => x.Key, StringComparer.OrdinalIgnoreCase)
.Select(x => x.First())
.ToArray();
}
/// <summary>
/// Formatiert eine Aufloesungsluecke ohne Transportadresse, Pfad, Querystring oder Zugangsdaten.
/// </summary>
private static string DisplayResolutionIssue(EndpointCandidate candidate, string reason)
{
var artifact = string.IsNullOrWhiteSpace(candidate.ApplicationName)
|| string.Equals(candidate.ApplicationName, "(unknown)", StringComparison.OrdinalIgnoreCase)
? candidate.ArtifactName
: candidate.ApplicationName + "\\" + candidate.ArtifactName;
return "endpoint=" + CompactText(candidate.ArtifactType) + ":" + CompactText(artifact)
+ "[" + CompactText(candidate.TransportRole) + "]"
+ " adapter=" + CompactText(candidate.AdapterName)
+ " reason=" + CompactText(reason);
}
private static string CompactText(string value)
{
return (value ?? string.Empty)
.Replace('\r', ' ')
.Replace('\n', ' ')
.Replace('|', '/')
.Trim();
}
private async Task<IReadOnlyCollection<EndpointProbeResult>> ProbeAllAsync(EndpointCatalogEntry[] endpoints)
+26 -2
View File
@@ -269,6 +269,26 @@ namespace BizTalkCheckmkPulse
}
}
/// <summary>
/// Ergebnis der geheimnisfreien Auswertung einer BizTalk-Transportadresse.
/// </summary>
internal enum EndpointResolutionStatus
{
Probeable,
ExpectedNonProbeable,
Unresolved
}
/// <summary>
/// Klassifiziert einen Kandidaten und enthaelt nur bei sicherer Aufloesung ein Socket-Ziel.
/// </summary>
internal sealed class EndpointResolution
{
public EndpointResolutionStatus Status { get; set; }
public EndpointCatalogEntry Entry { get; set; }
public string Reason { get; set; }
}
/// <summary>
/// Ein geheimnisfreier, lokal persistierbarer Netzwerk-Endpunkt.
/// </summary>
@@ -314,7 +334,7 @@ namespace BizTalkCheckmkPulse
public string MachineName { get; set; }
public string EnvironmentName { get; set; }
public int ActiveCandidates { get; set; }
public int UnsupportedCandidates { get; set; }
public int UnresolvedCandidates { get; set; }
public List<EndpointCatalogEntry> Entries { get; private set; }
}
@@ -337,6 +357,7 @@ namespace BizTalkCheckmkPulse
public EndpointConnectivityState()
{
Results = new List<EndpointProbeResult>();
ResolutionIssues = new List<string>();
}
public bool Disabled { get; set; }
@@ -348,10 +369,13 @@ namespace BizTalkCheckmkPulse
public int Configured { get; set; }
public int Active { get; set; }
public int SkippedInactive { get; set; }
public int UnsupportedActive { get; set; }
public int UnresolvedActive { get; set; }
public int ExpectedNonProbeableActive { get; set; }
public int ManualOverridesActive { get; set; }
public int UniqueTargets { get; set; }
public long ProbeDurationMilliseconds { get; set; }
public string Failure { get; set; }
public List<EndpointProbeResult> Results { get; private set; }
public List<string> ResolutionIssues { get; private set; }
}
}
@@ -41,6 +41,7 @@ namespace BizTalkCheckmkPulse
public bool ProbeEndpointConnectivity { get; set; }
public string EndpointCatalogPath { get; set; }
public int EndpointCatalogMaxBytes { get; set; }
public int EndpointCatalogMaxEntries { get; set; }
public int EndpointDiscoveryIntervalHours { get; set; }
public int EndpointProbeTimeoutMilliseconds { get; set; }
public int EndpointProbeMaxConcurrency { get; set; }
@@ -83,6 +84,7 @@ namespace BizTalkCheckmkPulse
ProbeEndpointConnectivity = true;
EndpointCatalogPath = Path.Combine(commonData, "BizTalkCheckmkPulse", "data", "endpoints.xml");
EndpointCatalogMaxBytes = 1048576;
EndpointCatalogMaxEntries = 1000;
EndpointDiscoveryIntervalHours = 168;
EndpointProbeTimeoutMilliseconds = 3000;
EndpointProbeMaxConcurrency = 16;
@@ -141,6 +143,7 @@ namespace BizTalkCheckmkPulse
options.ProbeEndpointConnectivity = ReadBool(settings, "ProbeEndpointConnectivity", options.ProbeEndpointConnectivity);
options.EndpointCatalogPath = Environment.ExpandEnvironmentVariables(ReadString(settings, "EndpointCatalogPath", options.EndpointCatalogPath));
options.EndpointCatalogMaxBytes = ReadInt(settings, "EndpointCatalogMaxBytes", options.EndpointCatalogMaxBytes, 4096, 16777216);
options.EndpointCatalogMaxEntries = ReadInt(settings, "EndpointCatalogMaxEntries", options.EndpointCatalogMaxEntries, 1, 100000);
options.EndpointDiscoveryIntervalHours = ReadInt(settings, "EndpointDiscoveryIntervalHours", options.EndpointDiscoveryIntervalHours, 1, 8760);
options.EndpointProbeTimeoutMilliseconds = ReadInt(settings, "EndpointProbeTimeoutMilliseconds", options.EndpointProbeTimeoutMilliseconds, 250, 30000);
options.EndpointProbeMaxConcurrency = ReadInt(settings, "EndpointProbeMaxConcurrency", options.EndpointProbeMaxConcurrency, 1, 64);
+6
View File
@@ -102,6 +102,12 @@ namespace BizTalkCheckmkPulse
+ result.EndpointConnectivity.Active
+ " endpoints_failed="
+ result.EndpointConnectivity.Results.Count(x => !x.Available)
+ " endpoints_unresolved="
+ result.EndpointConnectivity.UnresolvedActive
+ " endpoints_expected_non_socket="
+ result.EndpointConnectivity.ExpectedNonProbeableActive
+ " endpoints_manual_overrides="
+ result.EndpointConnectivity.ManualOverridesActive
+ " endpoints_unique_targets="
+ result.EndpointConnectivity.UniqueTargets
+ " endpoint_probe_ms="