city-watch 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,7 +39,7 @@ module Watchman
39
39
  end
40
40
 
41
41
  def opts
42
- @options ||= {}
42
+ @options ||= get_watchman_options
43
43
  end
44
44
 
45
45
  def options(*args)
@@ -63,6 +63,10 @@ module Watchman
63
63
  @post_processors << (block_given? ? block : meth)
64
64
  end
65
65
 
66
+ def get_watchman_options
67
+ CityWatch.config[:watchmen] && CityWatch.config[:watchmen][self.name.to_sym] ? CityWatch.config[:watchmen][self.name.to_sym] : {}
68
+ end
69
+
66
70
  end
67
71
 
68
72
  def self.included(base)
@@ -3,6 +3,12 @@ class Redis
3
3
  include Watchman
4
4
 
5
5
  def self.data
6
+ if opts[:ports]
7
+ dat = opts[:ports].map do |port|
8
+ out = `redis-cli -p #{port} info`
9
+ out.gsub(/^(#.*|$)$/,'').gsub(/(\r\n)+/,"\r\n").split("\r\n").map {|str| str.strip.split(":") }.inject({}) {|acc,(k,v)| acc[k.to_sym] = v; acc }
10
+ end
11
+ end
6
12
  end
7
13
 
8
14
  end
@@ -10,7 +10,7 @@ module Watchmen
10
10
 
11
11
  def self.data
12
12
  @watchmen.inject({}) do |acc,watchman|
13
- if !CityWatch.config[:watchmen] || CityWatch.config[:watchmen].include?(watchman.name)
13
+ if !CityWatch.config[:watchmen] || CityWatch.config[:watchmen][watchman.name.to_sym]
14
14
  acc[watchman.name] = watchman.data
15
15
  end
16
16
  acc
@@ -41,3 +41,4 @@ require 'city_watch/watchmen/nginx'
41
41
  require 'city_watch/watchmen/cpu_usage'
42
42
  require 'city_watch/watchmen/disk_usage'
43
43
  require 'city_watch/watchmen/uptime'
44
+ require 'city_watch/watchmen/redis'
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CityWatch
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: city-watch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: