Module: Nagios
- Defined in:
- lib/nagios_helper.rb,
lib/generators/nagios/check_generator.rb,
lib/generators/nagios/check_em_generator.rb
Defined Under Namespace
Classes: Check, CheckEM, CheckEmGenerator, CheckGenerator, Runner, RunnerAsync
Constant Summary
collapse
- OK =
0
- WARN =
1
- CRIT =
2
- OTHER =
3
- CONCURRENCY_LEVEL =
100
- STATUS_NAMES =
{
OK => 'ok',
WARN => 'warn',
CRIT => 'crit',
OTHER => 'other'
}
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.project_initializer_loaded ⇒ Object
Returns the value of attribute project_initializer_loaded.
33
34
35
|
# File 'lib/nagios_helper.rb', line 33
def project_initializer_loaded
@project_initializer_loaded
end
|
Class Method Details
.concurrency_level ⇒ Object
35
36
37
|
# File 'lib/nagios_helper.rb', line 35
def concurrency_level
@concurrency_level
end
|
.concurrency_level=(cl) ⇒ Object
43
44
45
46
|
# File 'lib/nagios_helper.rb', line 43
def concurrency_level=(cl)
@concurrency_level = cl
EM.threadpool_size = cl
end
|
.logger ⇒ Object
27
28
29
30
31
|
# File 'lib/nagios_helper.rb', line 27
def logger
@logger ||= Logger.new(File.join(rails_root, "/log/nagios.log")).tap do |logger|
logger.formatter = lambda { |s, d, p, m| "#{d.strftime("%d.%m.%Y %H:%M:%S")} #{m}\n" }
end
end
|
.mutex ⇒ Object
39
40
41
|
# File 'lib/nagios_helper.rb', line 39
def mutex
@mutex ||= Mutex.new
end
|
.rails_root ⇒ Object
52
53
54
|
# File 'lib/nagios_helper.rb', line 52
def rails_root
defined?(RAILS_ROOT) ? RAILS_ROOT : (defined?(Rails) ? Rails.root : nil)
end
|
.status_name(status) ⇒ Object
48
49
50
|
# File 'lib/nagios_helper.rb', line 48
def status_name(status)
":#{ STATUS_NAMES[status] || 'unknown' }"
end
|