pimon 0.1.6 → 0.1.7

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/Gemfile CHANGED
@@ -1,6 +1,5 @@
1
1
  source :rubygems
2
2
 
3
- gem 'capistrano', '~> 2.13.5'
4
3
  gem 'haml', '~> 3.1.7'
5
4
  gem 'sinatra', '~> 1.3.3', :require => 'sinatra/base'
6
5
  gem 'sinatra-websocket', '~> 0.2.0'
@@ -13,5 +12,5 @@ group :test do
13
12
  gem 'rspec', '~> 2.12.0'
14
13
  gem 'simplecov', '~> 0.7.1', :require => false
15
14
  gem 'simplecov-rcov', '~> 0.2.3'
16
- gem 'timecop', '~> 0.5.4'
15
+ gem 'timecop', '~> 0.5.9'
17
16
  end
data/Gemfile.lock CHANGED
@@ -2,12 +2,6 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  addressable (2.3.2)
5
- capistrano (2.13.5)
6
- highline
7
- net-scp (>= 1.0.0)
8
- net-sftp (>= 2.0.0)
9
- net-ssh (>= 2.0.14)
10
- net-ssh-gateway (>= 1.1.0)
11
5
  coderay (1.0.8)
12
6
  daemons (1.1.9)
13
7
  diff-lcs (1.1.3)
@@ -16,16 +10,8 @@ GEM
16
10
  eventmachine (>= 0.12.9)
17
11
  eventmachine (1.0.0)
18
12
  haml (3.1.7)
19
- highline (1.6.15)
20
13
  method_source (0.8)
21
14
  multi_json (1.5.0)
22
- net-scp (1.0.4)
23
- net-ssh (>= 1.99.1)
24
- net-sftp (2.0.5)
25
- net-ssh (>= 2.0.9)
26
- net-ssh (2.6.2)
27
- net-ssh-gateway (1.1.0)
28
- net-ssh (>= 1.99.1)
29
15
  pry (0.9.10)
30
16
  coderay (~> 1.0.5)
31
17
  method_source (~> 0.8)
@@ -63,13 +49,12 @@ GEM
63
49
  eventmachine (>= 0.12.6)
64
50
  rack (>= 1.0.0)
65
51
  tilt (1.3.3)
66
- timecop (0.5.4)
52
+ timecop (0.5.9.1)
67
53
 
68
54
  PLATFORMS
69
55
  ruby
70
56
 
71
57
  DEPENDENCIES
72
- capistrano (~> 2.13.5)
73
58
  haml (~> 3.1.7)
74
59
  pry
75
60
  rack-test (~> 0.6.2)
@@ -79,4 +64,4 @@ DEPENDENCIES
79
64
  sinatra (~> 1.3.3)
80
65
  sinatra-websocket (~> 0.2.0)
81
66
  thin (~> 1.5.0)
82
- timecop (~> 0.5.4)
67
+ timecop (~> 0.5.9)
data/README.md CHANGED
@@ -17,8 +17,9 @@ Optionally you may install it as a gem and run it, please check "Installing as a
17
17
  ## Configuration
18
18
  Configuration is done through a YAML file, you may check some examples on the config directory.
19
19
 
20
- 2. chart - colors for each chart
21
- 4. stats_collector - configure number of stats and time period between them
20
+ 1. chart - colors for each chart
21
+ 2. hostname - optional hostname to show on the chart subtitle, defaults to `hostname` if not set
22
+ 3. stats_collector - configure number of stats and time period between them
22
23
 
23
24
  ## Installing as a gem
