Permalink
Browse files

Report time correct and polling server stats as well.

Just /c we can.
  • Loading branch information...
1 parent 9c2e0f3 commit 863257feaaabbf779901dc6114c8b16081bacdbb @dougbarth dougbarth committed Apr 2, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 ntp_status/ntp_status.rb
View
@@ -2,7 +2,10 @@ class NtpStatus < Scout::Plugin
def build_report
output = `ntpstat`
if $?.success?
- report :ntpstat => 'synchronized'
+ status = output.split("\n")[0]
+ time_correct_ms = output.match(/time correct to within ([0-9]+) ms/)[1].to_i
+ polling_server_s = output.match(/polling server every ([0-9]+) s/)[1].to_i
+ report :status => status, :time_correct_ms => time_correct_ms, :polling_server_s => polling_server_s
else
report :ntpstat => 'unsynchronized'
alert("ntpstat failed", output)

0 comments on commit 863257f

Please sign in to comment.