-
Notifications
You must be signed in to change notification settings - Fork 0
4.5.1 Sensor Plugin API
The sensor plugin API is defined in the orcm/common/udsensors.h
header file, which is installed along with the rest of the headers of the project. The UDSensor
class is the abstract base class that should be extended and implemented by all the newly-developed plugins. Currently, three methods are available for implementation:
The init function will be called in the initialization process of the plugin. Here is the place where the setup is performed, e. g. look for some resource if it's available, check existance of sysfs entries, etc.
The finalize function is called when shutdown process of the sensor has started. This can happen when a disable procedure has been called from the SenSys monitoring system.
The sample function is the responsible to gather the sensor samples. The SenSys Monitoring system will call this function in the sample-rate configured for the entire system. A dataContainer
object is passed as reference to this function to be populated with the desired samples. For example, to store an integer and a float value into the dataContainer object the user should implement the following:
void sample(dataContainer &cnt) {
cnt.put("MyIntValue", 10, "ints");
cnt.put("MyFloatValue", 3.1415, "floats");
}
It is important to note that SenSys expects that the sampling procedure do not take much time to complete, in order to avoid delays in other sensor sampling functions.
The dataContainer
is a hash map of <key, value>
pairs. The key
of an item in the hash map uniquely identifies the data item, and value
is the actual data with an associated unit. For instance, one data item could be the coretemp of core 1 of node 1 in Celsius. The following naming convention is suggested for key
: udsensors_<plugin name>_<metric name>
. See reference for details on the dataContainer
class.