lib/splash/cli/process.rb in prometheus-splash-0.5.3 vs lib/splash/cli/process.rb in prometheus-splash-0.6.0
- old
+ new
@@ -1,12 +1,17 @@
+# coding: utf-8
+
+# module for all Thor subcommands
module CLISplash
+ # Thor inherited class for Processes management
class Processes < Thor
include Splash::Config
include Splash::Exiter
include Splash::Processes
+ # Thor method : unning Splash configured processes monitors analyse
desc "analyse", "analyze processes defined in Splash config"
def analyse
log = get_logger
results = ProcessScanner::new
res = results.analyse
@@ -38,19 +43,22 @@
log.error "Global status : some error found"
end
splash_exit case: :quiet_exit
end
+
+ # Thor method : running Splash configured processes monitors analyse and sending to Prometheus Pushgateway
desc "monitor", "monitor processes defined in Splash config"
def monitor
log = get_logger
log.level = :fatal if options[:quiet]
result = ProcessScanner::new
result.analyse
splash_exit result.notify
end
+ # Thor method : display a specific Splash configured process monitor
desc "show PROCESS", "show Splash configured process record for PROCESS"
def show(record)
log = get_logger
process_recordset = get_config.processes.select{|item| item[:process] == record }
unless process_recordset.empty? then
@@ -64,9 +72,10 @@
else
splash_exit case: :not_found, :more => "Process not configured"
end
end
+ # Thor method : display the full list of Splash configured processes monitors
desc "list", "List all Splash configured process records"
long_desc <<-LONGDESC
List all Splash configured processes record\n
with --detail, show process records details
LONGDESC