24
25
  ```
data/bin/pimon CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ $: << "#{File.dirname(__FILE__)}/../lib"
2
3
  require 'optparse'
3
4
 
4
5
  options = {}
@@ -43,6 +44,12 @@ Options:
43
44
  'File to store PID (default: /tmp/pimon.pid)') do |pid_file|
44
45
  options[:pid_file] = pid_file
45
46
  end
47
+
48
+ opts.on('-v',
49
+ '--version',
50
+ 'Display Pimon version') do |pid_file|
51
+ ARGV[0] = 'version'
52
+ end
46
53
  end
47
54
 
48
55
  begin
@@ -83,6 +90,9 @@ begin
83
90
  else
84
91
  puts "Pid file not found at #{pid_file}, please supply a valid pid_file using -p or --pid"
85
92
  end
93
+ when 'version'
94
+ require 'pimon/version'
95
+ puts "Pimon version is #{Pimon::VERSION}"
86
96
  else
87
97
  STDERR.puts option_parser
88
98
  end
data/config/test.yml CHANGED
@@ -1,7 +1,3 @@
1
- basic_auth:
2
- enabled: true
3
- username: pimon
4
- password: pimon
5
1
  chart:
6
2
  cpu:
7
3
  color: '#D2691E'
@@ -13,13 +9,7 @@ chart:
13
9
  color: '#FF9B04'
14
10
  swap:
15
11
  color: '#3CB371'
16
- queues:
17
- time: pimon_time
18
- cpu: pimon_cpu
19
- disk: pimon_disk
20
- mem: pimon_mem
21
- swap: pimon_swap
22
- temp: pimon_temp
12
+ hostname: 'test_hostname'
23
13
  stats_collector:
24
14
  number_of_stats: 6
25
15
  time_period_in_min: 10
@@ -14,6 +14,10 @@ class PimonConfig
14
14
  @config[:stats_collector]
15
15
  end
16
16
 
17
+ def hostname
18
+ @hostname ||= @config[:hostname].nil? ? `hostname` : @config[:hostname]
19
+ end
20
+
17
21
  private
18
22
 
19
23
  def initialize(filename)
@@ -46,7 +46,7 @@ $(function () {
46
46
  x: -20
47
47
  },
48
48
  subtitle: {
49
- text: 'My raspberry PI',
49
+ text: o.hostname,
50
50
  x: -20
51
51
  },
52
52
  xAxis: {
@@ -40,7 +40,8 @@ class StatsCollector
40
40
  time = @stats.range(:time)
41
41
 
42
42
  stats = {
43
- :time => { :stats => time.map { |t| (/\d\d:\d\d:\d\d/.match(t))[0] } }
43
+ :time => { :stats => time.map { |t| (/\d\d:\d\d:\d\d/.match(t))[0] } },
44
+ :hostname => @config.hostname
44
45
  }
45
46
 
46
47
  @probes.each do |probe|
data/lib/pimon/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pimon
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'.freeze
3
3
  end
data/pimon.gemspec CHANGED
@@ -4,7 +4,7 @@ require 'pimon/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "pimon"
7
- s.version = Pimon::VERSION
7
+ s.version = Pimon::VERSION.dup
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = [ 'Pedro Carriço' ]
10
10
  s.email = [ 'pedro.carrico@gmail.com' ]
@@ -28,5 +28,5 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency 'rack-test', '~> 0.6.2'
29
29
  s.add_development_dependency 'simplecov', '~> 0.7.1'
30
30
  s.add_development_dependency 'simplecov-rcov', '~> 0.2.3'
31
- s.add_development_dependency 'timecop', '~> 0.5.4'
31
+ s.add_development_dependency 'timecop', '~> 0.5.9'
32
32
  end
@@ -6,6 +6,7 @@ describe 'PimonConfig' do
6
6
 
7
7
  its(:chart) { should == { :cpu => { :color => '#D2691E' }, :disk => { :color => '#CDC673' }, :mem => { :color => '#87CEFA' }, :temp => {:color=>"#FF9B04"}, :swap => { :color => '#3CB371' } } }
8
8
  its(:stats) { should == { :number_of_stats => 6, :time_period_in_min => 10 } }
9
+ its(:hostname) { should == 'test_hostname' }
9
10
  end
10
11
 
11
12
  context 'when created with an invalid environment' do
@@ -23,6 +23,7 @@ describe 'StatsCollector' do
23
23
  its(:show_stats) {
24
24
  should == {
25
25
  :time => { :stats => [] },
26
+ :hostname => 'test_hostname',
26
27
  :cpu => { :stats => [], :color => '#D2691E', :unit => '%' },
27
28
  :mem => { :stats => [], :color => '#87CEFA', :unit => '%' },
28
29
  :swap => {:stats => [], :color => '#3CB371', :unit => '%' },
@@ -49,6 +50,7 @@ describe 'StatsCollector' do
49
50
  its(:show_stats) {
50
51
  should == {
51
52
  :time => { :stats => ['12:00:00', '12:00:00', '12:00:00', '12:00:00', '12:00:00', '12:00:00']},
53
+ :hostname => 'test_hostname',
52
54
  :cpu => {:stats => [50, 50, 50, 50, 50, 50], :color => '#D2691E', :unit => '%'},
53
55
  :mem => { :stats => [78, 78, 78, 78, 78, 78], :color =>'#87CEFA', :unit => '%'},
54
56
  :swap=>{ :stats => [50, 50, 50, 50, 50, 50], :color => '#3CB371', :unit => '%'},
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pimon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
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: 2012-12-19 00:00:00.000000000 Z
12
+ date: 2013-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ~>
132
132
  - !ruby/object:Gem::Version
133
- version: 0.5.4
133
+ version: 0.5.9
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  requirements:
139
139
  - - ~>
140
140
  - !ruby/object:Gem::Version
141
- version: 0.5.4
141
+ version: 0.5.9
142
142
  description: Pimon is a simple server monitor designed for the Raspberry Pi.
143
143
  email:
144
144
  - pedro.carrico@gmail.com