Commit 1955eec8 authored by Alessio Netti's avatar Alessio Netti
Browse files

ProcFS tiny changes

- Fixed crash when sensor groups cannot be initialized
- Column metrics for each CPU in /proc/stat are now disambiguated from those found in other lines (like softirq) and they are defined with the "col_" prefix
parent 3a25db65
......@@ -497,16 +497,16 @@ Additionally, sensors in the ProcFS plugin (defined with the "metric" keyword) s
| perCpu | Boolean. If set to "on", the metric will be collected for each CPU core specified with the "cpus" sensor group parameter, or for all CPU cores if none is specified. Otherwise, the metric will be collected only at system level. This parameter has no effect on metrics that are not acquired at CPU core level (e.g. those in /proc/vmstat and /proc/meminfo).
The "type" field can be inferred for each sensor by simply checking the underlying file parsed by the sensor group. For /proc/stat files, on the other hand, CPU core-related metrics are collected in separate columns, which adopt the following naming scheme that can be used to define sensors:
* user
* nice
* system
* idle
* iowait
* irq
* softirq
* steal
* guest
* guest_nice
* col_user
* col_nice
* col_system
* col_idle
* col_iowait
* col_irq
* col_softirq
* col_steal
* col_guest
* col_guest_nice
Additional CPU-related metrics (that may be introduced in future versions of the Linux kernel) are not supported by the DCDB ProcFS plugin.
......
......@@ -5,13 +5,13 @@ mqttPrefix /FF112233445566778899AAB
template_file def1 {
interval 1000
minValues 3
mqttPart 00
mqttPart 000
mqttStart E0
}
file meminfo {
default def1
path /Users/di52bul/dcdb/meminfo
path /proc/meminfo
type meminfo
mqttPart E00
mqttStart 00
......@@ -19,26 +19,26 @@ mqttStart 00
metric MemFree {
type MemFree
mqttsuffix 36
skipConstVal true
skipConstVal on
}
metric AnonPages {
type AnonPages
mqttsuffix AA
skipConstVal true
skipConstVal on
}
metric Hugepagesize {
type Hugepagesize
mqttsuffix BB
skipConstVal true
skipConstVal on
}
}
file vmstat {
default def1
path /Users/di52bul/dcdb/vmstat
path /proc/vmstat
type vmstat
mqttPart D00
mqttStart 00
......@@ -46,56 +46,56 @@ mqttStart 00
metric nr_dirty_threshold {
type nr_dirty_threshold
mqttsuffix F0
skipConstVal true
skipConstVal on
}
metric nr_file_pages {
type nr_file_pages
mqttsuffix F1
skipConstVal true
skipConstVal on
}
metric nr_alloc_batch {
type nr_alloc_batch
mqttsuffix F2
skipConstVal true
skipConstVal on
}
}
file procstat {
default def1
path /Users/di52bul/dcdb/stat
path /proc/stat
type procstat
mqttPart C00
mqttStart 00
cpus 250,36
metric idle {
type idle
metric col_idle {
type col_idle
mqttsuffix 36
skipConstVal true
skipConstVal on
perCpu on
}
metric user {
type user
metric col_user {
type col_user
mqttsuffix 37
skipConstVal true
skipConstVal on
perCpu on
}
metric nice {
type nice
metric col_nice {
type col_nice
mqttsuffix 38
skipConstVal true
skipConstVal on
perCpu off
}
metric ctxt {
type ctxt
mqttsuffix 40
skipConstVal true
skipConstVal on
perCpu off
}
......
......@@ -122,7 +122,7 @@ protected:
boost::cmatch _match;
// The number of known metrics in each "cpu" line together with their names, as of Oct. 2018
enum { DEFAULTMETRICS = 10 };
const std::string DEFAULT_NAMES[DEFAULTMETRICS] = {"user", "nice", "system", "idle", "iowait", "irq", "softirq", "steal", "guest", "guest_nice"};
const std::string DEFAULT_NAMES[DEFAULTMETRICS] = {"col_user", "col_nice", "col_system", "col_idle", "col_iowait", "col_irq", "col_softirq", "col_steal", "col_guest", "col_guest_nice"};
// Regex to match strings beginning with the "cpu" keyword
// C strings that encode the prefixes of cpu-related lines
......
......@@ -21,7 +21,7 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> {
public:
// Constructor and destructor
ProcfsSensorGroup(const std::string& name) : SensorGroupTemplate(name) {}
ProcfsSensorGroup(const std::string& name) : SensorGroupTemplate(name) { this->_parser = NULL; }
virtual ~ProcfsSensorGroup();
// Methods inherited from SensorGroupTemplate
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment