panoptimon 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ require 'net/http'
3
+ require 'uri'
4
+ require 'json'
5
+
6
+ def overview (host, port)
7
+ url = URI.parse("http://#{host}:#{port}/_status")
8
+ req = Net::HTTP::Get.new(url.path)
9
+
10
+ begin
11
+ resp = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }
12
+ rescue => msg
13
+ error "Could not connect - #{msg}"
14
+ end
15
+
16
+ if resp.code != "200"
17
+ if resp.nil?
18
+ error "Nil response object"
19
+ else
20
+ error "Bad status #{resp.code}"
21
+ end
22
+ elsif not resp['content-type'].include? 'application/json'
23
+ error "Not getting JSON output from MongoDB"
24
+ end
25
+
26
+ j = JSON::parse(resp.body)
27
+ j['serverStatus']
28
+ end
29
+
30
+ def error message
31
+ puts JSON::generate({:error => message})
32
+ exit 1
33
+ end
34
+
35
+ config = JSON::parse(ARGV[0])
36
+ config["host"] ||= 'localhost'
37
+ config["port"] ||= '28017'
38
+
39
+ puts JSON::generate(overview(config["host"], config["port"]))
@@ -0,0 +1,4 @@
1
+ {
2
+ "host": "localhost",
3
+ "port": "28017"
4
+ }
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2012 Sourcefire, Inc.
2
2
 
3
3
  module Panoptimon
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panoptimon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-12 00:00:00.000000000 Z
12
+ date: 2013-08-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
@@ -152,6 +152,8 @@ files:
152
152
  - collectors/memcached/test-notes.txt
153
153
  - collectors/memory/memory
154
154
  - collectors/memory/memory.json
155
+ - collectors/mongodb/mongodb
156
+ - collectors/mongodb/mongodb.json
155
157
  - collectors/network/network
156
158
  - collectors/network/network.json
157
159
  - collectors/nginx/README.md