eznemo 0.0.2 → 0.1.0

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: 14365e43e3184d7e2a7d8978b8a8c4fe76d57596
4
- data.tar.gz: 2d7ca0b5a7fe4f8acdc9b2fa0a87020497b85317
3
+ metadata.gz: c3efce5df3e500b3170a41590e844315147277f9
4
+ data.tar.gz: fddcc93d34f4c32d015b257f33447bbbb555ad67
5
5
  SHA512:
6
- metadata.gz: a75aa47b2879c4e018d1613f07db5f604831985d5e3b9b0d2f629ad0e78ad7049305af989f8c9aceb3dda1a5f7b3c31619bfe76eb40e822c9373abef741fe149
7
- data.tar.gz: 452ce77dbd521523f4c7ecd417a6554f1c7d55026b4dcd53cfdc5d0ce855e4a6d9292c27c9767a826546d83b769d7c5d10356064dbeb937f72d9a12904dfa231
6
+ metadata.gz: 211605c26eae2da41969b4be18e2d3d4d02f57604ff9ae06af6799b02eb3fc061b682d52bf8fad7638700acc2a5e3e580a9aaa63e0141ee774196aa08832f5d4
7
+ data.tar.gz: eaf38d99f061d70917681a41e1f02cb327d2499cdaaaf1eff50d8e6246d349a67d250ecbc3133babd53651d70904c83b6ada2429f35c93981e7c6a3a38afa16f
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # eznemo
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/eznemo.svg)](https://badge.fury.io/rb/eznemo) [![Code Climate](https://codeclimate.com/github/kenjij/eznemo/badges/gpa.svg)](https://codeclimate.com/github/kenjij/eznemo)
4
+
3
5
  A Ruby gem. It's a simple monitoring engine and stores results in a database. Runs on EventMachine.
4
6
 
5
7
  For reports and alerts, analyze the results in the database.
@@ -35,18 +37,21 @@ Config file.
35
37
 
36
38
  ```yaml
37
39
  ---
40
+ :probe:
41
+ :name: Probe01
38
42
  :datastore:
39
43
  :type: :mysql
40
44
  :options:
41
- :host: '127.0.0.1'
42
- :username: 'user'
43
- :password: 'paSsw0rd'
44
- :database: 'eznemo'
45
+ :host: 127.0.0.1
46
+ :username: user
47
+ :password: paSsw0rd
48
+ :database: eznemo
45
49
  :checks:
46
50
  :tags:
47
51
  - tag1
48
52
  - tag2
49
53
  :monitor:
54
+ :ping: # all optional
50
55
  :path: '/bin/ping'
51
56
  :min_interval: 10
52
57
  :timeout: 5
@@ -75,6 +80,7 @@ Config file.
75
80
  ```ruby
76
81
  {
77
82
  check_id: 123, # from checks
83
+ probe: 'Probe01',
78
84
  timestamp: '2016-04-01 10:00:00 -07:00',
79
85
  status: true, # true means OK
80
86
  response_ms: 0.012, # in milliseconds
@@ -100,12 +106,14 @@ CREATE TABLE `checks` (
100
106
  CREATE TABLE `results` (
101
107
  `id` int(11) NOT NULL AUTO_INCREMENT,
102
108
  `check_id` int(11) NOT NULL,
109
+ `probe` varchar(255) NOT NULL DEFAULT '',
103
110
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
104
111
  `status` tinyint(1) NOT NULL,
105
112
  `response_ms` float NOT NULL DEFAULT '0',
106
- `status_desc` varchar(255) NOT NULL DEFAULT '',
113
+ `status_desc` varchar(255) DEFAULT NULL,
107
114
  PRIMARY KEY (`id`),
108
115
  KEY `check_id` (`check_id`),
116
+ KEY `probe` (`probe`),
109
117
  KEY `timestamp` (`timestamp`),
110
118
  KEY `status` (`status`)
111
119
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
data/lib/eznemo/mysql.rb CHANGED
@@ -11,6 +11,7 @@ module EzNemo
11
11
 
12
12
  def initialize
13
13
  @results = []
14
+ @probe = EzNemo.config[:probe][:name]
14
15
  @opts = EzNemo.config[:datastore][:options]
15
16
  @opts[:flags] = Mysql2::Client::MULTI_STATEMENTS
16
17
  end
@@ -51,6 +52,7 @@ module EzNemo
51
52
  sync ? db = database : db = emdatabase
52
53
  stmt = ''
53
54
  @results.each do |r|
55
+ r[:probe] = @probe
54
56
  r[:status_desc] = db.escape(r[:status_desc])
55
57
  cols = r.keys.join(',')
56
58
  vals = r.values.join("','")
@@ -1,5 +1,5 @@
1
1
  module EzNemo
2
2
 
3
- Version = '0.0.2'
3
+ Version = '0.1.0'
4
4
 
5
5
  end
data/lib/eznemo.rb CHANGED
@@ -20,7 +20,7 @@ module EzNemo
20
20
  def initialize(opts)
21
21
  c = EzNemo.load_config(opts[:config])
22
22
 
23
- require "eznemo/#{c[:datastore][:type].to_s}"
23
+ require "eznemo/#{c[:datastore][:type]}"
24
24
  require 'eznemo/datastore'
25
25
 
26
26
  require 'eznemo/monitor'
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.0.2
4
+ version: 0.1.0
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-04-04 00:00:00.000000000 Z
11
+ date: 2016-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kajiki