eznemo 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a63d6de019cde7d7b7f154e16534524759075ad
4
- data.tar.gz: 930d98134aeb498f387fb8bcd69866948cb82dc0
3
+ metadata.gz: 3e5d349829718d26ca4db2923e6729c16372e2e6
4
+ data.tar.gz: 0754641f251dd3220f90e650f62a7c28ec47aa9d
5
5
  SHA512:
6
- metadata.gz: e32c9ed5244114be6ea97713322558566fd1d4d2982b71046223700224d4092e4ede0f1b27d32529fc021f94eebed7be1ac02aca6537867a463763b15b721db9
7
- data.tar.gz: 47945030a40c8e762568ec593e819309b42a93ee5347ec9ce25fd0f75604b9d45889bae290eac96ce3667b48d870dbcd3dc70a598fcc5ea643a77fa81bad2d5f
6
+ metadata.gz: eaa3255851876e776e773feab656201edfeb026e824ea32408702affbcd8ba46d0d792cface8b6d725366f6f29ea8bafffcb5e6e1385ebd8851c597dccdcd4c1
7
+ data.tar.gz: 518f2523ee34c20e60ba53e96878502d53e9a2328f10db2c2a932f5879e966ac28e70f0f55890da2bbdaf950ed75c91d6f8153f34de217564a48b547aef749e0
data/README.md CHANGED
@@ -81,7 +81,7 @@ Config file.
81
81
  {
82
82
  check_id: 123, # from checks
83
83
  probe: 'Probe01',
84
- timestamp: '2016-04-01 10:00:00 -07:00',
84
+ timestamp: '2016-04-01 10:00:00 -0700',
85
85
  status: true, # true means OK
86
86
  response_ms: 0.012, # in milliseconds
87
87
  status_desc: 'OK' # short description of the result
@@ -107,10 +107,10 @@ CREATE TABLE `checks` (
107
107
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
108
108
  `name` varchar(255) NOT NULL DEFAULT '',
109
109
  `hostname` varchar(255) NOT NULL DEFAULT '',
110
- `interval` int(11) NOT NULL,
110
+ `interval` int(11) NOT NULL COMMENT 'in seconds',
111
111
  `type` varchar(255) NOT NULL DEFAULT '',
112
112
  `state` tinyint(1) NOT NULL,
113
- `options` text,
113
+ `options` varchar(255) DEFAULT '',
114
114
  PRIMARY KEY (`id`),
115
115
  CLUSTERING KEY `state` (`state`)
116
116
  ) ENGINE=TokuDB DEFAULT CHARSET=utf8;
@@ -119,10 +119,10 @@ CREATE TABLE `results` (
119
119
  `id` int(11) NOT NULL AUTO_INCREMENT,
120
120
  `check_id` int(11) NOT NULL,
121
121
  `probe` varchar(255) NOT NULL DEFAULT '',
122
- `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
122
+ `timestamp` datetime NOT NULL COMMENT 'in utc',
123
123
  `status` tinyint(1) NOT NULL,
124
124
  `response_ms` float NOT NULL DEFAULT '0',
125
- `status_desc` varchar(255) DEFAULT NULL,
125
+ `status_desc` varchar(255) NOT NULL DEFAULT '',
126
126
  PRIMARY KEY (`id`),
127
127
  CLUSTERING KEY `check_id` (`check_id`),
128
128
  KEY `probe` (`probe`),
@@ -133,7 +133,7 @@ CREATE TABLE `results` (
133
133
  CREATE TABLE `tags` (
134
134
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
135
135
  `check_id` int(11) NOT NULL,
136
- `text` varchar(63) NOT NULL DEFAULT '',
136
+ `text` varchar(255) NOT NULL DEFAULT '',
137
137
  PRIMARY KEY (`id`),
138
138
  KEY `check_id` (`check_id`),
139
139
  CLUSTERING KEY `text` (`text`)
data/lib/eznemo/mysql.rb CHANGED
@@ -6,9 +6,11 @@ require 'thread'
6
6
  module EzNemo
7
7
 
8
8
  # Sequel connection setup
9
+ Sequel.application_timezone = :local
10
+ Sequel.database_timezone = :utc
9
11
  Sequel::Model.db = Sequel.connect({adapter: 'mysql2'}.merge(config[:datastore][:options]))
10
12
 
11
- # Defines DataStorage class for MySQL
13
+ # Defines DataStore class for MySQL
12
14
  module StorageAdapter
13
15
 
14
16
  # Number of records it queues up before writing
@@ -81,15 +83,7 @@ module EzNemo
81
83
  else
82
84
  db = emdatabase
83
85
  stmt = ''
84
- @results.each do |r|
85
- # r[:probe] = @probe
86
- r[:status_desc] = db.escape(r[:status_desc])
87
- cols = r.values.keys.join(',')
88
- # find and convert boolean values to integer
89
- vals = r.values.values.map { |v| !!v == v ? (v ? 1 : 0) : v }
90
- vals = vals.join("','")
91
- stmt << "INSERT INTO results (#{cols}) VALUES ('#{vals}');"
92
- end
86
+ @results.each { |r| stmt << Result.dataset.insert_sql(r) + ';' }
93
87
  defer = db.query(stmt)
94
88
  defer.callback do
95
89
  end
@@ -1,5 +1,5 @@
1
1
  module EzNemo
2
2
 
3
- Version = '0.2.0'
3
+ Version = '0.2.1'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eznemo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken J.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-13 00:00:00.000000000 Z
11
+ date: 2016-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kajiki