Class: Bipbip::Plugin::PhpApc
- Inherits:
-
Bipbip::Plugin
- Object
- Bipbip::Plugin
- Bipbip::Plugin::PhpApc
- Defined in:
- lib/bipbip/plugin/php_apc.rb
Instance Attribute Summary
Attributes inherited from Bipbip::Plugin
#config, #metric_group, #name, #pid
Instance Method Summary collapse
Methods inherited from Bipbip::Plugin
factory, #frequency, #initialize, #interrupt, #interrupted?, #metrics_names, #run, #source_identifier
Methods included from InterruptibleSleep
#interrupt_sleep, #interruptible_sleep
Constructor Details
This class inherits a constructor from Bipbip::Plugin
Instance Method Details
#metrics_schema ⇒ Object
5 6 7 8 9 10 |
# File 'lib/bipbip/plugin/php_apc.rb', line 5 def metrics_schema [ {:name => 'opcode_mem_size', :type => 'gauge', :unit => 'b'}, {:name => 'user_mem_size', :type => 'gauge', :unit => 'b'}, ] end |
#monitor ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/bipbip/plugin/php_apc.rb', line 12 def monitor uri = URI.parse(config['url']) response = Net::HTTP.get_response(uri) raise "Invalid response from server at #{config['url']}" unless response.code == '200' stats = JSON.parse(response.body) {:opcode_mem_size => stats['opcode_mem_size'].to_i, :user_mem_size => stats['user_mem_size'].to_i} end |