Class: Opstat::Plugins::HpPdu
- Inherits:
-
Task
- Object
- Task
- Opstat::Plugins::HpPdu
- Defined in:
- lib/plugins/hp_pdu.rb
Instance Method Summary collapse
-
#initialize(name, queue, config) ⇒ HpPdu
constructor
A new instance of HpPdu.
- #parse ⇒ Object
Constructor Details
#initialize(name, queue, config) ⇒ HpPdu
Returns a new instance of HpPdu.
5 6 7 8 9 10 11 12 |
# File 'lib/plugins/hp_pdu.rb', line 5 def initialize (name, queue, config) super(name, queue, config) @snmp_host = config['snmp_host'] @snmp_port = config['snmp_port'] pwd = File.dirname(File.(__FILE__)) snmp_ids = YAML::load_file("#{pwd}/../data/hp_pdu.yml").keys.join(' ') @snmp_cmd = "snmpget -c public -v2c #{@snmp_host}:#{@snmp_port} #{snmp_ids}" end |
Instance Method Details
#parse ⇒ Object
14 15 16 17 18 19 |
# File 'lib/plugins/hp_pdu.rb', line 14 def parse snmpIO = IO.popen(@snmp_cmd) report = snmpIO.readlines.join snmpIO.close return report end |