Class: Zabbix::Reader
- Inherits:
-
Object
- Object
- Zabbix::Reader
- Defined in:
- lib/zabbix/reader.rb
Overview
The Zabbix::Reader
object used to get values from the monitor file
Instance Method Summary collapse
-
#get_value(key) ⇒ String
Get a value from the Zabbix monitor file.
-
#initialize ⇒ Reader
constructor
A new instance of Reader.
Constructor Details
#initialize ⇒ Reader
Returns a new instance of Reader.
8 9 10 11 12 |
# File 'lib/zabbix/reader.rb', line 8 def initialize filename = 'tmp/zabbix-stats.yml' raise FileNotFoundError, 'Monitoring file not found' if !File.exists?(filename) @file = YAML.load_file(filename) end |
Instance Method Details
#get_value(key) ⇒ String
Get a value from the Zabbix monitor file
19 20 21 |
# File 'lib/zabbix/reader.rb', line 19 def get_value key @file['statistics'][key] end |