WIP
parent
29d59bc13a
commit
30b9980a51
|
@ -41,6 +41,7 @@ namespace ln.skyscanner
|
||||||
nodeCollection = odDatabase.GetCollection<Node>();
|
nodeCollection = odDatabase.GetCollection<Node>();
|
||||||
subnetCollection = odDatabase.GetCollection<Subnet>();
|
subnetCollection = odDatabase.GetCollection<Subnet>();
|
||||||
|
|
||||||
|
nodeCollection.EnableStrongCache(true);
|
||||||
nodeCollection.EnsureIndex("PrimaryIP");
|
nodeCollection.EnsureIndex("PrimaryIP");
|
||||||
nodeCollection.EnsureIndex("Interfaces[].ConfiguredIPs[].IP");
|
nodeCollection.EnsureIndex("Interfaces[].ConfiguredIPs[].IP");
|
||||||
nodeCollection.EnsureIndex("Interfaces[].ConfiguredIPs[].Network");
|
nodeCollection.EnsureIndex("Interfaces[].ConfiguredIPs[].Network");
|
||||||
|
|
|
@ -33,6 +33,8 @@ namespace ln.skyscanner.checks
|
||||||
SkyCheckState[] skyCheckStates = SkyScanner.Instance.Checker.checkStates.Query(stateQuery).ToArray();
|
SkyCheckState[] skyCheckStates = SkyScanner.Instance.Checker.checkStates.Query(stateQuery).ToArray();
|
||||||
foreach (SkyCheckState checkState in skyCheckStates)
|
foreach (SkyCheckState checkState in skyCheckStates)
|
||||||
{
|
{
|
||||||
|
//if (checkState.Node == null)
|
||||||
|
//checkState.Node = node;
|
||||||
checkStates.Add(checkState.CheckName, checkState);
|
checkStates.Add(checkState.CheckName, checkState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,11 +54,11 @@ namespace ln.skyscanner.checks
|
||||||
|
|
||||||
float fSuccess = (float)success / (float)n;
|
float fSuccess = (float)success / (float)n;
|
||||||
|
|
||||||
skyChecker.WritePerfValue(this,"replies",node,fSuccess);
|
skyChecker.WritePerfValue(this,checkState,"replies",node,fSuccess);
|
||||||
if (success > 0)
|
if (success > 0)
|
||||||
{
|
{
|
||||||
roundTripTime /= success;
|
roundTripTime /= success;
|
||||||
skyChecker.WritePerfValue(this, "rta", node, roundTripTime);
|
skyChecker.WritePerfValue(this, checkState, "rta", node, roundTripTime);
|
||||||
}
|
}
|
||||||
SetState(checkState, fSuccess);
|
SetState(checkState, fSuccess);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,24 @@ using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using ln.types.odb.attributes;
|
using ln.types.odb.attributes;
|
||||||
|
using System.Collections.Generic;
|
||||||
namespace ln.skyscanner.checks
|
namespace ln.skyscanner.checks
|
||||||
{
|
{
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public enum CheckState { OK, WARN, CRITICAL, FAIL, ERROR }
|
public enum CheckState { OK, WARN, CRITICAL, FAIL, ERROR }
|
||||||
|
|
||||||
|
public struct CheckStateChange
|
||||||
|
{
|
||||||
|
public CheckState NewState;
|
||||||
|
public DateTime Timestamp;
|
||||||
|
|
||||||
|
public CheckStateChange(CheckState checkState)
|
||||||
|
{
|
||||||
|
NewState = checkState;
|
||||||
|
Timestamp = DateTime.Now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class SkyCheckState
|
public class SkyCheckState
|
||||||
{
|
{
|
||||||
[DocumentID]
|
[DocumentID]
|
||||||
|
@ -27,8 +40,8 @@ namespace ln.skyscanner.checks
|
||||||
public readonly String CheckName;
|
public readonly String CheckName;
|
||||||
public readonly String UniqueNodeIdentifier;
|
public readonly String UniqueNodeIdentifier;
|
||||||
|
|
||||||
[ByReference]
|
public String[] PerformanceValues => performanceValues.ToArray();
|
||||||
public Node Node;
|
List<String> performanceValues = new List<String>();
|
||||||
|
|
||||||
public DateTime LastCheckTime { get; set; }
|
public DateTime LastCheckTime { get; set; }
|
||||||
|
|
||||||
|
@ -37,7 +50,11 @@ namespace ln.skyscanner.checks
|
||||||
public double CritLower { get; set; } = Double.MinValue;
|
public double CritLower { get; set; } = Double.MinValue;
|
||||||
public double CritUpper { get; set; } = Double.MaxValue;
|
public double CritUpper { get; set; } = Double.MaxValue;
|
||||||
|
|
||||||
public CheckState CheckState { get; set; }
|
public CheckState CheckState { get => currentCheckState; set { if (currentCheckState != value) history.Add(new CheckStateChange(value)); currentCheckState = value; } }
|
||||||
|
CheckState currentCheckState;
|
||||||
|
|
||||||
|
public CheckStateChange[] History => history.ToArray();
|
||||||
|
List<CheckStateChange> history = new List<CheckStateChange>();
|
||||||
|
|
||||||
protected SkyCheckState()
|
protected SkyCheckState()
|
||||||
{
|
{
|
||||||
|
@ -47,5 +64,21 @@ namespace ln.skyscanner.checks
|
||||||
CheckName = skyCheck.Name;
|
CheckName = skyCheck.Name;
|
||||||
UniqueNodeIdentifier = node.UniqueIdentity;
|
UniqueNodeIdentifier = node.UniqueIdentity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void EnsurePerformanceValue(String perfName)
|
||||||
|
{
|
||||||
|
if (performanceValues == null)
|
||||||
|
performanceValues = new List<string>();
|
||||||
|
|
||||||
|
if (!performanceValues.Contains(perfName))
|
||||||
|
performanceValues.Add(perfName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class PerformanceValue
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,17 @@ namespace ln.skyscanner.checks
|
||||||
public string[] PerfNames => perfFiles.Keys.ToArray();
|
public string[] PerfNames => perfFiles.Keys.ToArray();
|
||||||
public bool ContainsPerfFile(String perfName) => perfFiles.ContainsKey(perfName);
|
public bool ContainsPerfFile(String perfName) => perfFiles.ContainsKey(perfName);
|
||||||
|
|
||||||
|
[Callable]
|
||||||
|
public SkyCheckState[] Issues => checkStates.Query(
|
||||||
|
//Query.Contains<SkyCheckState,CheckState>("CheckState",new CheckState[] { CheckState.CRITICAL, CheckState.WARN, CheckState.ERROR })
|
||||||
|
Query.OR(
|
||||||
|
Query.Equals<SkyCheckState>("currentCheckState", CheckState.CRITICAL),
|
||||||
|
Query.Equals<SkyCheckState>("currentCheckState", CheckState.FAIL),
|
||||||
|
Query.Equals<SkyCheckState>("currentCheckState", CheckState.WARN)
|
||||||
|
)
|
||||||
|
).ToArray();
|
||||||
|
|
||||||
|
|
||||||
public SNMPEngine SNMPEngine { get; }
|
public SNMPEngine SNMPEngine { get; }
|
||||||
|
|
||||||
BTree<string, PerfFile> perfFiles = new BTree<string, PerfFile>();
|
BTree<string, PerfFile> perfFiles = new BTree<string, PerfFile>();
|
||||||
|
@ -62,6 +73,7 @@ namespace ln.skyscanner.checks
|
||||||
|
|
||||||
odb = new ODB(Path.Combine(BasePath));
|
odb = new ODB(Path.Combine(BasePath));
|
||||||
checkStates = odb.GetCollection<SkyCheckState>();
|
checkStates = odb.GetCollection<SkyCheckState>();
|
||||||
|
checkStates.EnableStrongCache(true);
|
||||||
checkStates.EnsureIndex("CheckName");
|
checkStates.EnsureIndex("CheckName");
|
||||||
checkStates.EnsureIndex("UniqueNodeIdentifier");
|
checkStates.EnsureIndex("UniqueNodeIdentifier");
|
||||||
}
|
}
|
||||||
|
@ -100,9 +112,9 @@ namespace ln.skyscanner.checks
|
||||||
perfFiles.Clear();
|
perfFiles.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WritePerfValue(SkyCheck skyCheck,String vName,Node node,double value)
|
public void WritePerfValue(SkyCheck skyCheck,SkyCheckState checkState,String vName,Node node,double value)
|
||||||
{
|
{
|
||||||
PerfFile perfFile = GetPerfFile(skyCheck, vName, node);
|
PerfFile perfFile = GetPerfFile(skyCheck, checkState, vName, node);
|
||||||
lock (perfFile)
|
lock (perfFile)
|
||||||
{
|
{
|
||||||
perfFile.EnsureOpen();
|
perfFile.EnsureOpen();
|
||||||
|
@ -116,7 +128,7 @@ namespace ln.skyscanner.checks
|
||||||
return perfFiles[perfName];
|
return perfFiles[perfName];
|
||||||
}
|
}
|
||||||
|
|
||||||
private PerfFile GetPerfFile(SkyCheck skyCheck, String vName, Node node)
|
private PerfFile GetPerfFile(SkyCheck skyCheck,SkyCheckState checkState,String vName, Node node)
|
||||||
{
|
{
|
||||||
String checkPath = String.Format("{0}_{1}", node.UniqueIdentity, skyCheck.Name);
|
String checkPath = String.Format("{0}_{1}", node.UniqueIdentity, skyCheck.Name);
|
||||||
String perfName = String.Format("{0}_{1}",checkPath,vName);
|
String perfName = String.Format("{0}_{1}",checkPath,vName);
|
||||||
|
@ -125,6 +137,7 @@ namespace ln.skyscanner.checks
|
||||||
{
|
{
|
||||||
SkyScanner.Instance.Entities.nodeCollection.Upsert(node);
|
SkyScanner.Instance.Entities.nodeCollection.Upsert(node);
|
||||||
}
|
}
|
||||||
|
checkState.EnsurePerformanceValue(perfName);
|
||||||
|
|
||||||
lock (this)
|
lock (this)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,10 +39,10 @@ namespace ln.skyscanner.checks
|
||||||
|
|
||||||
foreach (Sequence[] row in ptp)
|
foreach (Sequence[] row in ptp)
|
||||||
{
|
{
|
||||||
skyChecker.WritePerfValue(this, "ptp_rx_capa", node, (double)((Integer)(row[0].Items[1])).LongValue);
|
skyChecker.WritePerfValue(this, checkState, "ptp_rx_capa", node, (double)((Integer)(row[0].Items[1])).LongValue);
|
||||||
skyChecker.WritePerfValue(this, "ptp_tx_capa", node, (double)((Integer)(row[1].Items[1])).LongValue);
|
skyChecker.WritePerfValue(this, checkState, "ptp_tx_capa", node, (double)((Integer)(row[1].Items[1])).LongValue);
|
||||||
skyChecker.WritePerfValue(this, "ptp_rx_pwr", node, (double)((Integer)(row[2].Items[1])).LongValue);
|
skyChecker.WritePerfValue(this, checkState, "ptp_rx_pwr", node, (double)((Integer)(row[2].Items[1])).LongValue);
|
||||||
skyChecker.WritePerfValue(this, "ptp_tx_pwr", node, (double)((Integer)(row[3].Items[1])).LongValue);
|
skyChecker.WritePerfValue(this, checkState, "ptp_tx_pwr", node, (double)((Integer)(row[3].Items[1])).LongValue);
|
||||||
|
|
||||||
long rxBytes = ((Integer)(row[4].Items[1])).LongValue;
|
long rxBytes = ((Integer)(row[4].Items[1])).LongValue;
|
||||||
long txBytes = ((Integer)(row[5].Items[1])).LongValue;
|
long txBytes = ((Integer)(row[5].Items[1])).LongValue;
|
||||||
|
@ -50,8 +50,8 @@ namespace ln.skyscanner.checks
|
||||||
ubiquityCheckState.RXRate.Update(rxBytes * 8);
|
ubiquityCheckState.RXRate.Update(rxBytes * 8);
|
||||||
ubiquityCheckState.TXRate.Update(txBytes * 8);
|
ubiquityCheckState.TXRate.Update(txBytes * 8);
|
||||||
|
|
||||||
skyChecker.WritePerfValue(this, "ptp_rx_rate", node, ubiquityCheckState.RXRate.Current);
|
skyChecker.WritePerfValue(this, checkState, "ptp_rx_rate", node, ubiquityCheckState.RXRate.Current);
|
||||||
skyChecker.WritePerfValue(this, "ptp_tx_rate", node, ubiquityCheckState.TXRate.Current);
|
skyChecker.WritePerfValue(this, checkState, "ptp_tx_rate", node, ubiquityCheckState.TXRate.Current);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,6 +196,9 @@
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="templates\static\css\images\ui-icons_6495ED_256x240.png" />
|
<None Include="templates\static\css\images\ui-icons_6495ED_256x240.png" />
|
||||||
|
<None Include="templates\static\checks\issues.html">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="identify\" />
|
<Folder Include="identify\" />
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
<%frame "frame.html"%>
|
||||||
|
|
||||||
|
<h1>Aktuelle Störfälle</h1>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<div class="flex column">
|
||||||
|
<div id="issueList">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="nodetemplate" style="visibility: hidden;">
|
||||||
|
<div class="ui-message" style="margin-bottom: 16px;">
|
||||||
|
<h2 id="UniqueIdentity"></h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
var issues = []
|
||||||
|
var nodes = {}
|
||||||
|
var nodeIssues = {}
|
||||||
|
|
||||||
|
function updateIssueList(issueList)
|
||||||
|
{
|
||||||
|
$.each( issueList, function(){
|
||||||
|
if (this.Node)
|
||||||
|
{
|
||||||
|
if (!nodes[this.Node.UniqueIdentity])
|
||||||
|
nodes[this.Node.UniqueIdentity] = this.Node
|
||||||
|
if (!nodeIssues[this.Node.UniqueIdentity])
|
||||||
|
nodeIssues[this.Node.UniqueIdentity] = {}
|
||||||
|
if (!nodeIssues[this.Node.UniqueIdentity][this.ID])
|
||||||
|
nodeIssues[this.Node.UniqueIdentity][this.ID] = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$.each( nodes, function(){
|
||||||
|
var ne = $("#" + this.UniqueIdentity );
|
||||||
|
if (!ne.length)
|
||||||
|
ne = $("#nodetemplate div").clone().attr("id",this.UniqueIdentity).appendTo($("#issueList"));
|
||||||
|
|
||||||
|
$("#UniqueIdentity", ne).text(this.UniqueIdentity);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
skyapi().getJson("/checker/Issues", updateIssueList );
|
||||||
|
|
||||||
|
</script>
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="popup">Netz Status
|
<div class="popup">Netz Status
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<a href="/static/summary.html"><div>Störfälle</div></a>
|
<a href="/static/checks/issues.html"><div>Störfälle</div></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue