servicemonitor 0.2.1 → 0.2.2

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: 137ee194873265b6f9c6a365cee21be149c047fa
4
- data.tar.gz: 5eedb94c6c42494727f598e8e8f6a1e516ea9e53
3
+ metadata.gz: 338a78861e00b178aa687aff2a6e83cf1d6825c4
4
+ data.tar.gz: 87a7362a0efc9a52245f69571173b3ebbf26f531
5
5
  SHA512:
6
- metadata.gz: 95bbcc2319573054ee264b2e889ee72e034fe9cda998b390f36edcd01b6c731e58e9efc3696d7f87c222e87649d225387bf1cac7c26b64595a833e2d64ee5115
7
- data.tar.gz: 88c763fa21d47351a87f7116da78c3167fc4b7fe9cec764071dc19d2bc0f0f2f02a0422cd69d84755e59bd9f972b4fd28fb41766cd5399cdbaea903604544713
6
+ metadata.gz: d4532c3f8b364c265adfc52d3cb6a1d7daa9b23212df762f52b214bb446684b30d3d0fccabc04cddc12ae20f92584a54e4672bdbb8fa7fc00386a9c9739f5ca1
7
+ data.tar.gz: ec530dc907339abadc8565a5f8743c22a6f3cd785e550caacc67bf1b2796f101535096b28e9ebaab8ef0af57244316a16498370d6e89c34756dbd2af8d64dc6e
data/bin/servicemonitor CHANGED
@@ -4,16 +4,16 @@
4
4
  $:.unshift './'
5
5
 
6
6
  require 'net/smtp'
7
- require 'Alert'
8
- require 'Alert/Email'
9
- require 'MonitorType'
10
- require 'MonitorType/Threshold'
11
- require 'MonitorType/Beanstalk'
12
- require 'MonitorType/Dir'
13
- require 'MonitorType/FluidDb'
14
- require 'MonitorType/Process'
15
- require 'MonitorType/HttpGetJsonList'
16
- require 'MonitorManager'
7
+ require 'alert'
8
+ require 'alert/email'
9
+ require 'monitor_type'
10
+ require 'monitor_type/threshold'
11
+ require 'monitor_type/beanstalk'
12
+ require 'monitor_type/dir'
13
+ require 'monitor_type/fluidDb'
14
+ require 'monitor_type/process'
15
+ require 'monitor_type/http_get_json_list'
16
+ require 'monitor_manager'
17
17
  require 'helper_functions'
18
18
 
19
19
  # Don't buffer stdout
@@ -38,8 +38,9 @@ rescue ArgumentError
38
38
  "*** <command>, [:arg=>value]\n"
39
39
  rescue SystemExit
40
40
  # rescue SIGTERM=>e
41
- rescue StandardError
41
+ rescue StandardError => e
42
42
  puts 'What the ...'
43
43
  puts e.class.name
44
44
  puts e.message
45
+ puts e.backtrace
45
46
  end
data/lib/alert/email.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'net/smtp'
2
- require 'Alert'
2
+ require 'alert'
3
3
 
4
4
  # Email alert class
5
5
  # Uses localhost for sending email - Probably need to change this in the future.
@@ -25,11 +25,10 @@ class MonitorManager
25
25
  string = "Exiting on request ...\n"
26
26
  puts string
27
27
 
28
- rescue StandardError
29
- string = "#{e.class.name}\n" \
30
- "*** This is really unexpected.\n" \
31
- "Message: #{e.message}\n" \
32
- "#{e.backtrace}\n"
33
- puts string
28
+ rescue StandardError => e
29
+ puts '*** This is really unexpected.'
30
+ puts e.class.name
31
+ puts "Message: #{e.message}"
32
+ puts e.backtrace
34
33
  end
35
34
  end
data/lib/monitor_type.rb CHANGED
@@ -105,7 +105,7 @@ class MonitorType
105
105
  body = "#{@name} tripped.\n#{string}"
106
106
  puts '*** '
107
107
  if !@email.nil?
108
- AlertEmail.new(@sender_email, @email, body).Send
108
+ AlertEmail.new(@sender_email, @email, body).send
109
109
  puts "Emailed, #{@email}"
110
110
  else
111
111
  puts body
@@ -1,4 +1,4 @@
1
- require 'FluidDb'
1
+ require 'fluiddb2'
2
2
  require 'monitor_type/threshold'
3
3
 
4
4
  # A database class for checking a single number against a threshold.
@@ -40,7 +40,7 @@ class MonitorTypeFluidDb < MonitorTypeThreshold
40
40
  # This ensures that all params are correct.
41
41
  def setup
42
42
  begin
43
- @fluid_db = FluidDb.Db(@uri)
43
+ @fluid_db = FluidDb2.db(@uri)
44
44
  rescue StandardError => e
45
45
  string = "*** FluidDb encountered an error while connecting to the db\n" \
46
46
  "*** Error: #{e.message}\n" \
@@ -53,7 +53,7 @@ class MonitorTypeFluidDb < MonitorTypeThreshold
53
53
  end
54
54
 
55
55
  def derived_value
56
- @fluid_db.queryForValue(@sql, [])
56
+ @fluid_db.query_for_value(@sql, [])
57
57
  rescue StandardError
58
58
  string = "*** FluidDb encountered an error while running the sql\n" \
59
59
  "*** sql: #{@sql}\n" \
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servicemonitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guy Irvine