sensu-plugins/sensu-plugins-cpu-checks

View on GitHub
bin/metrics-cpu-softirqs.rb

Summary

Maintainability
A
45 mins
Test Coverage
#! /usr/bin/env ruby
#
#   metrics-cpu-softirqs
#
# DESCRIPTION:
#
# OUTPUT:
#   metric data
#
# PLATFORMS:
#   Linux
#
# DEPENDENCIES:
#   gem: sensu-plugin
#
# USAGE:
#
# NOTES:
#
# LICENSE:
#   Zubov Yuri <yury.zubau@gmail.com> sponsored by Actility, https://www.actility.com
#   Released under the same terms as Sensu (the MIT license); see LICENSE
#   for details.
#
require 'sensu-plugin/metric/cli'
require 'sensu-plugins-cpu-checks'
require 'socket'

#
# CPU Graphite
#
class MetricsCPUSoftirqs < Sensu::Plugin::Metric::CLI::Graphite
  include SensuPluginsCpuChecks::CommonInterrupts
  option :scheme,
         description: 'Metric naming scheme, text to prepend to metric',
         short: '-s SCHEME',
         long: '--scheme SCHEME',
         default: "#{Socket.gethostname}.softirqs"

  option :proc_path,
         long: '--proc-path /proc',
         proc: proc(&:to_s),
         default: '/proc'

  def run
    output_metrics('softirqs')
    ok
  end
end