From 67f69d4b1e4121385a29b317a6e4b2a6e56af643 Mon Sep 17 00:00:00 2001 From: Harald Wolff Date: Thu, 18 Apr 2019 16:34:17 +0200 Subject: [PATCH] WIP --- Program.cs | 7 +- checks/Hostalive.cs | 3 + checks/PerformanceValue.cs | 5 ++ templates/static/checks/issues.html | 116 ++++++++++++++++++---------- templates/static/frame.html | 1 - templates/static/skyapi.js | 7 +- 6 files changed, 93 insertions(+), 46 deletions(-) diff --git a/Program.cs b/Program.cs index eeb43fa..df08ca2 100644 --- a/Program.cs +++ b/Program.cs @@ -47,10 +47,11 @@ namespace ln.skyscanner { SNMPEngine.DefaultEngine.Timeout = 3500; - if (SkyScanner.Instance.Entities.BlockedNetworks.Count == 0) - { + + if (!SkyScanner.Instance.Entities.BlockedNetworks.Contains(Network4.Parse("192.168.0.0/16"))) SkyScanner.Instance.Entities.BlockedNetworks.Insert(Network4.Parse("192.168.0.0/16")); - } + if (!SkyScanner.Instance.Entities.BlockedNetworks.Contains(Network4.Parse("10.200.0.0/16"))) + SkyScanner.Instance.Entities.BlockedNetworks.Insert(Network4.Parse("10.200.0.0/16")); //using (ODB odb = new ODB("odb")) diff --git a/checks/Hostalive.cs b/checks/Hostalive.cs index 64559a6..8823af8 100644 --- a/checks/Hostalive.cs +++ b/checks/Hostalive.cs @@ -54,6 +54,9 @@ namespace ln.skyscanner.checks checkState.WritePerformanceValue("rta", roundTripTime, 0, 80, 0, 140); } + foreach (PerformanceValue pv in checkState.PerformanceValues) + pv.IgnoreLimits = ((node.DeviceType == DeviceType.UNKNOWN) && (node.DeviceType == DeviceType.PTMP)); + checkState.BaseCheckState = CheckState.OK; } } diff --git a/checks/PerformanceValue.cs b/checks/PerformanceValue.cs index 136c8b9..38499ea 100644 --- a/checks/PerformanceValue.cs +++ b/checks/PerformanceValue.cs @@ -24,6 +24,8 @@ namespace ln.skyscanner.checks public double CritLower { get; set; } = Double.MinValue; public double CritUpper { get; set; } = Double.MaxValue; + public bool IgnoreLimits; + private PerformanceValue() { } @@ -55,6 +57,9 @@ namespace ln.skyscanner.checks { get { + if (IgnoreLimits) + return CheckState.OK; + if ((LastValue < CritLower) || (LastValue > CritUpper)) return CheckState.CRITICAL; if ((LastValue < WarnLower) || (LastValue > WarnUpper)) diff --git a/templates/static/checks/issues.html b/templates/static/checks/issues.html index 0a29ef1..d96194a 100644 --- a/templates/static/checks/issues.html +++ b/templates/static/checks/issues.html @@ -7,23 +7,23 @@
- - -
-
+ + +
+
-
+
@@ -47,19 +47,26 @@
+
diff --git a/templates/static/skyapi.js b/templates/static/skyapi.js index e2a1986..133b44d 100644 --- a/templates/static/skyapi.js +++ b/templates/static/skyapi.js @@ -6,6 +6,11 @@ return values; } +function encodeID( t ) +{ + return ("" + t).replace( /[\.\/]/g, "_"); +} + function SKYAPI(baseurl){ this.baseurl = baseurl; @@ -175,7 +180,7 @@ function updateStatistics() } -var __skyapi = new SKYAPI(""); +var __skyapi = new SKYAPI("/"); function skyapi() {