Class: Unifiap
- Inherits:
-
Oxidized::Model
- Object
- Oxidized::Model
- Unifiap
- Defined in:
- lib/oxidized/model/unifiap.rb
Instance Attribute Summary
Attributes inherited from Oxidized::Model
Instance Method Summary collapse
-
#ntpskew(cfg) ⇒ Object
NTPskew: Return the skew in micro seconds from the ntpclient output.
Methods inherited from Oxidized::Model
cfg, #cfg, cfgs, cmd, #cmd, cmds, comment, #comment, expect, #expect, expects, #expects, #get, inherited, #output, post, pre, prompt, #prompt, #screenscrape, #send, #xmlcomment
Methods included from Oxidized::Config::Vars
Instance Method Details
#ntpskew(cfg) ⇒ Object
NTPskew: Return the skew in micro seconds from the ntpclient output
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/oxidized/model/unifiap.rb', line 125 def ntpskew(cfg) index = skew = nil cfg.each_line do |line| # Look for the header just before the stats line, and find which number is skew if line.match(/^\s*[a-z]+\s+[a-z]+\s+[a-z]+\s+[a-z]+/i) words = line.split index = words.map(&:downcase).index("skew") end # Now look for the single stats line and grab the skew if !index.nil? && line.match(/^\s*[\d.]+\s+[\d.]+\s+[\d.]+\s+[\d.]+/) numbers = line.split skew = numbers[index] end end skew end |