Sha256: e3e7ffe8ee0b4a233b554f395e79ab8a18c0732255e4b831a5caa075c42a2c6e
Contents?: true
Size: 1007 Bytes
Versions: 3
Compression:
Stored size: 1007 Bytes
Contents
#! /usr/bin/env ruby # # check-windows-cpu-load.rb # # DESCRIPTION: # # OUTPUT: # plain text # # PLATFORMS: # Windows # # DEPENDENCIES: # gem: sensu-plugin # # USAGE: # # NOTES: # Tested on Windows 2008RC2. # # LICENSE: # Jean-Francois Theroux <me@failshell.io> # Released under the same terms as Sensu (the MIT license); see LICENSE # for details. # require 'sensu-plugin/check/cli' # # Check Windows CPU Load # class CheckWindowsCpuLoad < Sensu::Plugin::Check::CLI option :warning, short: '-w WARNING', default: 85, proc: proc(&:to_i) option :critical, short: '-c CRITICAL', default: 95, proc: proc(&:to_i) def run io = IO.popen("typeperf -sc 1 \"processor(_total)\\% processor time\"") cpu_load = io.readlines[2].split(',')[1].gsub(/"/, '').to_i critical "CPU at #{cpu_load}%" if cpu_load > config[:critical] warning "CPU at #{cpu_load}%" if cpu_load > config[:warning] ok "CPU at #{cpu_load}%" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sensu-plugins-windows-0.0.8 | bin/check-windows-cpu-load.rb |
sensu-plugins-windows-0.0.7 | bin/check-windows-cpu-load.rb |
sensu-plugins-windows-0.0.6 | bin/check-windows-cpu-load.rb |