WIP
parent
2f5b2f9a92
commit
67f69d4b1e
|
@ -47,10 +47,11 @@ namespace ln.skyscanner
|
||||||
{
|
{
|
||||||
SNMPEngine.DefaultEngine.Timeout = 3500;
|
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"));
|
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"))
|
//using (ODB odb = new ODB("odb"))
|
||||||
|
|
|
@ -54,6 +54,9 @@ namespace ln.skyscanner.checks
|
||||||
checkState.WritePerformanceValue("rta", roundTripTime, 0, 80, 0, 140);
|
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;
|
checkState.BaseCheckState = CheckState.OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@ 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 bool IgnoreLimits;
|
||||||
|
|
||||||
private PerformanceValue()
|
private PerformanceValue()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -55,6 +57,9 @@ namespace ln.skyscanner.checks
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (IgnoreLimits)
|
||||||
|
return CheckState.OK;
|
||||||
|
|
||||||
if ((LastValue < CritLower) || (LastValue > CritUpper))
|
if ((LastValue < CritLower) || (LastValue > CritUpper))
|
||||||
return CheckState.CRITICAL;
|
return CheckState.CRITICAL;
|
||||||
if ((LastValue < WarnLower) || (LastValue > WarnUpper))
|
if ((LastValue < WarnLower) || (LastValue > WarnUpper))
|
||||||
|
|
|
@ -7,23 +7,23 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<select id="interval" style="width: 180px;">
|
<select id="interval" style="width: 180px;">
|
||||||
<option value="3600">1 Stunde</option>
|
<option value="3600">1 Stunde</option>
|
||||||
<option value="21600">6 Stunden</option>
|
<option value="21600">6 Stunden</option>
|
||||||
<option value="43200">12 Stunden</option>
|
<option value="43200">12 Stunden</option>
|
||||||
<option value="86400">1 Tag</option>
|
<option value="86400">1 Tag</option>
|
||||||
<option value="604800">1 Woche</option>
|
<option value="604800">1 Woche</option>
|
||||||
</select>
|
</select>
|
||||||
<button onclick="refresh();">Aktualisieren</button>
|
<button onclick="refresh();">Aktualisieren</button>
|
||||||
<br/>
|
<br/>
|
||||||
<div class="flex row">
|
<div class="flex row">
|
||||||
<div class="">
|
<div class="">
|
||||||
<div id="CRITICAL"></div>
|
<div id="CRITICAL"></div>
|
||||||
<div id="WARN"></div>
|
<div id="WARN"></div>
|
||||||
<div id="FAIL"></div>
|
<div id="FAIL"></div>
|
||||||
<div id="ERROR"></div>
|
<div id="ERROR"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grow" style="">
|
<div id="Charts" class="grow" style="">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="visibility: hidden;">
|
<div style="visibility: hidden;">
|
||||||
|
@ -47,19 +47,26 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="chartBox" class="fill"><canvas id="chart"></canvas></div>
|
<div id="chartBox" class="fill"><canvas id="chart"></canvas></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="ChartBoxTemplate" class="fill"><canvas id="chart"></canvas></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
moment.defaultFormat = "DD.MM.YYYY HH:mm:ss";
|
moment.defaultFormat = "DD.MM.YYYY HH:mm:ss";
|
||||||
|
|
||||||
|
var currentUpdateCycle = 0;
|
||||||
var issues = {}
|
var issues = {}
|
||||||
var charts = []
|
var charts = []
|
||||||
var chartTimeout = null;
|
var chartTimeout = null;
|
||||||
|
|
||||||
function graphLoaded(pv, performanceValue, perfData)
|
function graphLoaded(performanceValue, perfData)
|
||||||
{
|
{
|
||||||
var chartColor = performanceValue.CheckState == "CRITICAL" ? '#FF0000' : (performanceValue.CheckState == "WARN") ? '#C0C000' : '#000000';
|
var chartColor = performanceValue.CheckState == "CRITICAL" ? '#FF0000' : (performanceValue.CheckState == "WARN") ? '#C0C000' : '#000000';
|
||||||
var chart = new Chart( $("#chart", pv), {
|
var perfID = encodeID(performanceValue.PerfName);
|
||||||
|
var htmlChart = $("#" + perfID );
|
||||||
|
if (!htmlChart.length)
|
||||||
|
htmlChart = $("#ChartBoxTemplate").clone().attr("id", perfID ).appendTo( $("#Charts") );
|
||||||
|
|
||||||
|
var chart = new Chart( $("#chart", htmlChart) , {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: {
|
data: {
|
||||||
datasets: [
|
datasets: [
|
||||||
|
@ -108,6 +115,21 @@
|
||||||
chart.update();
|
chart.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showCharts(issue)
|
||||||
|
{
|
||||||
|
var htmlCharts = $("#Charts");
|
||||||
|
htmlCharts.empty();
|
||||||
|
|
||||||
|
$.each( issue.PerformanceValues, function(){
|
||||||
|
var currentIssue = this;
|
||||||
|
skyapi().getJson("api/checker/checks/" + encodeURIComponent(this.PerfName) + "?interval=" + $("#interval").children("option:selected").val(), function(perfData){
|
||||||
|
graphLoaded(currentIssue, perfData);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function updateIssue(issue)
|
function updateIssue(issue)
|
||||||
{
|
{
|
||||||
var ne = $("#" + issue.ID );
|
var ne = $("#" + issue.ID );
|
||||||
|
@ -121,10 +143,14 @@
|
||||||
ne.appendTo(p);
|
ne.appendTo(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ne.data( "MyIssue", issue );
|
||||||
|
ne.attr( "CurrentUpdateCycle", currentUpdateCycle );
|
||||||
ne.removeClass("issue-WARN issue-CRITICAL");
|
ne.removeClass("issue-WARN issue-CRITICAL");
|
||||||
ne.addClass("issue-" + issue.CheckState );
|
ne.addClass("issue-" + issue.CheckState );
|
||||||
|
|
||||||
$("h2", ne).text(issue.CheckName + ": " + issue.Node.Name + " ( " + issue.Node.UniqueIdentity + " )");
|
$("h2", ne).text( issue.Node.DeviceType + " " + issue.CheckName + ": " + issue.Node.Name + " ( " + issue.Node.UniqueIdentity + " )").on("click", function(e){
|
||||||
|
showCharts($(this).parent().data("MyIssue"));
|
||||||
|
});
|
||||||
$("#LastCheckTime", ne).text(issue.LastCheckTime);
|
$("#LastCheckTime", ne).text(issue.LastCheckTime);
|
||||||
$("#UnchangedTime", ne).text(issue.UnchangedTime);
|
$("#UnchangedTime", ne).text(issue.UnchangedTime);
|
||||||
|
|
||||||
|
@ -147,30 +173,7 @@
|
||||||
$.each( issue.PerformanceValues, function(){
|
$.each( issue.PerformanceValues, function(){
|
||||||
pvparent.append( $("<span class='" + this.CheckState + "'>" + this.PerfName + "</span><br>") );
|
pvparent.append( $("<span class='" + this.CheckState + "'>" + this.PerfName + "</span><br>") );
|
||||||
|
|
||||||
/*
|
});
|
||||||
var pv = $("#" + this.PerfName.replace(/[./]/g,""), ne);
|
|
||||||
if (!pv.length)
|
|
||||||
pv = $("#pvtemplate").clone().attr("id", this.PerfName.replace(/[./]/g,""));
|
|
||||||
|
|
||||||
$("#PerfName", pv).text(this.PerfName);
|
|
||||||
$("#CheckState", pv).text(this.CheckState).addClass(this.CheckState);
|
|
||||||
|
|
||||||
var pvparent = $("#PerfValues", ne);
|
|
||||||
if (!pvparent.is(pv.parent()))
|
|
||||||
{
|
|
||||||
pv.detach();
|
|
||||||
pv.appendTo(pvparent);
|
|
||||||
}
|
|
||||||
|
|
||||||
var _perfValue = this;
|
|
||||||
var _pv = pv;
|
|
||||||
var perfName = this.PerfName;
|
|
||||||
|
|
||||||
charts.push( { pv: _pv, performanceValue: this } );
|
|
||||||
*/
|
|
||||||
});
|
|
||||||
|
|
||||||
//loadNextChart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadNextChart()
|
function loadNextChart()
|
||||||
|
@ -193,11 +196,42 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function updateIssueList(issueList)
|
function updateIssueList(issueList)
|
||||||
{
|
{
|
||||||
|
currentUpdateCycle++;
|
||||||
|
|
||||||
$.each( issueList , function(){
|
$.each( issueList , function(){
|
||||||
updateIssue(this);
|
if (this.Node.DeviceType != "UNKNOWN")
|
||||||
|
updateIssue(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
$.each( $("div#CRITICAL > div"), function(){
|
||||||
|
var c = $(this);
|
||||||
|
var cuc = $(this).attr("CurrentUpdateCycle");
|
||||||
|
if ($(this).attr("CurrentUpdateCycle") != currentUpdateCycle){
|
||||||
|
$(this).detach();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$.each( $("div#WARN > div"), function(){
|
||||||
|
var c = $(this);
|
||||||
|
var cuc = $(this).attr("CurrentUpdateCycle");
|
||||||
|
if ($(this).attr("CurrentUpdateCycle") != currentUpdateCycle){
|
||||||
|
$(this).detach();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$.each( $("div#FAIL > div"), function(){
|
||||||
|
var c = $(this);
|
||||||
|
var cuc = $(this).attr("CurrentUpdateCycle");
|
||||||
|
if ($(this).attr("CurrentUpdateCycle") != currentUpdateCycle){
|
||||||
|
$(this).detach();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$.each( $("div#ERROR > div"), function(){
|
||||||
|
var c = $(this);
|
||||||
|
var cuc = $(this).attr("CurrentUpdateCycle");
|
||||||
|
if ($(this).attr("CurrentUpdateCycle") != currentUpdateCycle){
|
||||||
|
$(this).detach();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#nCRITICAL").text( $("#CRITICAL > div").length );
|
$("#nCRITICAL").text( $("#CRITICAL > div").length );
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$( document ).tooltip();
|
$( document ).tooltip();
|
||||||
skyapi().setBaseURL("http://localhost:8080/");
|
|
||||||
setInterval( updateStatistics, 1000 );
|
setInterval( updateStatistics, 1000 );
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,11 @@
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function encodeID( t )
|
||||||
|
{
|
||||||
|
return ("" + t).replace( /[\.\/]/g, "_");
|
||||||
|
}
|
||||||
|
|
||||||
function SKYAPI(baseurl){
|
function SKYAPI(baseurl){
|
||||||
|
|
||||||
this.baseurl = baseurl;
|
this.baseurl = baseurl;
|
||||||
|
@ -175,7 +180,7 @@ function updateStatistics()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var __skyapi = new SKYAPI("");
|
var __skyapi = new SKYAPI("/");
|
||||||
|
|
||||||
function skyapi()
|
function skyapi()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue