class Fluent::Plugin::NodeExporter::UnameMetricsCollector
Public Class Methods
new(config={})
click to toggle source
Calls superclass method
Fluent::Plugin::NodeExporter::MetricsCollector::new
# File lib/fluent/plugin/node_exporter/uname_collector.rb, line 25 def initialize(config={}) super(config) @gauge = CMetrics::Gauge.new @gauge.create("node", "uname", "info", "Labeled system information as provided by the uname system call.", ["sysname", "release", "version", "machine", "nodename", "domainname"]) end
Public Instance Methods
cmetrics()
click to toggle source
# File lib/fluent/plugin/node_exporter/uname_collector.rb, line 56 def cmetrics { info: @gauge } end
run()
click to toggle source
# File lib/fluent/plugin/node_exporter/uname_collector.rb, line 34 def run uname_update end
uname_update()
click to toggle source
# File lib/fluent/plugin/node_exporter/uname_collector.rb, line 38 def uname_update # Etc.uname returns at least sysname,release,version,machine,nodename # but it is not guaranteed to return domainname. domainname = if Etc.uname.has_key?(:domainname) Etc.uname[:domainname] else "(none)" end # Use 1 explicitly for default gauge value @gauge.set(1, [ Etc.uname[:sysname], Etc.uname[:release], Etc.uname[:version], Etc.uname[:machine], Etc.uname[:nodename], domainname]) end