obmon  1.3.1
 All Classes Functions Variables Typedefs Enumerations Groups Pages
ObSensorSystem Class Reference

System Obmon sensor class. More...

#include <ObSensorSystem.h>

Inheritance diagram for ObSensorSystem:
ObSensor

Classes

struct  DiskInfo
 

Public Types

enum  SensorType { NONE, VALUE, SPEED, IGNORE }
 Enums for sensor type.
 

Public Member Functions

 ObSensorSystem (std::string name={"sys"})
 
virtual ~ObSensorSystem () override
 
bool init () override
 
void process () override
 Process function. More...
 
void speed (ObSensor *s1, ObSensor *s2, unsigned int timeout=1000) override
 Calculate time change (speed) More...
 
std::string json (const std::string name={"static"}) const override
 
glibtop_cpu cpu () const
 returns glibtop_cpu
 
glibtop_mem mem () const
 returns glibtop_mem
 
glibtop_netlist netlist () const
 returns glibtop_netlist
 
std::vector< glibtop_netload * > netloads () const
 returns netloads
 
std::map< std::string, DiskInfodisks () const
 
virtual void update (unsigned int timeout) final
 
std::string name () const
 Returns name of sensor.
 
void type (SensorType t)
 Sets sensor type.
 
SensorType type () const
 Returns sensor type.
 
void enabled (bool e)
 Sets flag if sensor is enabled.
 
bool enabled () const
 Returns flag if sensor is enabled.
 
std::vector< ObSensor * > & sensors ()
 Return list of sensors.
 

Protected Attributes

std::shared_ptr< spdlog::logger > _logger
 Pointer to spd logger.
 
std::string _name
 Sensor name.
 
SensorType _type = SensorType::NONE
 Sensor type.
 
bool _enabled
 Is enabled.
 
ObSensor_first {}
 Pointer to first sensor.
 
ObSensor_second {}
 Pointer to second sensor.
 
ObSensor_change {}
 Pointer to change sensor.
 
std::vector< ObSensor * > _sensors {}
 List of subsensors.
 

Private Member Functions

uint64_t sz_MiB_kiB_ (unsigned long long mib)
 

Private Attributes

glibtop * _sysinfo
 Sys info from glitop.
 
glibtop_cpu _cpu {}
 CPU info from glitop.
 
glibtop_mem _mem {}
 Mem info from glitop.
 
glibtop_loadavg _loadavg {}
 Load average info from glibtop.
 
glibtop_netlist _netlist {}
 NetList from glitop.
 
std::vector< glibtop_netload * > _netloads {}
 List of netload.
 
std::vector< std::string > _netnames {}
 list of network names
 
std::vector< std::pair
< std::string, bool > > 
allowedDisks {}
 
std::map< std::string, DiskInfodiskInfos {}
 
std::vector< std::string > allowedNICs {}
 
double maxDiskSpeed = static_cast<double>(sz_MiB_kiB_(100))
 

Detailed Description

System Obmon sensor class.

Author
Martin Vala mvala.nosp@m.@cer.nosp@m.n.ch

Definition at line 35 of file ObSensorSystem.h.

Constructor & Destructor Documentation

ObSensorSystem::ObSensorSystem ( std::string  name = {"sys"})

Constructor

Definition at line 6 of file ObSensorSystem.cpp.

References ObSensor::_logger, _netlist, _netloads, _netnames, and _sysinfo.

Referenced by init().

ObSensorSystem::~ObSensorSystem ( )
overridevirtual

Destructor

Definition at line 96 of file ObSensorSystem.cpp.

References _netloads.

Member Function Documentation

bool ObSensorSystem::init ( )
overridevirtual

Init sensor function

Reimplemented from ObSensor.

Definition at line 105 of file ObSensorSystem.cpp.

References ObSensor::_change, ObSensor::_first, ObSensor::_second, and ObSensorSystem().

std::string ObSensorSystem::json ( const std::string  name = {"static"}) const
overridevirtual

Returns current sensor representation in json format

Reimplemented from ObSensor.

Definition at line 290 of file ObSensorSystem.cpp.

References _cpu, _loadavg, _mem, _netloads, _netnames, _sysinfo, and ObSensor::type().

void ObSensorSystem::process ( )
overridevirtual

Process function.

Process sensor function

Reimplemented from ObSensor.

Definition at line 117 of file ObSensorSystem.cpp.

References _cpu, _loadavg, ObSensor::_logger, _mem, _netloads, and _netnames.

void ObSensorSystem::speed ( ObSensor ,
ObSensor ,
unsigned int  = 1000 
)
overridevirtual

Calculate time change (speed)

Calculate change over time (speed)

Reimplemented from ObSensor.

Definition at line 223 of file ObSensorSystem.cpp.

References _cpu, _mem, _netloads, _netnames, cpu(), mem(), and netloads().

void ObSensor::update ( unsigned int  timeout)
finalvirtualinherited

Update sensor function

Definition at line 33 of file ObSensor.cpp.

References ObSensor::_first, ObSensor::_second, ObSensor::_sensors, ObSensor::enabled(), and ObSensor::type().


The documentation for this class was generated from the following files: