puppetdashboardmonitor 0.0.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/README.md +2 -0
- data/bin/puppetdashboardmonitor +19 -0
- data/etc/dashboard.yaml.sample +4 -0
- data/lib/puppetdashboardmonitoring.rb +30 -0
- metadata +49 -0
data/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'yaml'
|
5
|
+
require 'puppetdashboardmonitoring'
|
6
|
+
|
7
|
+
def run
|
8
|
+
|
9
|
+
config = YAML::load(File.read('etc/dashboard.yaml'))
|
10
|
+
|
11
|
+
data = Hash.new
|
12
|
+
data = PuppetDashboardMonitoring.go(config)
|
13
|
+
data
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
output = run()
|
18
|
+
puts output.to_json
|
19
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "net/http"
|
2
|
+
require "uri"
|
3
|
+
|
4
|
+
module PuppetDashboardMonitoring
|
5
|
+
module_function
|
6
|
+
|
7
|
+
def go (config)
|
8
|
+
@config = config
|
9
|
+
data = Hash.new
|
10
|
+
data[:nodes] = Hash.new
|
11
|
+
data[:nodes][:total] = get_json("#{@config[:url]}/nodes.json").count
|
12
|
+
data[:nodes][:changed] = get_json("#{@config[:url]}/nodes/changed.json").count
|
13
|
+
data[:nodes][:unresponsive] = get_json("#{@config[:url]}/nodes/unresponsive.json").count
|
14
|
+
data
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_json (url, user=@config[:authuser], pass=@config[:authpass])
|
18
|
+
uri = URI.parse(url)
|
19
|
+
|
20
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
21
|
+
http.use_ssl = true
|
22
|
+
#http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
23
|
+
|
24
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
25
|
+
request.basic_auth(user,pass)
|
26
|
+
response = http.request(request)
|
27
|
+
JSON.parse(response.body)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: puppetdashboardmonitor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Zach Leslie
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-26 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Parses json from the various node states on puppet dashboard and returns
|
15
|
+
those values in a json blob
|
16
|
+
email: xaque208@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- bin/puppetdashboardmonitor
|
22
|
+
- lib/puppetdashboardmonitoring.rb
|
23
|
+
- etc/dashboard.yaml.sample
|
24
|
+
- README.md
|
25
|
+
homepage: https://github.com/xaque208/puppetdashboardmonitor
|
26
|
+
licenses: []
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
none: false
|
33
|
+
requirements:
|
34
|
+
- - ! '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubyforge_project:
|
45
|
+
rubygems_version: 1.8.24
|
46
|
+
signing_key:
|
47
|
+
specification_version: 3
|
48
|
+
summary: A tool to get the highlights from the Puppet Dashboard
|
49
|
+
test_files: []
|