Module: ZabbixRubyClient::Plugins::Disk

Extended by:
ZabbixRubyClient::PluginBase, Disk
Included in:
Disk
Defined in:
lib/zabbix-ruby-client/plugins/disk.rb

Instance Method Summary collapse

Methods included from ZabbixRubyClient::PluginBase

getline, getlines, httprequest, os, perform, time

Instance Method Details

#collect(*args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/zabbix-ruby-client/plugins/disk.rb', line 13

def collect(*args)
  host = args[0]
  dev = args[1]
  mapped = args[3] || dev

  info = get_info(dev, mapped)
  if info
    back = []
    back << "#{host} disk.space[#{mapped},size] #{time} #{to_m(info[1])}"
    back << "#{host} disk.space[#{mapped},used] #{time} #{to_m(info[2])}"
    back << "#{host} disk.space[#{mapped},available] #{time} #{to_m(info[3])}"
    back << "#{host} disk.space[#{mapped},percent_used] #{time} #{info[4].gsub(/%/,'')}"
    back << "#{host} disk.io[#{mapped},read_ok] #{time} #{info[9]}"
    back << "#{host} disk.io[#{mapped},read_merged] #{time} #{info[10]}"
    back << "#{host} disk.io[#{mapped},read_sector] #{time} #{info[11]}"
    back << "#{host} disk.io[#{mapped},read_time] #{time} #{info[12]}"
    back << "#{host} disk.io[#{mapped},write_ok] #{time} #{info[13]}"
    back << "#{host} disk.io[#{mapped},write_merged] #{time} #{info[14]}"
    back << "#{host} disk.io[#{mapped},write_sector] #{time} #{info[15]}"
    back << "#{host} disk.io[#{mapped},write_time] #{time} #{info[16]}"
    back << "#{host} disk.io[#{mapped},io_time] #{time} #{info[17]}"
    back << "#{host} disk.io[#{mapped},io_weighted] #{time} #{info[18]}"
  end
  return back
end

#discover(*args) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/zabbix-ruby-client/plugins/disk.rb', line 39

def discover(*args)
  device = args[0]
  mount = args[1]
  mapped = args[2] || device
  [ "disk.dev.discovery",
    "{\"{#DISK_DEVICE}\": \"#{mapped}\", \"{#DISK_MOUNT}\": \"#{mount}\"}"
  ]
end