sensu-plugins / sensu-plugins-cpu-checks

This plugin provides native CPU instrumentation for monitoring and metrics collection, including: CPU usage and metrics for user, nice, system, idle, iowait, irq, softirq, steal, and guest.
http://sensu-plugins.io
MIT License
13 stars 34 forks source link

Inaccurate interrupts stat #19

Open eberkut opened 7 years ago

eberkut commented 7 years ago

I think there's an issue with the reporting of interrupts from metrics-cpu.rb.

As per https://www.kernel.org/doc/Documentation/filesystems/proc.txt (section 1.8):

The "intr" line gives counts of interrupts serviced since boot time, for each of the possible system interrupts. The first column is the total of all interrupts serviced including unnumbered architecture specific interrupts; each subsequent column is the total for that particular numbered interrupt.

However, in the metrics check

output "#{config[:scheme]}.#{name}", info.last if other_metrics.include? name

This will return the last element of the array for each stat including intr. However, for intr the total is actually the first element. The last column is just the total for a given interrupt (which can actually vary between platform).

Using sensu-plugins-cpu-checks 1.0.0.

majormoses commented 7 years ago

@eberkut would you be willing to put togethor a pr for a fix?