Class: Zabbirc::Zabbix::Connection
- Inherits:
-
Object
- Object
- Zabbirc::Zabbix::Connection
- Defined in:
- lib/zabbirc/zabbix/connection.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize ⇒ Connection
Returns a new instance of Connection.
20 21 22 23 |
# File 'lib/zabbirc/zabbix/connection.rb', line 20 def initialize @client = ::Zabbix::Client.new(Zabbirc.config.zabbix_api_url, debug: false) @client.user.login(user: Zabbirc.config.zabbix_login, password: Zabbirc.config.zabbix_password) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/zabbirc/zabbix/connection.rb', line 6 def client @client end |
Class Method Details
.get_connection ⇒ Object
8 9 10 |
# File 'lib/zabbirc/zabbix/connection.rb', line 8 def self.get_connection Thread.current[:zabbix_connection] ||= self.new end |