Class: Fluent::TDMonitorAgentInput::DiskStat
- Inherits:
-
Object
- Object
- Fluent::TDMonitorAgentInput::DiskStat
- Defined in:
- lib/fluent/plugin/in_td_monitor_agent.rb
Instance Method Summary collapse
-
#initialize(paths) ⇒ DiskStat
constructor
A new instance of DiskStat.
- #stats ⇒ Object
Constructor Details
#initialize(paths) ⇒ DiskStat
Returns a new instance of DiskStat.
341 342 343 344 |
# File 'lib/fluent/plugin/in_td_monitor_agent.rb', line 341 def initialize(paths) mounts = mount_points @targets = paths.map { |path| select_mount(path, mounts) }.sort.uniq end |
Instance Method Details
#stats ⇒ Object
346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/fluent/plugin/in_td_monitor_agent.rb', line 346 def stats res = {} `df -B G -P`.each_line.with_index { |line, i| if i.nonzero? columns = line.strip.split(' ') mount = columns[-1].strip if @targets.include?(mount) usage = columns[-2].chop.to_i res[mount] = usage end end } res end |