From e225cc96dbc081c457c2e5ad174988e49d062760 Mon Sep 17 00:00:00 2001 From: Denis Knauf Date: Fri, 13 Oct 2023 22:50:09 +0200 Subject: [PATCH] renamed to lxc-exporter. os-release, apt update / upgradable. --- config.ru | 4 +- pvect-exporter.rb => lxc-exporter.rb | 203 +++++++++++++++++++-------- 2 files changed, 146 insertions(+), 61 deletions(-) rename pvect-exporter.rb => lxc-exporter.rb (53%) mode change 100644 => 100755 diff --git a/config.ru b/config.ru index 7795fe1..d7e04c2 100644 --- a/config.ru +++ b/config.ru @@ -1,12 +1,12 @@ require 'rack' -require_relative 'pvect-exporter' +require_relative 'lxc-exporter' require 'prometheus/client/formats/text' run lambda {|env| req = Rack::Request.new env case req.path when "/metrics" - collector = PveCtCollector.new + collector = LxcCollector.new [200, {"Content-Type" => "text/plain"}, [Prometheus::Client::Formats::Text.marshal( collector.collect)]] else [404, {"Content-Type" => "text/plain"}, ["Not found\nYou want to try /metrics?\n"]] diff --git a/pvect-exporter.rb b/lxc-exporter.rb old mode 100644 new mode 100755 similarity index 53% rename from pvect-exporter.rb rename to lxc-exporter.rb index 4ae292a..f2608b9 --- a/pvect-exporter.rb +++ b/lxc-exporter.rb @@ -26,7 +26,6 @@ end class File module Statfs Magics = {} -#=begin Line = <<~EOF ADFS 0xadf5 AFFS 0xadff @@ -121,7 +120,6 @@ class File end Magics[v] = n.downcase.to_sym end -#=end extend Fiddle::Importer dlload Fiddle.dlopen( nil) @@ -164,17 +162,12 @@ class File end class NS - #extend FFI::Library - #ffi_lib 'c' - #attach_function :setns_without_exception_handling, :setns, %i[int int], :int extend Fiddle::Importer dlload Fiddle.dlopen( nil) SetNS_Function = Fiddle::Function.new handler['setns'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP], Fiddle::TYPE_INT class <