WIP
parent
81c78502bb
commit
624f0589b4
|
@ -52,28 +52,33 @@ namespace ln.skyscanner
|
|||
|
||||
NodeCollection = ODB.GetCollection<Node>();
|
||||
NodeCollection.EnableStrongCache(true);
|
||||
NodeCollection.EnsureIndex("PrimaryIP");
|
||||
NodeCollection.EnsureIndex("Interfaces[].ConfiguredIPs[].IP");
|
||||
NodeCollection.EnsureIndex("Interfaces[].ConfiguredIPs[].Network");
|
||||
NodeCollection.EnsureIndex("uniqueIdentity");
|
||||
NodeCollection.EnsureIndeces(
|
||||
"PrimaryIP",
|
||||
"Interfaces[].ConfiguredIPs[].IP",
|
||||
"Interfaces[].ConfiguredIPs[].Network",
|
||||
"uniqueIdentity"
|
||||
);
|
||||
|
||||
/* Preload all nodes to increase load speed*/
|
||||
foreach (Node node in NodeCollection)
|
||||
{
|
||||
}
|
||||
|
||||
SubnetCollection = ODB.GetCollection<Subnet>();
|
||||
SubnetCollection.EnsureIndex("Network");
|
||||
SubnetCollection.EnsureIndeces("Network");
|
||||
|
||||
PointOfPresenceCollection = ODB.GetCollection<PointOfPresence>();
|
||||
PointOfPresenceCollection.EnsureIndex("ForeignName");
|
||||
PointOfPresenceCollection.EnsureIndeces("ForeignName");
|
||||
|
||||
CrawledHosts = ODB.GetCollection<CrawledHost>();
|
||||
CrawledHosts.EnsureIndex("PrimaryIP");
|
||||
CrawledHosts.EnsureIndex("IPAddresses[]");
|
||||
CrawledHosts.EnsureIndeces("PrimaryIP","IPAddresses[]");
|
||||
|
||||
CrawledSubnets = ODB.GetCollection<CrawledSubnet>();
|
||||
BlockedNetworks = ODB.GetCollection<Network4>("blockedNetworks");
|
||||
|
||||
SkyCheckStates = ODB.GetCollection<SkyCheckState>();
|
||||
SkyCheckStates.EnableStrongCache(true);
|
||||
SkyCheckStates.EnsureIndex("CheckName");
|
||||
SkyCheckStates.EnsureIndex("Node.ID");
|
||||
SkyCheckStates.EnsureIndeces("CheckName","Node");
|
||||
|
||||
Logging.Log(LogLevel.INFO, "SkyEntities: initialized");
|
||||
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
using System;
|
||||
using ln.skyscanner.entities;
|
||||
using ln.types;
|
||||
using ln.snmp;
|
||||
using System.Collections.Generic;
|
||||
using ln.snmp.types;
|
||||
using ln.logging;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using Renci.SshNet.Messages.Connection;
|
||||
|
||||
namespace ln.skyscanner.checks
|
||||
{
|
||||
public class APC : SkyCheck
|
||||
{
|
||||
public APC()
|
||||
:base("apc")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override void Check(SkyChecker skyChecker,ref SkyCheckState checkState,Node node)
|
||||
{
|
||||
if ((checkState == null))
|
||||
{
|
||||
checkState = new SkyCheckState(this, node);
|
||||
}
|
||||
|
||||
foreach (URI snmpUri in node.FindURIs("snmp"))
|
||||
{
|
||||
using (SnmpInterface snmp = SnmpInterface.FromURI(snmpUri,skyChecker.SNMPEngine))
|
||||
{
|
||||
try
|
||||
{
|
||||
Sequence[][] inputs = snmp.snmpWalk(new string[]{
|
||||
"1.3.6.1.2.1.33.1.3.3.1.2",
|
||||
"1.3.6.1.2.1.33.1.3.3.1.3",
|
||||
"1.3.6.1.2.1.33.1.3.3.1.4"
|
||||
});
|
||||
Sequence[][] outputs = snmp.snmpWalk(new string[]{
|
||||
"1.3.6.1.2.1.33.1.4.4.1.2",
|
||||
"1.3.6.1.2.1.33.1.4.4.1.3",
|
||||
"1.3.6.1.2.1.33.1.4.4.1.5"
|
||||
});
|
||||
Sequence[][] batteries = snmp.snmpWalk(new string[] {
|
||||
"1.3.6.1.2.1.33.1.2.1",
|
||||
"1.3.6.1.2.1.33.1.2.3",
|
||||
"1.3.6.1.2.1.33.1.2.4",
|
||||
"1.3.6.1.2.1.33.1.2.5",
|
||||
"1.3.6.1.2.1.33.1.2.7"
|
||||
});
|
||||
|
||||
CheckState myCheckState = CheckState.OK;
|
||||
|
||||
int n = 0;
|
||||
foreach (Sequence[] input in inputs)
|
||||
{
|
||||
double frequency = (double)((Integer)(input[0].Items[1])).LongValue / 10.0;
|
||||
double voltage = (double)((Integer)(input[1].Items[1])).LongValue;
|
||||
double current = (double)((Integer)(input[2].Items[1])).LongValue;
|
||||
|
||||
checkState.WritePerformanceValue(String.Format("ups_input_{0}_frequency", n), frequency, wLower: 48, wUpper: 52, cLower: 45, cUpper: 55);
|
||||
checkState.WritePerformanceValue(String.Format("ups_input_{0}_voltage", n), voltage, wLower: 218.5, wUpper: 238, cLower: 212, cUpper: 245);
|
||||
checkState.WritePerformanceValue(String.Format("ups_input_{0}_current", n), current);
|
||||
n++;
|
||||
}
|
||||
|
||||
n = 0;
|
||||
foreach (Sequence[] output in outputs)
|
||||
{
|
||||
checkState.WritePerformanceValue(String.Format("ups_output_{0}_voltage", n), (double)((Integer)(output[0].Items[1])).LongValue, wLower: 218.5, wUpper: 238, cLower: 212, cUpper: 245);
|
||||
checkState.WritePerformanceValue(String.Format("ups_output_{0}_current", n), (double)((Integer)(output[1].Items[1])).LongValue / 10.0);
|
||||
checkState.WritePerformanceValue(String.Format("ups_output_{0}_load", n), (double)((Integer)(output[2].Items[1])).LongValue, wUpper: 50, cUpper: 75);
|
||||
n++;
|
||||
}
|
||||
|
||||
n = 0;
|
||||
foreach (Sequence[] battery in batteries)
|
||||
{
|
||||
checkState.WritePerformanceValue(String.Format("ups_battery_{0}_status", n), (double)((Integer)(battery[0].Items[1])).LongValue);
|
||||
checkState.WritePerformanceValue(String.Format("ups_battery_{0}_minutes_remain", n), (double)((Integer)(battery[1].Items[1])).LongValue, wLower: 20, cLower: 10 );
|
||||
checkState.WritePerformanceValue(String.Format("ups_battery_{0}_capacity", n), (double)((Integer)(battery[2].Items[1])).LongValue, wLower: 75, cLower: 50);
|
||||
checkState.WritePerformanceValue(String.Format("ups_battery_{0}_voltage", n), (double)((Integer)(battery[3].Items[1])).LongValue / 10.0);
|
||||
checkState.WritePerformanceValue(String.Format("ups_battery_{0}_temperature", n), (double)((Integer)(battery[4].Items[1])).LongValue, wUpper: 40, cUpper: 60);
|
||||
n++;
|
||||
}
|
||||
|
||||
checkState.CheckState = CheckState.OK;
|
||||
return;
|
||||
} catch (SnmpError)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
checkState.CheckState = CheckState.FAIL;
|
||||
}
|
||||
|
||||
public override bool IsValid(Node node)
|
||||
{
|
||||
return (node.Vendor != null) && node.Vendor.Equals("APC");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ namespace ln.skyscanner.checks
|
|||
Name = String.Format("Interval check: {0} [{1}]",node.UniqueIdentity,node.PrimaryIP.ToString());
|
||||
Node = node;
|
||||
|
||||
Query stateQuery = Query.Equals<SkyCheckState>("Node.ID", Node.ID);
|
||||
Query stateQuery = Query.Equals<SkyCheckState>("Node", Node.ID);
|
||||
SkyCheckState[] skyCheckStates = SkyScanner.Instance.Entities.SkyCheckStates.Query(stateQuery).ToArray();
|
||||
foreach (SkyCheckState checkState in skyCheckStates)
|
||||
{
|
||||
|
|
|
@ -32,11 +32,7 @@ namespace ln.skyscanner.checks
|
|||
public override void Check(SkyChecker skyChecker,ref SkyCheckState checkState,Node node)
|
||||
{
|
||||
if (checkState == null)
|
||||
{
|
||||
checkState = new SkyCheckState(this, node);
|
||||
checkState.WarnLower = 0.6;
|
||||
checkState.CritLower = 0.3;
|
||||
}
|
||||
|
||||
long roundTripTime = 0;
|
||||
int success = 0;
|
||||
|
@ -54,13 +50,14 @@ namespace ln.skyscanner.checks
|
|||
|
||||
float fSuccess = (float)success / (float)n;
|
||||
|
||||
skyChecker.WritePerfValue(this,checkState,"replies",node,fSuccess);
|
||||
checkState.WritePerformanceValue("replies", fSuccess, 0.8, 1.0, 0.6, 1.0);
|
||||
if (success > 0)
|
||||
{
|
||||
roundTripTime /= success;
|
||||
skyChecker.WritePerfValue(this, checkState, "rta", node, roundTripTime);
|
||||
checkState.WritePerformanceValue("rta", roundTripTime, 0, 10, 0, 50);
|
||||
}
|
||||
SetState(checkState, fSuccess);
|
||||
|
||||
checkState.BaseCheckState = CheckState.OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
// /**
|
||||
// * File: PerformanceValue.cs
|
||||
// * Author: haraldwolff
|
||||
// *
|
||||
// * This file and it's content is copyrighted by the Author and / or copyright holder.
|
||||
// * Any use wihtout proper permission is illegal and may lead to legal actions.
|
||||
// *
|
||||
// *
|
||||
// **/
|
||||
using System;
|
||||
using ln.perfdb.storage;
|
||||
namespace ln.skyscanner.checks
|
||||
{
|
||||
public class PerformanceValue
|
||||
{
|
||||
public string[] PerfPath { get; private set; }
|
||||
public string PerfName => string.Join("/", PerfPath);
|
||||
|
||||
public double LastValue { get; set; }
|
||||
|
||||
public double WarnLower { get; set; } = Double.MinValue;
|
||||
public double WarnUpper { get; set; } = Double.MaxValue;
|
||||
public double CritLower { get; set; } = Double.MinValue;
|
||||
public double CritUpper { get; set; } = Double.MaxValue;
|
||||
|
||||
|
||||
private PerformanceValue()
|
||||
{
|
||||
}
|
||||
public PerformanceValue(string[] perfPath,double wLower = Double.MinValue,double wUpper = Double.MaxValue, double cLower = Double.MinValue, double cUpper = Double.MaxValue)
|
||||
{
|
||||
PerfPath = perfPath;
|
||||
LastValue = 0;
|
||||
|
||||
WarnLower = wLower;
|
||||
WarnUpper = wUpper;
|
||||
CritLower = cLower;
|
||||
CritUpper = cUpper;
|
||||
}
|
||||
|
||||
public void WritePerfValue(double value)
|
||||
{
|
||||
LastValue = value;
|
||||
|
||||
PerfFile perfFile = SkyScanner.Instance.Checker.GetPerfFile(PerfPath);
|
||||
lock (perfFile)
|
||||
{
|
||||
perfFile.EnsureOpen();
|
||||
perfFile.Write(DateTimeOffset.Now.ToUnixTimeSeconds(), value);
|
||||
perfFile.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public CheckState CheckState
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((LastValue < CritLower) || (LastValue > CritUpper))
|
||||
return CheckState.CRITICAL;
|
||||
if ((LastValue < WarnLower) || (LastValue > WarnUpper))
|
||||
return CheckState.WARN;
|
||||
|
||||
return CheckState.OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -34,25 +34,11 @@ namespace ln.skyscanner.checks
|
|||
public abstract bool IsValid(Node node);
|
||||
public abstract void Check(SkyChecker skyChecker,ref SkyCheckState checkState,Node node);
|
||||
|
||||
public virtual void SetState(SkyCheckState checkState,double value)
|
||||
{
|
||||
if ((value < checkState.CritLower) || (value > checkState.CritUpper))
|
||||
{
|
||||
checkState.CheckState = CheckState.CRITICAL;
|
||||
} else if ((value < checkState.WarnLower) || (value > checkState.WarnUpper))
|
||||
{
|
||||
checkState.CheckState = CheckState.WARN;
|
||||
}
|
||||
else
|
||||
{
|
||||
checkState.CheckState = CheckState.OK;
|
||||
}
|
||||
}
|
||||
|
||||
static SkyCheck()
|
||||
{
|
||||
AddSkyCheck(new Hostalive());
|
||||
AddSkyCheck(new Ubiquity());
|
||||
AddSkyCheck(new APC());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,24 +35,34 @@ namespace ln.skyscanner.checks
|
|||
public class SkyCheckState
|
||||
{
|
||||
[DocumentID]
|
||||
public Guid ID = Guid.NewGuid();
|
||||
public Guid ID;
|
||||
|
||||
public readonly String CheckName;
|
||||
[ByReference]
|
||||
public readonly Node Node;
|
||||
|
||||
public String[] PerformanceValues => performanceValues.ToArray();
|
||||
List<String> performanceValues = new List<String>();
|
||||
public PerformanceValue[] PerformanceValues => performanceValues.ToArray();
|
||||
List<PerformanceValue> performanceValues = new List<PerformanceValue>();
|
||||
|
||||
public DateTime LastCheckTime { get; set; }
|
||||
public TimeSpan UnchangedTime => history.Count > 0 ? DateTime.Now - history[history.Count - 1].Timestamp : TimeSpan.FromSeconds(0);
|
||||
|
||||
public double WarnLower { get; set; } = Double.MinValue;
|
||||
public double WarnUpper { get; set; } = Double.MaxValue;
|
||||
public double CritLower { get; set; } = Double.MinValue;
|
||||
public double CritUpper { get; set; } = Double.MaxValue;
|
||||
public CheckState BaseCheckState { get; set; } = CheckState.OK;
|
||||
public CheckState CheckState {
|
||||
get
|
||||
{
|
||||
CheckState checkState = BaseCheckState;
|
||||
foreach (PerformanceValue performanceValue in performanceValues)
|
||||
if (performanceValue.CheckState > checkState)
|
||||
checkState = performanceValue.CheckState;
|
||||
|
||||
public CheckState CheckState { get => currentCheckState; set { if (currentCheckState != value) history.Add(new CheckStateChange(value)); currentCheckState = value; } }
|
||||
CheckState currentCheckState;
|
||||
return checkState;
|
||||
}
|
||||
set
|
||||
{
|
||||
BaseCheckState = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CheckStateChange[] History => history.ToArray();
|
||||
List<CheckStateChange> history = new List<CheckStateChange>();
|
||||
|
@ -62,24 +72,42 @@ namespace ln.skyscanner.checks
|
|||
}
|
||||
public SkyCheckState(SkyCheck skyCheck,Node node)
|
||||
{
|
||||
ID = Guid.NewGuid();
|
||||
CheckName = skyCheck.Name;
|
||||
Node = node;
|
||||
}
|
||||
|
||||
public void EnsurePerformanceValue(String perfName)
|
||||
public void WritePerformanceValue(String perfName,double value, double wLower = Double.MinValue, double wUpper = Double.MaxValue, double cLower = Double.MinValue, double cUpper = Double.MaxValue)
|
||||
{
|
||||
if (performanceValues == null)
|
||||
performanceValues = new List<string>();
|
||||
performanceValues = new List<PerformanceValue>();
|
||||
|
||||
if (!performanceValues.Contains(perfName))
|
||||
performanceValues.Add(perfName);
|
||||
string[] perfPath = new string[] { Node.UniqueIdentity, CheckName, perfName };
|
||||
perfName = string.Join("/", perfPath);
|
||||
|
||||
foreach (PerformanceValue performanceValue in performanceValues)
|
||||
{
|
||||
if (performanceValue.PerfName.Equals(perfName))
|
||||
{
|
||||
performanceValue.WritePerfValue(value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PerformanceValue newPerformanceValue = new PerformanceValue(perfPath, wLower, wUpper, cLower, cUpper);
|
||||
performanceValues.Add(newPerformanceValue);
|
||||
newPerformanceValue.WritePerfValue(value);
|
||||
}
|
||||
|
||||
|
||||
public class PerformanceValue
|
||||
public void CheckHistory()
|
||||
{
|
||||
|
||||
if ((history.Count == 0) || (history[history.Count - 1].NewState != CheckState))
|
||||
{
|
||||
history.Add(new CheckStateChange(CheckState));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ using ln.http.resources;
|
|||
using ln.types.odb;
|
||||
using System.Collections.Generic;
|
||||
using ln.types.odb.mapped;
|
||||
using System.Runtime.CompilerServices;
|
||||
namespace ln.skyscanner.checks
|
||||
{
|
||||
public class SkyChecker
|
||||
|
@ -102,42 +103,18 @@ namespace ln.skyscanner.checks
|
|||
perfFiles.Clear();
|
||||
}
|
||||
|
||||
public void WritePerfValue(SkyCheck skyCheck,SkyCheckState checkState,String vName,Node node,double value)
|
||||
public PerfFile GetPerfFile(params string[] perfPath)
|
||||
{
|
||||
PerfFile perfFile = GetPerfFile(skyCheck, checkState, vName, node);
|
||||
lock (perfFile)
|
||||
{
|
||||
perfFile.EnsureOpen();
|
||||
perfFile.Write(DateTimeOffset.Now.ToUnixTimeSeconds(), value);
|
||||
perfFile.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public PerfFile GetPerfFile(string perfName)
|
||||
{
|
||||
return perfFiles[perfName];
|
||||
}
|
||||
|
||||
private PerfFile GetPerfFile(SkyCheck skyCheck,SkyCheckState checkState,String vName, Node node)
|
||||
{
|
||||
String checkPath = String.Format("{0}_{1}", node.UniqueIdentity, skyCheck.Name);
|
||||
String perfName = String.Format("{0}_{1}",checkPath,vName);
|
||||
|
||||
if (node.AddCheck(perfName))
|
||||
{
|
||||
SkyScanner.Instance.Entities.NodeCollection.Upsert(node);
|
||||
}
|
||||
checkState.EnsurePerformanceValue(perfName);
|
||||
|
||||
lock (this)
|
||||
{
|
||||
string perfName = string.Join("/", perfPath);
|
||||
if (!perfFiles.ContainsKey(perfName))
|
||||
{
|
||||
String perfDirectory = Path.Combine(BasePath, node.UniqueIdentity, skyCheck.Name);
|
||||
String perfDirectory = Path.Combine(BasePath, Path.Combine(perfPath.Take(perfPath.Length - 1).ToArray()));
|
||||
if (!Directory.Exists(perfDirectory))
|
||||
Directory.CreateDirectory(perfDirectory);
|
||||
|
||||
String perfFileName = Path.Combine(BasePath, node.UniqueIdentity, skyCheck.Name, String.Format("{0}.perf", vName));
|
||||
String perfFileName = Path.Combine(perfDirectory, String.Format("{0}.perf", perfPath[perfPath.Length-1]));
|
||||
|
||||
PerfFile perfFile = new PerfFile(perfFileName);
|
||||
perfFile.Open();
|
||||
|
@ -151,13 +128,13 @@ namespace ln.skyscanner.checks
|
|||
PerfFile.PerfFileSection s5 = new PerfFile.PerfFileSection(perfFile, s4, TimeSpan.FromDays(750), 3600, AggregationMethod.AVERAGE);
|
||||
}
|
||||
perfFile.Close();
|
||||
|
||||
perfFiles.Add(perfName, perfFile);
|
||||
}
|
||||
return perfFiles[perfName];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void scheduler()
|
||||
{
|
||||
long nextMinute = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||
|
|
|
@ -39,10 +39,10 @@ namespace ln.skyscanner.checks
|
|||
|
||||
foreach (Sequence[] row in ptp)
|
||||
{
|
||||
skyChecker.WritePerfValue(this, checkState, "ptp_rx_capa", node, (double)((Integer)(row[0].Items[1])).LongValue);
|
||||
skyChecker.WritePerfValue(this, checkState, "ptp_tx_capa", node, (double)((Integer)(row[1].Items[1])).LongValue);
|
||||
skyChecker.WritePerfValue(this, checkState, "ptp_rx_pwr", node, (double)((Integer)(row[2].Items[1])).LongValue);
|
||||
skyChecker.WritePerfValue(this, checkState, "ptp_tx_pwr", node, (double)((Integer)(row[3].Items[1])).LongValue);
|
||||
ubiquityCheckState.WritePerformanceValue("ptp_rx_capa", (double)((Integer)(row[0].Items[1])).LongValue);
|
||||
ubiquityCheckState.WritePerformanceValue("ptp_tx_capa", (double)((Integer)(row[1].Items[1])).LongValue);
|
||||
ubiquityCheckState.WritePerformanceValue("ptp_rx_pwr", (double)((Integer)(row[2].Items[1])).LongValue, -65.0,0,-75.0,0);
|
||||
ubiquityCheckState.WritePerformanceValue("ptp_tx_pwr", (double)((Integer)(row[3].Items[1])).LongValue);
|
||||
|
||||
long rxBytes = ((Integer)(row[4].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.TXRate.Update(txBytes * 8);
|
||||
|
||||
skyChecker.WritePerfValue(this, checkState, "ptp_rx_rate", node, ubiquityCheckState.RXRate.Current);
|
||||
skyChecker.WritePerfValue(this, checkState, "ptp_tx_rate", node, ubiquityCheckState.TXRate.Current);
|
||||
ubiquityCheckState.WritePerformanceValue("ptp_rx_rate", ubiquityCheckState.RXRate.Current);
|
||||
ubiquityCheckState.WritePerformanceValue("ptp_tx_rate", ubiquityCheckState.TXRate.Current);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace ln.skyscanner.crawl.tests
|
|||
{
|
||||
public class ICMP : CrawlService
|
||||
{
|
||||
public Ping Ping { get; private set; }
|
||||
public Ping Ping { get; private set; } = new Ping();
|
||||
|
||||
public ICMP()
|
||||
:base("ping")
|
||||
|
|
|
@ -32,10 +32,19 @@ namespace ln.skyscanner.crawl.service
|
|||
if (crawl.Host.GetHint("snmp.orids", new string[0]).Contains("1.3.6.1.4.1.41112"))
|
||||
{
|
||||
List<Sequence> test = snmp.snmpWalk("1.3.6.1.4.1.41112.1.3.2.1.11");
|
||||
List<Sequence> test2 = snmp.snmpWalk("1.3.6.1.4.1.41112.1.3.3.1.66");
|
||||
//List<Sequence> test2 = snmp.snmpWalk("1.3.6.1.4.1.41112.1.3.3.1.66");
|
||||
|
||||
if (test.Count > 0)
|
||||
crawl.Host.SetHint("ubiquity.ptp", true);
|
||||
else
|
||||
crawl.Host.SetHint("ubiquity.ptp", false);
|
||||
|
||||
crawl.Host.SetHint("ubiquity.ptp", true);
|
||||
test = snmp.snmpWalk("1.3.6.1.4.1.41112.1.4.7.1.1");
|
||||
|
||||
if (test.Count > 0)
|
||||
crawl.Host.SetHint("ubiquity.ptmp", true);
|
||||
else
|
||||
crawl.Host.SetHint("ubiquity.ptmp", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -275,14 +275,21 @@ namespace ln.skyscanner.entities
|
|||
if (crawledHost.GetHint("http.server", "").Equals("Viprinet"))
|
||||
node.Vendor = "Viprinet";
|
||||
|
||||
if (crawledHost.GetHint("snmp.orids",new string[0]).Contains("1.3.6.1.4.1.41112"))
|
||||
if (crawledHost.GetHint("snmp.sysObjectID", "").Equals("1.3.6.1.4.1.318.1.3.27"))
|
||||
{
|
||||
node.Vendor = "APC";
|
||||
node.DeviceType = DeviceType.UPS;
|
||||
} else if (crawledHost.GetHint("snmp.orids", new string[0]).Contains("1.3.6.1.4.1.41112"))
|
||||
{
|
||||
node.Vendor = "Ubiquity";
|
||||
}
|
||||
|
||||
if (crawledHost.GetHint<bool>("ubiquity.ptp",false))
|
||||
if (crawledHost.GetHint<bool>("ubiquity.ptp", false))
|
||||
{
|
||||
node.DeviceType = DeviceType.PTP;
|
||||
} else if (crawledHost.GetHint<bool>("ubiquity.ptmp", false))
|
||||
{
|
||||
node.DeviceType = DeviceType.PTMP;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace ln.skyscanner.entities
|
|||
|
||||
public IEnumerable<URI> FindURIs(string scheme)
|
||||
{
|
||||
return uris.Where((u) => scheme.Equals(u.Scheme));
|
||||
return uris.Where((u) => scheme.Equals(u.Scheme)).ToArray();
|
||||
}
|
||||
|
||||
public NetworkInterface GetInterface(String intfName)
|
||||
|
|
|
@ -14,6 +14,7 @@ using ln.http.resources;
|
|||
using ln.types.threads;
|
||||
using ln.perfdb.storage;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net;
|
||||
namespace ln.skyscanner.http
|
||||
{
|
||||
public class CheckerApi : JsonCallResource
|
||||
|
@ -40,6 +41,8 @@ namespace ln.skyscanner.http
|
|||
:base(container,"checks")
|
||||
{ }
|
||||
|
||||
public override bool HandlesDispatching => true;
|
||||
|
||||
public override bool Contains(string name)
|
||||
{
|
||||
return base.Contains(name) || SkyScanner.Instance.Checker.ContainsPerfFile(name);
|
||||
|
@ -56,6 +59,16 @@ namespace ln.skyscanner.http
|
|||
|
||||
throw new KeyNotFoundException();
|
||||
}
|
||||
public override HttpResponse GetResponse(HttpRequest httpRequest, Queue<string> pathStack)
|
||||
{
|
||||
if (pathStack.Count == 0)
|
||||
return GetResponse(httpRequest);
|
||||
|
||||
string perfName = WebUtility.UrlDecode(String.Join("/", pathStack));
|
||||
|
||||
Resource perfResource = GetResource(perfName);
|
||||
return perfResource.GetResponse(httpRequest);
|
||||
}
|
||||
|
||||
public override HttpResponse GetResponse(HttpRequest httpRequest)
|
||||
{
|
||||
|
|
|
@ -81,6 +81,8 @@
|
|||
<Compile Include="entities\PointOfPresence.cs" />
|
||||
<Compile Include="entities\CheckSeverity.cs" />
|
||||
<Compile Include="entities\DeviceType.cs" />
|
||||
<Compile Include="checks\APC.cs" />
|
||||
<Compile Include="checks\PerformanceValue.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
{ title: "Node", data: "Node.Name" },
|
||||
{ title: "LastCheckTime", data: "LastCheckTime" },
|
||||
{ title: "CheckState", data: "CheckState" },
|
||||
{ title: "Zeitspanne", data: "UnchangedTime" },
|
||||
{ title: "Check Schwere", data: "Node.Severity" },
|
||||
],
|
||||
ajax: {
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
<option value="604800">1 Woche</option>
|
||||
</select><br/>
|
||||
<br/>
|
||||
<input type="text" id="filter"><br/>
|
||||
<br/>
|
||||
<select size="25" id="perfList"></select>
|
||||
</div>
|
||||
<div>
|
||||
|
@ -60,10 +62,11 @@
|
|||
}
|
||||
} );
|
||||
|
||||
var perfList = skyapi().getJson("api/checker/checks", function(checks){
|
||||
$.each( checks, function(){
|
||||
$("#perfList").append( $( "<option value='"+ this +"'>" + this + "</option>" ) );
|
||||
});
|
||||
var perfList = [];
|
||||
|
||||
skyapi().getJson("api/checker/checks", function(checks){
|
||||
perfList = checks;
|
||||
applyFilter();
|
||||
});
|
||||
|
||||
function showGraph()
|
||||
|
@ -71,7 +74,7 @@
|
|||
var perfName = $("#perfList").children("option:selected").val();
|
||||
if (perfName)
|
||||
{
|
||||
skyapi().getJson("api/checker/checks/" + perfName + "?interval=" + $("#interval").children("option:selected").val(), function(perfValues){
|
||||
skyapi().getJson("api/checker/checks/" + encodeURIComponent(perfName) + "?interval=" + $("#interval").children("option:selected").val(), function(perfValues){
|
||||
chart.data.labels.length = 0;
|
||||
chart.data.datasets[0].data.length = 0;
|
||||
chart.data.datasets[0].label = perfName;
|
||||
|
@ -87,8 +90,20 @@
|
|||
}
|
||||
}
|
||||
|
||||
function applyFilter()
|
||||
{
|
||||
var pat = $("#filter").val();
|
||||
|
||||
$("#perfList").empty();
|
||||
$.each( perfList, function(){
|
||||
if (this.includes(pat))
|
||||
$("#perfList").append( $( "<option value='"+ this +"'>" + this + "</option>" ) );
|
||||
});
|
||||
}
|
||||
|
||||
$("#perfList").change( function(e){ showGraph(); } );
|
||||
$("#interval").change( function(e){ showGraph(); } );
|
||||
$("#filter").on( "input", function(e){ applyFilter(); } );
|
||||
|
||||
skyapi().addRefresh( showGraph, 60 );
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue