mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-12-03 15:31:05 +01:00
softnet: additionals metrics from softnet_data, (#2592)
* softnet: additionals metrics from softnet_data, https://github.com/prometheus/procfs/pull/473 --------- Signed-off-by: remi <remijouannet@gmail.com> Signed-off-by: Rémi Jouannet <remijouannet@gmail.com>
This commit is contained in:
parent
c05b97ce32
commit
df1b53bee2
@ -3040,18 +3040,42 @@ node_softirqs_total{vector="rcu"} 508444
|
|||||||
node_softirqs_total{vector="sched"} 622196
|
node_softirqs_total{vector="sched"} 622196
|
||||||
node_softirqs_total{vector="tasklet"} 1.783454e+06
|
node_softirqs_total{vector="tasklet"} 1.783454e+06
|
||||||
node_softirqs_total{vector="timer"} 1.481983e+06
|
node_softirqs_total{vector="timer"} 1.481983e+06
|
||||||
|
# HELP node_softnet_backlog_len Softnet backlog status
|
||||||
|
# TYPE node_softnet_backlog_len gauge
|
||||||
|
node_softnet_backlog_len{cpu="0"} 0
|
||||||
|
node_softnet_backlog_len{cpu="1"} 0
|
||||||
|
node_softnet_backlog_len{cpu="2"} 0
|
||||||
|
node_softnet_backlog_len{cpu="3"} 0
|
||||||
|
# HELP node_softnet_cpu_collision_total Number of collision occur while obtaining device lock while transmitting
|
||||||
|
# TYPE node_softnet_cpu_collision_total counter
|
||||||
|
node_softnet_cpu_collision_total{cpu="0"} 0
|
||||||
|
node_softnet_cpu_collision_total{cpu="1"} 0
|
||||||
|
node_softnet_cpu_collision_total{cpu="2"} 0
|
||||||
|
node_softnet_cpu_collision_total{cpu="3"} 0
|
||||||
# HELP node_softnet_dropped_total Number of dropped packets
|
# HELP node_softnet_dropped_total Number of dropped packets
|
||||||
# TYPE node_softnet_dropped_total counter
|
# TYPE node_softnet_dropped_total counter
|
||||||
node_softnet_dropped_total{cpu="0"} 0
|
node_softnet_dropped_total{cpu="0"} 0
|
||||||
node_softnet_dropped_total{cpu="1"} 41
|
node_softnet_dropped_total{cpu="1"} 41
|
||||||
node_softnet_dropped_total{cpu="2"} 0
|
node_softnet_dropped_total{cpu="2"} 0
|
||||||
node_softnet_dropped_total{cpu="3"} 0
|
node_softnet_dropped_total{cpu="3"} 0
|
||||||
|
# HELP node_softnet_flow_limit_count_total Number of times flow limit has been reached
|
||||||
|
# TYPE node_softnet_flow_limit_count_total counter
|
||||||
|
node_softnet_flow_limit_count_total{cpu="0"} 0
|
||||||
|
node_softnet_flow_limit_count_total{cpu="1"} 0
|
||||||
|
node_softnet_flow_limit_count_total{cpu="2"} 0
|
||||||
|
node_softnet_flow_limit_count_total{cpu="3"} 0
|
||||||
# HELP node_softnet_processed_total Number of processed packets
|
# HELP node_softnet_processed_total Number of processed packets
|
||||||
# TYPE node_softnet_processed_total counter
|
# TYPE node_softnet_processed_total counter
|
||||||
node_softnet_processed_total{cpu="0"} 299641
|
node_softnet_processed_total{cpu="0"} 299641
|
||||||
node_softnet_processed_total{cpu="1"} 916354
|
node_softnet_processed_total{cpu="1"} 916354
|
||||||
node_softnet_processed_total{cpu="2"} 5.577791e+06
|
node_softnet_processed_total{cpu="2"} 5.577791e+06
|
||||||
node_softnet_processed_total{cpu="3"} 3.113785e+06
|
node_softnet_processed_total{cpu="3"} 3.113785e+06
|
||||||
|
# HELP node_softnet_received_rps_total Number of times cpu woken up received_rps
|
||||||
|
# TYPE node_softnet_received_rps_total counter
|
||||||
|
node_softnet_received_rps_total{cpu="0"} 0
|
||||||
|
node_softnet_received_rps_total{cpu="1"} 0
|
||||||
|
node_softnet_received_rps_total{cpu="2"} 0
|
||||||
|
node_softnet_received_rps_total{cpu="3"} 0
|
||||||
# HELP node_softnet_times_squeezed_total Number of times processing packets ran out of quota
|
# HELP node_softnet_times_squeezed_total Number of times processing packets ran out of quota
|
||||||
# TYPE node_softnet_times_squeezed_total counter
|
# TYPE node_softnet_times_squeezed_total counter
|
||||||
node_softnet_times_squeezed_total{cpu="0"} 1
|
node_softnet_times_squeezed_total{cpu="0"} 1
|
||||||
|
@ -3062,18 +3062,42 @@ node_softirqs_total{vector="rcu"} 508444
|
|||||||
node_softirqs_total{vector="sched"} 622196
|
node_softirqs_total{vector="sched"} 622196
|
||||||
node_softirqs_total{vector="tasklet"} 1.783454e+06
|
node_softirqs_total{vector="tasklet"} 1.783454e+06
|
||||||
node_softirqs_total{vector="timer"} 1.481983e+06
|
node_softirqs_total{vector="timer"} 1.481983e+06
|
||||||
|
# HELP node_softnet_backlog_len Softnet backlog status
|
||||||
|
# TYPE node_softnet_backlog_len gauge
|
||||||
|
node_softnet_backlog_len{cpu="0"} 0
|
||||||
|
node_softnet_backlog_len{cpu="1"} 0
|
||||||
|
node_softnet_backlog_len{cpu="2"} 0
|
||||||
|
node_softnet_backlog_len{cpu="3"} 0
|
||||||
|
# HELP node_softnet_cpu_collision_total Number of collision occur while obtaining device lock while transmitting
|
||||||
|
# TYPE node_softnet_cpu_collision_total counter
|
||||||
|
node_softnet_cpu_collision_total{cpu="0"} 0
|
||||||
|
node_softnet_cpu_collision_total{cpu="1"} 0
|
||||||
|
node_softnet_cpu_collision_total{cpu="2"} 0
|
||||||
|
node_softnet_cpu_collision_total{cpu="3"} 0
|
||||||
# HELP node_softnet_dropped_total Number of dropped packets
|
# HELP node_softnet_dropped_total Number of dropped packets
|
||||||
# TYPE node_softnet_dropped_total counter
|
# TYPE node_softnet_dropped_total counter
|
||||||
node_softnet_dropped_total{cpu="0"} 0
|
node_softnet_dropped_total{cpu="0"} 0
|
||||||
node_softnet_dropped_total{cpu="1"} 41
|
node_softnet_dropped_total{cpu="1"} 41
|
||||||
node_softnet_dropped_total{cpu="2"} 0
|
node_softnet_dropped_total{cpu="2"} 0
|
||||||
node_softnet_dropped_total{cpu="3"} 0
|
node_softnet_dropped_total{cpu="3"} 0
|
||||||
|
# HELP node_softnet_flow_limit_count_total Number of times flow limit has been reached
|
||||||
|
# TYPE node_softnet_flow_limit_count_total counter
|
||||||
|
node_softnet_flow_limit_count_total{cpu="0"} 0
|
||||||
|
node_softnet_flow_limit_count_total{cpu="1"} 0
|
||||||
|
node_softnet_flow_limit_count_total{cpu="2"} 0
|
||||||
|
node_softnet_flow_limit_count_total{cpu="3"} 0
|
||||||
# HELP node_softnet_processed_total Number of processed packets
|
# HELP node_softnet_processed_total Number of processed packets
|
||||||
# TYPE node_softnet_processed_total counter
|
# TYPE node_softnet_processed_total counter
|
||||||
node_softnet_processed_total{cpu="0"} 299641
|
node_softnet_processed_total{cpu="0"} 299641
|
||||||
node_softnet_processed_total{cpu="1"} 916354
|
node_softnet_processed_total{cpu="1"} 916354
|
||||||
node_softnet_processed_total{cpu="2"} 5.577791e+06
|
node_softnet_processed_total{cpu="2"} 5.577791e+06
|
||||||
node_softnet_processed_total{cpu="3"} 3.113785e+06
|
node_softnet_processed_total{cpu="3"} 3.113785e+06
|
||||||
|
# HELP node_softnet_received_rps_total Number of times cpu woken up received_rps
|
||||||
|
# TYPE node_softnet_received_rps_total counter
|
||||||
|
node_softnet_received_rps_total{cpu="0"} 0
|
||||||
|
node_softnet_received_rps_total{cpu="1"} 0
|
||||||
|
node_softnet_received_rps_total{cpu="2"} 0
|
||||||
|
node_softnet_received_rps_total{cpu="3"} 0
|
||||||
# HELP node_softnet_times_squeezed_total Number of times processing packets ran out of quota
|
# HELP node_softnet_times_squeezed_total Number of times processing packets ran out of quota
|
||||||
# TYPE node_softnet_times_squeezed_total counter
|
# TYPE node_softnet_times_squeezed_total counter
|
||||||
node_softnet_times_squeezed_total{cpu="0"} 1
|
node_softnet_times_squeezed_total{cpu="0"} 1
|
||||||
|
@ -30,6 +30,10 @@ type softnetCollector struct {
|
|||||||
processed *prometheus.Desc
|
processed *prometheus.Desc
|
||||||
dropped *prometheus.Desc
|
dropped *prometheus.Desc
|
||||||
timeSqueezed *prometheus.Desc
|
timeSqueezed *prometheus.Desc
|
||||||
|
cpuCollision *prometheus.Desc
|
||||||
|
receivedRps *prometheus.Desc
|
||||||
|
flowLimitCount *prometheus.Desc
|
||||||
|
softnetBacklogLen *prometheus.Desc
|
||||||
logger log.Logger
|
logger log.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,19 +69,41 @@ func NewSoftnetCollector(logger log.Logger) (Collector, error) {
|
|||||||
"Number of times processing packets ran out of quota",
|
"Number of times processing packets ran out of quota",
|
||||||
[]string{"cpu"}, nil,
|
[]string{"cpu"}, nil,
|
||||||
),
|
),
|
||||||
|
cpuCollision: prometheus.NewDesc(
|
||||||
|
prometheus.BuildFQName(namespace, softnetSubsystem, "cpu_collision_total"),
|
||||||
|
"Number of collision occur while obtaining device lock while transmitting",
|
||||||
|
[]string{"cpu"}, nil,
|
||||||
|
),
|
||||||
|
receivedRps: prometheus.NewDesc(
|
||||||
|
prometheus.BuildFQName(namespace, softnetSubsystem, "received_rps_total"),
|
||||||
|
"Number of times cpu woken up received_rps",
|
||||||
|
[]string{"cpu"}, nil,
|
||||||
|
),
|
||||||
|
flowLimitCount: prometheus.NewDesc(
|
||||||
|
prometheus.BuildFQName(namespace, softnetSubsystem, "flow_limit_count_total"),
|
||||||
|
"Number of times flow limit has been reached",
|
||||||
|
[]string{"cpu"}, nil,
|
||||||
|
),
|
||||||
|
softnetBacklogLen: prometheus.NewDesc(
|
||||||
|
prometheus.BuildFQName(namespace, softnetSubsystem, "backlog_len"),
|
||||||
|
"Softnet backlog status",
|
||||||
|
[]string{"cpu"}, nil,
|
||||||
|
),
|
||||||
logger: logger,
|
logger: logger,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update gets parsed softnet statistics using procfs.
|
// Update gets parsed softnet statistics using procfs.
|
||||||
func (c *softnetCollector) Update(ch chan<- prometheus.Metric) error {
|
func (c *softnetCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
|
var cpu string
|
||||||
|
|
||||||
stats, err := c.fs.NetSoftnetStat()
|
stats, err := c.fs.NetSoftnetStat()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not get softnet statistics: %w", err)
|
return fmt.Errorf("could not get softnet statistics: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for cpuNumber, cpuStats := range stats {
|
for _, cpuStats := range stats {
|
||||||
cpu := strconv.Itoa(cpuNumber)
|
cpu = strconv.FormatUint(uint64(cpuStats.Index), 10)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.processed,
|
c.processed,
|
||||||
@ -97,6 +123,30 @@ func (c *softnetCollector) Update(ch chan<- prometheus.Metric) error {
|
|||||||
float64(cpuStats.TimeSqueezed),
|
float64(cpuStats.TimeSqueezed),
|
||||||
cpu,
|
cpu,
|
||||||
)
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.cpuCollision,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
float64(cpuStats.CPUCollision),
|
||||||
|
cpu,
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.receivedRps,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
float64(cpuStats.ReceivedRps),
|
||||||
|
cpu,
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.flowLimitCount,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
float64(cpuStats.FlowLimitCount),
|
||||||
|
cpu,
|
||||||
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.softnetBacklogLen,
|
||||||
|
prometheus.GaugeValue,
|
||||||
|
float64(cpuStats.SoftnetBacklogLen),
|
||||||
|
cpu,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user