Method: Unifiap#ntpskew
- Defined in:
- lib/oxidized/model/unifiap.rb
#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 |