Example #1
0
 protected SensorBase(string path, string productKey, IValuesQueue queue, string description)
 {
     _queue      = queue;
     Path        = path;
     ProductKey  = productKey;
     Description = description;
 }
Example #2
0
 public BarSensor(string path, string productKey, IValuesQueue queue, SensorType type, int barTimerPeriod, int smallTimerPeriod,
                  string description = "", int precision = 2)
     : base(path, productKey, queue, barTimerPeriod, smallTimerPeriod, description, precision)
 {
     _valuesList = new List <T>();
     _type       = type;
 }
 public BarSensorInt(string path, string productKey, IValuesQueue queue,
                     int collectPeriod = 300000,
                     int smallPeriod   = 15000) : base(path, productKey, queue, collectPeriod,
                                                       smallPeriod, "", 2)
 {
     _valuesList = new List <int>();
 }
 protected CustomFuncSensorBase(string path, string productKey, IValuesQueue queue, string description, TimeSpan timerSpan, SensorType type)
     : base(path, productKey, queue, description)
 {
     Type = type;
     RestartTimerInternal(timerSpan);
     TimerSpan = timerSpan;
 }
 public NoParamsFuncSensor(string path, string productKey, IValuesQueue queue, string description, TimeSpan timerSpan, SensorType type, Func <T> funcToInvoke,
                           bool isLogging) : base(path, productKey, queue, description, timerSpan, type)
 {
     _funcToInvoke = funcToInvoke;
     if (isLogging)
     {
         _logger = Logger.Create(nameof(NoParamsFuncSensor <T>));
     }
 }
 public DefaultValueSensor(string path, string productKey, IValuesQueue queue, SensorType type, T defaultValue, string description = "")
     : base(path, productKey, queue, description)
 {
     lock (_syncRoot)
     {
         _currentValue = defaultValue;
     }
     _type = type;
 }
 /// <summary>
 /// </summary>
 /// <param name="path"></param>
 /// <param name="productKey"></param>
 /// <param name="collectPeriod">One bar contains data for the given period. 5000 is 5 seconds.</param>
 /// <param name="smallPeriod">The sensor sends intermediate bar data every smallPeriod time.</param>
 protected BarSensorBase(string path, string productKey,
                         IValuesQueue queue, int barTimerPeriod, int smallTimerPeriod, string description, int precision)
     : base(path, productKey, queue, description)
 {
     _syncObject       = new object();
     _barTimerPeriod   = barTimerPeriod;
     _smallTimerPeriod = smallTimerPeriod;
     FillPrecision(precision);
     StartTimer(_barTimerPeriod, _smallTimerPeriod);
 }
Example #8
0
 protected DefaultValueSensorBase(string path, string productKey, IValuesQueue queue, T defaultValue)
 {
     Path       = path;
     ProductKey = productKey;
     _syncRoot  = new object();
     lock (_syncRoot)
     {
         _currentValue = defaultValue;
     }
 }
Example #9
0
 public OneParamFuncSensor(string path, string productKey, IValuesQueue queue, string description, TimeSpan timerSpan, SensorType type,
                           Func <List <U>, T> funcToInvoke, bool isLogging) : base(path, productKey, queue, description, timerSpan, type)
 {
     _funcToInvoke = funcToInvoke;
     _paramsList   = new List <U>();
     _lockObj      = new object();
     if (isLogging)
     {
         _logger = Logger.Create(nameof(OneParamFuncSensor <T, U>));
     }
 }
Example #10
0
 public BarSensorDouble(string path, string productKey, IValuesQueue queue,
                        int collectPeriod = 300000,
                        int smallPeriod   = 15000, int precision = 2) : base(path, productKey, queue, collectPeriod,
                                                                             smallPeriod, "", 2)
 {
     _valuesList = new List <double>();
     if (precision < 1 || precision > 10)
     {
         _precision = 2;
     }
     else
     {
         _precision = precision;
     }
 }
