Class: PCPEasy::Agent
- Inherits:
-
Object
- Object
- PCPEasy::Agent
- Defined in:
- lib/pcp_easy/agent.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
Instance Method Summary collapse
-
#initialize(host) ⇒ Agent
constructor
A new instance of Agent.
- #metric(name) ⇒ Object
- #metrics(names) ⇒ Object
Constructor Details
#initialize(host) ⇒ Agent
Returns a new instance of Agent.
8 9 10 |
# File 'lib/pcp_easy/agent.rb', line 8 def initialize(host) @host = host end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
6 7 8 |
# File 'lib/pcp_easy/agent.rb', line 6 def host @host end |
Instance Method Details
#metric(name) ⇒ Object
12 13 14 |
# File 'lib/pcp_easy/agent.rb', line 12 def metric(name) metrics([name]).first end |
#metrics(names) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/pcp_easy/agent.rb', line 16 def metrics(names) raise ArgumentError, "array required for metrics" unless names.is_a? Array pmids = pmapi.pmLookupName(names) pmids_names = Hash[pmids.zip(names)] pmapi.pmFetch(pmids).vset.collect {|v| metric_from_vset(v, pmids_names)} end |