cloudscopes 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c10cf3fdfa70ce1de5a02adb3bf4efd0d96804da
4
- data.tar.gz: 88d6da877e73a5d78c51bd375c7b083512cfe212
3
+ metadata.gz: d487b832719eb766e7543b52fbee208483647555
4
+ data.tar.gz: 4d2ee3796eaa5da07af7139b8a3b4e51090235e4
5
5
  SHA512:
6
- metadata.gz: be20dacf290f31e39a3bf7360317adcf9a2eb7d568d5453eb45b2098585ba372911acd146e4b5ebb73aa0cb8d692c1c71a5cfb287b24232a9d6d132f6f6730e0
7
- data.tar.gz: 0ca2172ae69b6afd2a2f605ff6aee2f5adadddcc6c07094b4091dd9a457c85931fbbeaee1c59273b1a31ce99ed9f21bc02b3463cc14645522e1e19106b657b8e
6
+ metadata.gz: 042d0435bbda99d04843cd1a30487cd98ca84fffcb7a4d6950f55c5fc7b5adba8c114dba6d3fff31557ab82dbff1f29101b4f4564af556d57ff92646689a6f1e
7
+ data.tar.gz: f19f2804d849fd942ff8bb60f19f3a0dbbf71c3a6794c603ff9d9521eb25ba3eb1d2b6f698445ccdfa7d5e2427dcfea28e6a5c46f4397e30d926bd1fe2ca7ce4
@@ -20,6 +20,9 @@ metrics:
20
20
  - name: Available Space on System
21
21
  unit: Gigabytes
22
22
  value: filesystem.df("/").avail / 1024 / 1024 / 1024
23
+ - name: MyService processes
24
+ unit: Count
25
+ value: system.ps.select { |p| p.exe_name == 'myservice' }.size
23
26
 
24
27
  Queues:
25
28
  - name: Pending Resque Items
@@ -0,0 +1,32 @@
1
+ module Cloudscopes
2
+
3
+ class Process
4
+
5
+ class SystemProcess
6
+ def initialize(id)
7
+ @id = id.to_i
8
+ raise "Invalid system process id #{id}" unless @id > 0 && @id <= 65536
9
+ end
10
+
11
+ def exe
12
+ begin
13
+ File.readlink("/proc/#{@id}/exe")
14
+ rescue SystemCallError => e # report and ignore
15
+ $stderr.puts "Error accessing process #{@id}: #{e.message}"
16
+ ''
17
+ end
18
+ end
19
+
20
+ def exe_name
21
+ File.basename(exe)
22
+ end
23
+ end
24
+
25
+ def list
26
+ Dir["/proc/[0-9]*[0-9]"].collect{|dir| SystemProcess.new(File.basename(dir).to_i) }
27
+ end
28
+
29
+ end
30
+
31
+ end
32
+
@@ -33,6 +33,10 @@ module Cloudscopes
33
33
  all? { |proc| proc[:status] == "up"}
34
34
  end
35
35
 
36
+ def ps
37
+ Cloudscopes::Process.new.list
38
+ end
39
+
36
40
  end
37
41
 
38
42
  def self.system # must define, otherwise kernel.system matches
@@ -1,3 +1,3 @@
1
1
  module Cloudscopes
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
data/lib/cloudscopes.rb CHANGED
@@ -13,6 +13,7 @@ require 'cloudscopes/globals'
13
13
  require 'cloudscopes/sample'
14
14
  require 'cloudscopes/memory'
15
15
  require 'cloudscopes/system'
16
+ require 'cloudscopes/process'
16
17
  require 'cloudscopes/filesystem'
17
18
  require 'cloudscopes/redis'
18
19
  require 'cloudscopes/network'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudscopes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oded Arbel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-21 00:00:00.000000000 Z
11
+ date: 2015-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -103,6 +103,7 @@ files:
103
103
  - lib/cloudscopes/memory.rb
104
104
  - lib/cloudscopes/network.rb
105
105
  - lib/cloudscopes/options.rb
106
+ - lib/cloudscopes/process.rb
106
107
  - lib/cloudscopes/redis.rb
107
108
  - lib/cloudscopes/sample.rb
108
109
  - lib/cloudscopes/system.rb