panoptimon 0.4.0 → 0.4.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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.4.1
2
+
3
+ * collectors/rabbitmq - add RabbitMQ collector
4
+
1
5
  # 0.4.0
2
6
 
3
7
  * collectors/disk - remove sys-filesystem dependency
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+ require 'net/http'
3
+ require 'uri'
4
+ require 'json'
5
+
6
+ def overview (username, password, host, port)
7
+ url = URI.parse("http://#{host}:#{port}/api/overview")
8
+ req = Net::HTTP::Get.new(url.path)
9
+ req.basic_auth username, password
10
+
11
+ begin
12
+ resp = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }
13
+ rescue => msg
14
+ error "Could not connect - #{msg}"
15
+ end
16
+
17
+ if resp.code != "200"
18
+ if resp.nil?
19
+ error "Nil response object"
20
+ else
21
+ error "Bad status #{resp.code}"
22
+ end
23
+ elsif resp['content-type'] != 'application/json'
24
+ error "Not getting JSON output from RabbitMQ API"
25
+ end
26
+
27
+ j = JSON::parse(resp.body)
28
+ j.select{|k,v| %w[object_totals queue_totals].include?(k) }
29
+ end
30
+
31
+ def error message
32
+ puts JSON::generate({:error => message})
33
+ exit 1
34
+ end
35
+
36
+ config = JSON::parse(ARGV[0])
37
+ if config["username"].nil? || config["password"].nil?
38
+ error "Missing username/password"
39
+ end
40
+ config["host"] ||= 'localhost'
41
+ config["port"] ||= '55672'
42
+
43
+ puts JSON::generate(overview(config["username"], config["password"], config["host"], config["port"]))
@@ -0,0 +1,6 @@
1
+ {
2
+ "username": "bobsmith",
3
+ "password": "12345",
4
+ "host": "localhost",
5
+ "port": "55672"
6
+ }
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2012 Sourcefire, Inc.
2
2
 
3
3
  module Panoptimon
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
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.0
4
+ version: 0.4.1
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-07 00:00:00.000000000 Z
12
+ date: 2013-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
@@ -166,6 +166,8 @@ files:
166
166
  - collectors/process/README.md
167
167
  - collectors/process/process
168
168
  - collectors/process/process.json
169
+ - collectors/rabbitmq/rabbitmq
170
+ - collectors/rabbitmq/rabbitmq.json
169
171
  - collectors/service/README.md
170
172
  - collectors/service/samples/.gitignore
171
173
  - collectors/service/samples/data/disconnect