Created
December 9, 2015 15:11
-
-
Save anonymous/e9599aacc738c4ea613d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# encoding: UTF-8 | |
# | |
# check-environmentals | |
# | |
# DESCRIPTION: | |
# Send a Warning message if an environmental sensor is | |
# more than the warning threshold. | |
# Send a critical message if sensor is beyond critical threshold. | |
# Event is sent on first match. So if multiple environmental sensors | |
# could trigger event, only the first found event will be seen in | |
# the trigger event output | |
# Send an event if minimum number of working fans is | |
# less than --min-fans | |
# | |
# OUTPUT: | |
# plain text | |
# | |
# PLATFORMS: | |
# Cumulus Linux | |
# | |
# DEPENDENCIES: | |
# gem: sensu-plugin | |
# | |
# USAGE: | |
# Set warning threshold to 85% and critical threshold to 97% | |
# So if the max Fan speed is 12000 RPM and current fan speed is 11900 RPM | |
# a critical event is sent because current fan speed is | |
# greater than 97% of max recommended fan speed. | |
# Minimum number of fans working is 2. anything lower i | |
# and an alert is issued. | |
# ./check-environmentals -w 85 -c 97 --min-fans 2 | |
# | |
# | |
# NOTES: | |
# | |
# LICENSE: | |
# Copyright 2015 Cumulus Networks | |
# Released under the same terms as Sensu (the MIT license); see LICENSE | |
# for details. | |
# | |
require 'rubygems' if RUBY_VERSION < '1.9.0' | |
require 'sensu-plugin/check/cli' | |
class CheckRAM < Sensu::Plugin::Check::CLI | |
option :warn, | |
short: '-w WARN', | |
proc: proc(&:to_i), | |
default: 90 | |
option :crit, | |
short: '-c CRIT', | |
proc: proc(&:to_i), | |
default: 95 | |
option :min_fans, | |
short: '-f CRIT', | |
long: '--min-fans' | |
proc: proc(&:to_i), | |
default: 2 | |
def send_event(env_results) | |
end | |
def check_fan(env_fan) | |
end | |
def check_temp(env_temp) | |
end | |
def check_psu(env_temp) | |
end | |
def run | |
@env_fan = [] | |
@env_temp = [] | |
check_fan(@env_fan) | |
check_temp(@env_temp) | |
check_psu(@env_temp) | |
ok | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment