Module: Rubix
- Defined in:
- lib/rubix.rb,
lib/rubix/log.rb,
lib/rubix/model.rb,
lib/rubix/sender.rb,
lib/rubix/monitor.rb,
lib/rubix/response.rb,
lib/rubix/connection.rb,
lib/rubix/models/host.rb,
lib/rubix/models/item.rb,
lib/rubix/models/template.rb,
lib/rubix/models/host_group.rb,
lib/rubix/models/application.rb,
lib/rubix/monitors/chef_monitor.rb,
lib/rubix/monitors/cluster_monitor.rb
Defined Under Namespace
Modules: Logs
Classes: Application, ChefMonitor, ClusterMonitor, Connection, Host, HostGroup, Item, Model, Monitor, Response, Sender, Template
Constant Summary
collapse
- Error =
Class.new(RuntimeError)
- ConnectionError =
Class.new(Error)
- AuthenticationError =
Class.new(Error)
- RequestError =
Class.new(Error)
- ValidationError =
Class.new(Error)
Class Method Summary
collapse
Class Method Details
.connect(server, username = nil, password = nil) ⇒ Object
5
6
7
|
# File 'lib/rubix.rb', line 5
def self.connect server, username=nil, password=nil
self.connection = Connection.new(server, username, password)
end
|
.connection ⇒ Object
13
14
15
16
17
18
|
# File 'lib/rubix.rb', line 13
def self.connection
@connection ||= Connection.new('http://localhost/api_jsonrpc.php', 'admin', 'zabbix')
return @connection if @connection.authorized?
raise ConnectionError.new("Could not authorize with Zabbix API at #{@connection.uri}") unless @connection.authorize!
@connection
end
|
.connection=(connection) ⇒ Object
9
10
11
|
# File 'lib/rubix.rb', line 9
def self.connection= connection
@connection = connection
end
|
.default_logger ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/rubix/log.rb', line 14
def self.default_logger
severity = Logger::INFO
file = $stdout
if defined?(Settings) && Settings[:log_level]
begin
severity_name = Settings[:log_level].to_s.upcase
severity = Logger.const_get(severity_name)
rescue NameError => e
end
end
if defined?(Settings) && Settings[:log]
begin
file = Settings[:log]
rescue NameError => e
end
end
@logger = Logger.new(file)
@logger.level = severity
@logger
end
|
.logger ⇒ Object
9
10
11
12
|
# File 'lib/rubix/log.rb', line 9
def self.logger
return @logger unless @logger.nil?
@logger = default_logger
end
|
.logger=(l) ⇒ Object
5
6
7
|
# File 'lib/rubix/log.rb', line 5
def self.logger= l
@logger = l
end
|