Standard Performance Sensors [invalid] - SoftFx/Hierarchical-Sensor-Monitoring GitHub Wiki

Standard sensors currently include 6 sensors, which allow users to collect general performance data. The sensors are divided into two nodes: Current Process and System Monitoring. Each node may contain up to three sensors depending on the configuration. The sensors' work differs when use them on Windows or other operating systems. All sensors (except Service Alive) use System.Diagnostics.PerformanceCounter standard class (see more) for collecting monitoring data. When used under non-Windows operating system (like Linux), the sensors work differently. Please note, that System Monitoring sensors are supported for Windows only!

System monitoring

The node collects information about the system. The sensors (except Service Alive) are supported for Windows only.

Service Alive

Service Alive is a simple sensor which sends 'true' boolean value 15 seconds to indicate that the monitored service is 'alive'. To use the sensor, you should call the following method:

IDataCollector.MonitorServiceAlive();

Total CPU

The sensor collects data about the whole CPU usage into a bar. The PerformanceCounter is created with the following parameters: categoryName = 'Processor', counterName = '% Processor Time', instanceName = '_Total'. To use the sensor, you should pass 'true' as the first parameter to the following method:

IDataCollector.InitializeSystemMonitoring(bool isCPU, bool isFreeRam);

Free Memory

The sensor collects data about the amount of currently available RAM memory into a bar. The PerformanceCounter is created with the following parameters: categoryName = 'Memory', counterName = 'Available MBytes'. To use the sensor, you should pass 'true' as the second parameter to the following method:

IDataCollector.InitializeSystemMonitoring(bool isCPU, bool isFreeRam);

Current Process

The node collects the information about the current process (HSM Server process). PerformanceCounter class is used for Windows (like for System Monitoring. For non-Windows operating systems C# Process class is used.

Process CPU

The sensor collects CPU usage percentage into a bar. For Windows, the PerformanceCounter has the following parameters: categoryName = 'Process', counterName = '% Processor Time'. For other systems, the following C# code is used:

Process currentProcess = Process.GetCurrentProcess();
return 100 * currentProcess.PrivilegedProcessorTime.TotalMilliseconds /
                       currentProcess.TotalProcessorTime.TotalMilliseconds;

You should call the following method, passing 'true' as the first parameter, to use the sensor:

IDataCollector.InitializeProcessMonitoring(bool isCPU, bool isMemory, bool isThreads);

Process memory mb

The sensor collects current process working set into a bar. For Windows, the PerformanceCounter has the following parameters: categoryName = 'Process', counterName = 'Working set'. For other systems, the following C# code is used:

Process currentProcess = Process.GetCurrentProcess();
return currentProcess.WorkingSet64;

You should call the following method, passing 'true' as the second parameter, to use the sensor:

IDataCollector.InitializeProcessMonitoring(bool isCPU, bool isMemory, bool isThreads);

Process thread count

The sensor gets the amount of threads, associated with current process, and collects it into a bar. For Windows, the PerformanceCounter has the following parameters: categoryName = 'Process', counterName = 'Thread Count'. For other systems, the following C# code is used:

Process currentProcess = Process.GetCurrentProcess();
return currentProcess.Threads.Count;

You should call the following method, passing 'true' as the third parameter, to use the sensor:

IDataCollector.InitializeProcessMonitoring(bool isCPU, bool isMemory, bool isThreads);