From 15c7247e6d7a96dac1a75c8d69d788590812af74 Mon Sep 17 00:00:00 2001 From: Nathan Lasseter Date: Wed, 20 Mar 2013 22:16:19 +0000 Subject: DB examples and made pingtimes float not string in DB --- Client/client.rb | 2 +- db.txt | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 db.txt diff --git a/Client/client.rb b/Client/client.rb index 5b8f26c..8549886 100644 --- a/Client/client.rb +++ b/Client/client.rb @@ -25,7 +25,7 @@ threads["pingthread"] = Thread.new do loop do slock = true results = {"timestamp" => Time.now.to_i} settings["neighbours"].each do |neighbour| - pingtime = %x[ping -c1 #{neighbour}][/time=(.*?) ms/, 1] + pingtime = %x[ping -c1 #{neighbour}][/time=(.*?) ms/, 1].to_f results.merge!({neighbour => pingtime}) end rcoll.insert(results) diff --git a/db.txt b/db.txt new file mode 100644 index 0000000..ba7981d --- /dev/null +++ b/db.txt @@ -0,0 +1,24 @@ +Configs db example + +configs.servera is a collection containing records like: +{ + "timestamp": 1363817460, + "configttl": 3600, + "pinginterval": 60, + "neighbours": [ + "serverb", + "serverc", + "home" + ] +} + + +Results db example + +results.servera is a collection containing records like: +{ + "timestamp": 1363817460, + "serverb": 0.057, + "serverc": 0.054, + "home": 0.055 +} -- cgit v1.2.1