Example #11
0
        public WindowsUpdateFuncSensor(string nodeName, string productKey, IValuesQueue queue,
                                       string description, TimeSpan timerSpan, SensorType type, bool isLogging, TimeSpan updateInterval)
            : base($"{nodeName ?? TextConstants.PerformanceNodeName}/{TextConstants.WindowsUpdateNodeName}", productKey, queue, description, timerSpan, type)
        {
            _updateInterval = updateInterval;

            ManagementObject obj = GetManagementObject();

            TryGetWindowsValue(obj, TextConstants.Version, out _windowsVersion);
            _windowsLastUpdate = TryGetWindowsValue(obj, TextConstants.InstallDate, out var strDate)
                ? ToUTC(strDate) : DateTime.MinValue;

            if (isLogging)
            {
                _logger = Logger.Create(nameof(WindowsUpdateFuncSensor));
            }
        }
Example #12
0
 public BarSensor(string path, string productKey, IValuesQueue queue, SensorType type, int barTimerPeriod = 300000,
                  int smallTimerPeriod = 15000, int precision = 2, string description = "")
     : this(path, productKey, queue, type, barTimerPeriod, smallTimerPeriod, description, precision)
 {
 }
Example #13
0
 protected InstantValueTypedSensorBase(string path, string productKey, IValuesQueue queue)
     : base(path, productKey, queue)
 {
 }
 public InstantValueSensorString(string path, string productKey, IValuesQueue queue)
     : base(path, productKey, queue)
 {
 }
Example #15
0
 public InstantValueSensor(string path, string productKey, IValuesQueue queue, SensorType type, string description = "")
     : base(path, productKey, queue, description)
 {
     _description = description;
     _type        = type;
 }
Example #16
0
 public DefaultValueSensorDouble(string path, string productKey, IValuesQueue queue, double defaultValue) : base(path, productKey, queue, defaultValue)
 {
 }
Example #17
0
 public ProcessThreadCountSensor(string productKey, IValuesQueue queue, string processName)
     : base($"{TextConstants.PerformanceNodeName}/{_sensorName}", "Process", "Thread Count", processName)
 {
     InternalBar = new BarSensor <int>($"{TextConstants.PerformanceNodeName}/{_sensorName}", productKey, queue, SensorType.IntegerBarSensor);
 }
 public ProcessCPUSensor(string productKey, IValuesQueue queue, string processName, string nodeName)
     : base($"{nodeName ?? TextConstants.CurrentProcessNodeName}/{_sensorName}", "Process", "% Processor Time", processName, GetProcessCPUFunc())
 {
     InternalBar = new BarSensor <double>(Path, productKey, queue, SensorType.DoubleBarSensor);
 }
Example #19
0
 protected InstantValueSensorBase(string path, string productKey, IValuesQueue queue) :
     base(path, productKey, queue, "")
 {
     _syncObject = new object();
 }
Example #20
0
 public TotalCPUSensor(string productKey, IValuesQueue queue, string nodeName)
     : base($"{nodeName ?? TextConstants.PerformanceNodeName}/{_sensorName}", "Processor", "% Processor Time", "_Total", GetTotalCPUFunc())
 {
     InternalBar = new BarSensor <int>(Path, productKey, queue, SensorType.IntegerBarSensor);
 }
Example #21
0
 public FreeMemorySensor(string productKey, IValuesQueue queue, string nodeName) :
     base($"{nodeName ?? TextConstants.PerformanceNodeName}/{_sensorName}", "Memory", "Available MBytes", string.Empty, GetFreeMemoryFunc())
 {
     InternalBar = new BarSensor <int>(Path, productKey, queue, SensorType.IntegerBarSensor);
 }
 public DefaultValueSensorInt(string path, string productKey, IValuesQueue queue, int defaultValue) : base(path, productKey, queue, defaultValue)
 {
 }
Example #23
0
 public ProcessCPUSensor(string productKey, IValuesQueue queue, string processName)
     : base($"{TextConstants.PerformanceNodeName}/{_sensorName}", "Process", "% Processor Time", processName)
 {
     InternalBar = new BarSensor <double>($"{TextConstants.PerformanceNodeName}/{_sensorName}", productKey, queue, SensorType.DoubleBarSensor);
 }
Example #24
0
 public ProcessMemorySensor(string productKey, IValuesQueue queue, string processName, string nodeName)
     : base($"{nodeName ?? TextConstants.CurrentProcessNodeName}/{_sensorName}", "Process", "Working set", processName, GetProcessMemoryFunc())
 {
     InternalBar = new BarSensor <int>(Path, productKey, queue, SensorType.IntegerBarSensor);
 }