class ContinuentNagiosMonitorThreads

Private Instance Methods

build_critical_message(value) click to toggle source
# File bin/tungsten_nagios_monitor_threads, line 48
def build_critical_message(value)
  "Thread count is too high (#{value})"
end
build_ok_message(value) click to toggle source
# File bin/tungsten_nagios_monitor_threads, line 40
def build_ok_message(value)
  "Thread count is OK (#{value})"
end
build_warning_message(value) click to toggle source
# File bin/tungsten_nagios_monitor_threads, line 44
def build_warning_message(value)
  "Thread count is too high (#{value})"
end
configure() click to toggle source
Calls superclass method
# File bin/tungsten_nagios_monitor_threads, line 52
def configure
  super()
  
  description("Check the number of JVM threads for the specified component")
  
  add_option(:component, {
    :on => "--component String",
    :help => "The Tungsten component to return a Java PID for"
  })
  
  add_option(:match, {
    :on => "--match String",
    :help => "String to match on to limit the thread count"
  })
end
main() click to toggle source
# File bin/tungsten_nagios_monitor_threads, line 33
def main
  count = TU.tungsten_cmd_result(opt(:thread_count_command))
  
  add_perfdata("threads", count)
  check_threshold(count)
end
script_name() click to toggle source
# File bin/tungsten_nagios_monitor_threads, line 93
def script_name
  "tungsten_nagios_monitor_threads"
end
uses_thresholds?() click to toggle source
# File bin/tungsten_nagios_monitor_threads, line 89
def uses_thresholds?
  true
end
validate() click to toggle source
Calls superclass method
# File bin/tungsten_nagios_monitor_threads, line 68
def validate
  super()
  
  unless TU.is_valid?()
    return TU.is_valid?()
  end
  
  args = []
  args << "--component=#{opt(:component)}"
  if opt(:match)
    args << "--match=#{opt(:match)}"
  end
  opt(:thread_count_command, "tungsten_java_thread_count #{args.join(' ')}")
  
  begin
    TU.tungsten_cmd_result("#{opt(:thread_count_command)} --validate")
  rescue CommandError => ce
    TU.debug(ce)
  end
end