Class: Riemann::Tools::Hwmon::Device
- Inherits:
-
Object
- Object
- Riemann::Tools::Hwmon::Device
- Defined in:
- lib/riemann/tools/hwmon.rb
Instance Attribute Summary collapse
-
#crit ⇒ Object
readonly
Returns the value of attribute crit.
-
#hwmon ⇒ Object
readonly
Returns the value of attribute hwmon.
-
#lcrit ⇒ Object
readonly
Returns the value of attribute lcrit.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(hwmon, type, number) ⇒ Device
constructor
A new instance of Device.
- #input ⇒ Object
- #report ⇒ Object
Constructor Details
#initialize(hwmon, type, number) ⇒ Device
Returns a new instance of Device.
14 15 16 17 18 19 20 21 22 |
# File 'lib/riemann/tools/hwmon.rb', line 14 def initialize(hwmon, type, number) @hwmon = hwmon @type = type @number = number @crit = scale(read_hwmon_i('crit')) @lcrit = scale(read_hwmon_i('lcrit')) @service = ['hwmon', read_hwmon_file('name'), read_hwmon_s('label')].compact.join(' ') end |
Instance Attribute Details
#crit ⇒ Object (readonly)
Returns the value of attribute crit.
12 13 14 |
# File 'lib/riemann/tools/hwmon.rb', line 12 def crit @crit end |
#hwmon ⇒ Object (readonly)
Returns the value of attribute hwmon.
12 13 14 |
# File 'lib/riemann/tools/hwmon.rb', line 12 def hwmon @hwmon end |
#lcrit ⇒ Object (readonly)
Returns the value of attribute lcrit.
12 13 14 |
# File 'lib/riemann/tools/hwmon.rb', line 12 def lcrit @lcrit end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
12 13 14 |
# File 'lib/riemann/tools/hwmon.rb', line 12 def number @number end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
12 13 14 |
# File 'lib/riemann/tools/hwmon.rb', line 12 def service @service end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
12 13 14 |
# File 'lib/riemann/tools/hwmon.rb', line 12 def type @type end |
Instance Method Details
#input ⇒ Object
24 25 26 |
# File 'lib/riemann/tools/hwmon.rb', line 24 def input read_hwmon_i('input') end |
#report ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/riemann/tools/hwmon.rb', line 28 def report value = scale(input) state = :ok state = :critical if crit && value >= crit state = :critical if lcrit && value <= lcrit { service: service, state: state, metric: value, description: fromat_input(value), } end |