ln.skyscanner/perfvalue/PerformanceValue.cs

70 lines
2.0 KiB
C#

// /**
// * 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;
using ln.skyscanner.checks;
namespace ln.skyscanner.perfvalue
{
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;
public bool IgnoreLimits;
public String PerfUnit { get; set; } = String.Empty;
public String Group { get; set; } = String.Empty;
public double ExpectedMaximum { get; set; } = double.MaxValue;
public double ExpectedMinimum { get; set; } = double.MinValue;
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 CheckState CheckState
{
get
{
if (IgnoreLimits)
return CheckState.OK;
if ((LastValue < CritLower) || (LastValue > CritUpper))
return CheckState.CRITICAL;
if ((LastValue < WarnLower) || (LastValue > WarnUpper))
return CheckState.WARN;
return CheckState.OK;
}
}
}
}