Class: Rbeapi::Api::Logging
Overview
The Logging class manages logging settings on an EOS node.
Instance Attribute Summary
Attributes inherited from Entity
Instance Method Summary collapse
-
#add_host(name) ⇒ Boolean
add_host configures a new logging destination host address or hostname to the list of logging destinations.
-
#get ⇒ Hash<Symbol, Object>
get returns the current logging configuration hash extracted from the nodes running configuration.
-
#parse_enable ⇒ Hash<Symbol, Object>
private
parse_enable scans the nodes current running configuration and extracts the current enabled state of the logging facility.
-
#remove_host(name) ⇒ Boolean
remove_host deletes a logging destination host name or address form the list of logging destinations.
-
#set_enable(opts = {}) ⇒ Boolean
set_enable configures the global logging instance on the node as either enabled or disabled.
Methods inherited from Entity
#command_builder, #configure, #configure_interface, #get_block, #initialize, instance
Constructor Details
This class inherits a constructor from Rbeapi::Api::Entity
Instance Method Details
#add_host(name) ⇒ Boolean
add_host configures a new logging destination host address or hostname to the list of logging destinations. If the host is already configured in the list of destinations, this method will return successfully.
Commands
logging host <name>
136 137 138 |
# File 'lib/rbeapi/api/logging.rb', line 136 def add_host(name) configure "logging host #{name}" end |
#get ⇒ Hash<Symbol, Object>
get returns the current logging configuration hash extracted from the nodes running configuration.
55 56 57 58 59 60 |
# File 'lib/rbeapi/api/logging.rb', line 55 def get response = {} response.merge!(parse_enable) response.merge!(parse_hosts) response end |
#parse_enable ⇒ Hash<Symbol, Object>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
parse_enable scans the nodes current running configuration and extracts the current enabled state of the logging facility. The logging enable command is expected to always be in the node’s configuration. This methods return value is intended to be merged into the logging resource hash.
72 73 74 75 |
# File 'lib/rbeapi/api/logging.rb', line 72 def parse_enable value = /no logging on/ !~ config { enable: value } end |
#remove_host(name) ⇒ Boolean
remove_host deletes a logging destination host name or address form the list of logging destinations. If the host is not in the list of configured hosts, this method will still return successfully.
Commands
no logging host <name>
154 155 156 |
# File 'lib/rbeapi/api/logging.rb', line 154 def remove_host(name) configure "no logging host #{name}" end |
#set_enable(opts = {}) ⇒ Boolean
set_enable configures the global logging instance on the node as either enabled or disabled. If the enable keyword is set to true then logging is globally enabled and if set to false, it is globally disabled. If the default keyword is specified and set to true, then the configuration is defaulted using the default keyword. The default keyword option takes precedence over the enable keyword if both options are specified.
Commands
logging on
no logging on
default logging on
117 118 119 120 |
# File 'lib/rbeapi/api/logging.rb', line 117 def set_enable(opts = {}) cmd = command_builder('logging on', opts) configure cmd end |