class Fluent::Plugin::NodeExporter::FilefdMetricsCollector
Public Class Methods
new(config={})
click to toggle source
Calls superclass method
Fluent::Plugin::NodeExporter::MetricsCollector::new
# File lib/fluent/plugin/node_exporter/filefd_collector.rb, line 24 def initialize(config={}) super(config) @allocated = CMetrics::Gauge.new @allocated.create("node", "filefd", "allocated", "File descriptor statistics: allocated.") @maximum = CMetrics::Gauge.new @maximum.create("node", "filefd", "maximum", "File descriptor statistics: maximum.") end
Public Instance Methods
cmetrics()
click to toggle source
# File lib/fluent/plugin/node_exporter/filefd_collector.rb, line 51 def cmetrics { filefd_allocated: @allocated, filefd_maximum: @maximum } end
filefd_update()
click to toggle source
# File lib/fluent/plugin/node_exporter/filefd_collector.rb, line 38 def filefd_update # Etc.uname returns at least sysname,release,version,machine,nodename # but it is not guaranteed to return domainname. file_nr_path = File.join(@procfs_path, "/sys/fs/file-nr") entry = File.read(file_nr_path).split unless entry.size == 3 $log.warn("invalid number of field <#{file_nr_path}>: #{entry.size}") return end @allocated.set(entry.first.to_f) @maximum.set(entry.last.to_f) end
run()
click to toggle source
# File lib/fluent/plugin/node_exporter/filefd_collector.rb, line 34 def run filefd_update end