Class: NewRelic::IA::IostatReader
- Inherits:
-
Object
- Object
- NewRelic::IA::IostatReader
- Includes:
- MetricNames
- Defined in:
- lib/new_relic/ia/iostat_reader.rb
Overview
The iostat reader simply opens a pipe on the iostat command, listening every 15 seconds and taking a sample for RPM. It runs on the thread of the caller of the #run method.
There are implementations of the command reader for different platforms. The implementations are in modules which are included into the Monitor class.
Defined Under Namespace
Constant Summary
Constants included from MetricNames
MetricNames::DISK, MetricNames::DISK_IO, MetricNames::MEMCACHED, MetricNames::SYSTEM_CPU, MetricNames::USER_CPU
Instance Attribute Summary collapse
-
#io_stats ⇒ Object
readonly
Returns the value of attribute io_stats.
-
#system_cpu ⇒ Object
readonly
Returns the value of attribute system_cpu.
-
#user_cpu ⇒ Object
readonly
Returns the value of attribute user_cpu.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ IostatReader
constructor
A new instance of IostatReader.
- #log ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize ⇒ IostatReader
Returns a new instance of IostatReader.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/new_relic/ia/iostat_reader.rb', line 13 def initialize stats_engine = NewRelic::Agent.instance.stats_engine @io_stats = stats_engine.get_stats(DISK_IO, false) # Usage in MB @system_cpu = stats_engine.get_stats(SYSTEM_CPU, false) # percentage utilization @user_cpu = stats_engine.get_stats(USER_CPU, false) # percentage utilization # Open the iostat reporting every 15 seconds cumulative # values for disk transfers and cpu utilization @pipe = IO.popen(cmd) end |
Instance Attribute Details
#io_stats ⇒ Object (readonly)
Returns the value of attribute io_stats.
12 13 14 |
# File 'lib/new_relic/ia/iostat_reader.rb', line 12 def io_stats @io_stats end |
#system_cpu ⇒ Object (readonly)
Returns the value of attribute system_cpu.
12 13 14 |
# File 'lib/new_relic/ia/iostat_reader.rb', line 12 def system_cpu @system_cpu end |
#user_cpu ⇒ Object (readonly)
Returns the value of attribute user_cpu.
12 13 14 |
# File 'lib/new_relic/ia/iostat_reader.rb', line 12 def user_cpu @user_cpu end |
Class Method Details
Instance Method Details
#log ⇒ Object
28 29 30 |
# File 'lib/new_relic/ia/iostat_reader.rb', line 28 def log self.class.log end |
#run ⇒ Object
43 44 45 46 |
# File 'lib/new_relic/ia/iostat_reader.rb', line 43 def run init read_next while true end |