|
MetroCollect
2.3.4
|
Sources of network metrics extracted from the file /proc/net/dev. More...
#include <SourceProcNetDev.h>


Public Member Functions | |
| size_t | fieldCount () const noexcept override final |
| Get the number of field the source has. More... | |
| const std::vector< size_t > | indexesOfFieldName (const FieldName &fieldName, Interests *interests=nullptr) const noexcept override final |
| Search for fields associated to a specific name. More... | |
| const std::string | fieldNameSourcePrefix () const noexcept override final |
| Get the prefix by which all field names should begin with. More... | |
| const FieldInfo | fieldInfoAtIndex (size_t index) const noexcept override final |
| Get details about a specific field. More... | |
| const std::vector< FieldInfo > | allFieldsInfo () const noexcept override final |
| Get all fields details, field which share a common name should appear only once. More... | |
| void | fetchData (const Interests &interests, DataArray::Iterator current) override final |
| Fetch the latest metrics. More... | |
| void | computeDiff (const Interests &interests, DiffArray::Iterator diff, DataArray::ConstIterator current, DataArray::ConstIterator previous, double factor=1) noexcept override final |
| Compute the variation (in appropriate unit) of metrics. More... | |
Public Member Functions inherited from MetroCollect::MetricsSource::SourceBase | |
| SourceBase (const SourceBase &)=delete | |
| Deleted copy constructor. More... | |
| void | operator= (const SourceBase &)=delete |
| Deleted copy operator. More... | |
Static Public Member Functions | |
| static SourceProcNetDev & | get () |
| Get the Instance object. More... | |
Protected Member Functions | |
| SourceProcNetDev () | |
| Private default constructor. More... | |
| void | parseFields () |
| File parser function. More... | |
Protected Member Functions inherited from MetroCollect::MetricsSource::SourceBase | |
| SourceBase () | |
| Protected default constructor. More... | |
| ~SourceBase () | |
| Protected default destructor. More... | |
Protected Attributes | |
| std::ifstream | file_ |
| File descriptor. More... | |
| std::vector< char > | buffer_ |
| Buffer to put file contents into. More... | |
| std::vector< std::string > | interfaces_ |
| Network interfaces names. More... | |
| std::vector< std::string > | rxFieldNames_ |
| Reception metric names. More... | |
| std::vector< std::string > | txFieldNames_ |
| Transmission metric names. More... | |
Static Protected Attributes | |
| static constexpr std::string_view | filePath = "/proc/1/net/dev"sv |
| Network metrics file path. More... | |
| static constexpr std::string_view | sourcePrefix = "network"sv |
| Metrics name source prefix. More... | |
| static constexpr std::string_view | fieldNameInterfaceDescription = "interface"sv |
| Metrics name category description. More... | |
| static constexpr std::string_view | fieldRecieve = "rx"sv |
| Metrics name category. More... | |
| static constexpr std::string_view | fieldTransmit = "tx"sv |
| Metrics name category. More... | |
| static constexpr std::string_view | fieldNameAll = "*"sv |
| Metrics name wildcard. More... | |
| static constexpr std::array | fieldUnitsAssociation = { KeyUnit{"bytes"sv, "bytes"sv}, KeyUnit{"packets"sv, "packets"sv}, KeyUnit{"compressed"sv, "packets"sv}, KeyUnit{"multicast"sv, "packets"sv} } |
| Metric units associations. More... | |
| static constexpr std::string_view | defaultUnit = "errors"sv |
| Metric unit. More... | |
Sources of network metrics extracted from the file /proc/net/dev.
Definition at line 38 of file SourceProcNetDev.h.
|
protected |
Private default constructor.
Definition at line 28 of file SourceProcNetDev.cc.

|
finaloverridevirtualnoexcept |
Get all fields details, field which share a common name should appear only once.
Implements MetroCollect::MetricsSource::SourceBase.
Definition at line 142 of file SourceProcNetDev.cc.

|
finaloverridevirtualnoexcept |
Compute the variation (in appropriate unit) of metrics.
| interests | interests boolean array to know for which fields metrics variation should be computed |
| diff | iterator to write metrics variation to |
| current | iterator to read latest metrics from |
| previous | iterator to read previous metrics from |
| factor | factor to convert to unit per second, if relevant |
Implements MetroCollect::MetricsSource::SourceBase.
Definition at line 183 of file SourceProcNetDev.cc.
|
finaloverridevirtual |
Fetch the latest metrics.
| interests | boolean array to know for which fields metrics should be fetched |
| current | iterator to write metrics to |
Implements MetroCollect::MetricsSource::SourceBase.
Definition at line 152 of file SourceProcNetDev.cc.

|
finaloverridevirtualnoexcept |
Get the number of field the source has.
Implements MetroCollect::MetricsSource::SourceBase.
Definition at line 82 of file SourceProcNetDev.cc.

|
finaloverridevirtualnoexcept |
Get details about a specific field.
| index | index of the field to get details of |
Implements MetroCollect::MetricsSource::SourceBase.
Definition at line 129 of file SourceProcNetDev.cc.


|
finaloverridevirtualnoexcept |
Get the prefix by which all field names should begin with.
Implements MetroCollect::MetricsSource::SourceBase.
Definition at line 125 of file SourceProcNetDev.cc.
|
inlinestatic |
Get the Instance object.
Definition at line 63 of file SourceProcNetDev.h.
|
finaloverridevirtualnoexcept |
Search for fields associated to a specific name.
| fieldName | the name of the fields to search |
| interests | if the pointer is not nullptr, the interest bit corresponding to the fields will be set |
Implements MetroCollect::MetricsSource::SourceBase.
Definition at line 86 of file SourceProcNetDev.cc.
|
protected |
File parser function.
Definition at line 34 of file SourceProcNetDev.cc.


|
protected |
Buffer to put file contents into.
Definition at line 51 of file SourceProcNetDev.h.
|
staticprotected |
Metric unit.
Definition at line 48 of file SourceProcNetDev.h.
|
staticprotected |
Metrics name wildcard.
Definition at line 46 of file SourceProcNetDev.h.
|
staticprotected |
Metrics name category description.
Definition at line 43 of file SourceProcNetDev.h.
|
staticprotected |
Metrics name category.
Definition at line 44 of file SourceProcNetDev.h.
|
staticprotected |
Metrics name category.
Definition at line 45 of file SourceProcNetDev.h.
|
staticprotected |
Metric units associations.
Definition at line 47 of file SourceProcNetDev.h.
|
protected |
File descriptor.
Definition at line 50 of file SourceProcNetDev.h.
|
staticprotected |
Network metrics file path.
Definition at line 40 of file SourceProcNetDev.h.
|
protected |
Network interfaces names.
Definition at line 52 of file SourceProcNetDev.h.
|
protected |
Reception metric names.
Definition at line 53 of file SourceProcNetDev.h.
|
staticprotected |
Metrics name source prefix.
Definition at line 42 of file SourceProcNetDev.h.
|
protected |
Transmission metric names.
Definition at line 54 of file SourceProcNetDev.h.