sensu-plugins-varnish 1.0.0 → 1.1.0

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: eafe1d0cd64b1b6943a54de896db5e5d2a0a5bd4
4
- data.tar.gz: 3f7c677aef159ed669a4598b41851a9d9f3abf2c
3
+ metadata.gz: e5e0f886fc302904f4fbec469d3d29bb3ede8093
4
+ data.tar.gz: 2a9a72e264fb432cc0ff878257a784ca2ab015f4
5
5
  SHA512:
6
- metadata.gz: 0ee4bb0c9f9bc288fe147f611e778f240aa81b137ccdf1a92f97f440f8f0d845017a2cb2c5c12bcf732361eaa63fea6b114df4c737b0054d62e485256b5e70ae
7
- data.tar.gz: 4f04863dd2cd80ff2718f6cb439c78974eacc64187f8ed4c6fe7885d33b92ae23838840340dbde2b28f449fc252ff907d18e1aef588b58c52988760b6c76e557
6
+ metadata.gz: 33b7405d02ff2acd1065f87e449d6bda8a85e3794914b65604e8fc4224cd24230ebef4592dd99c905ff615f01594b5b266183dd633382ee17b3687375682186b
7
+ data.tar.gz: 62fc22513eb76c53caeff5b61d5e88f1066411ad71ff8c6b34f65ae088f2ef3226244403584661b8379635703f53e6c99a5f5ab0be61af1ecdc3b47cafd7efe0
@@ -1,10 +1,17 @@
1
- #Change Log
1
+ # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.1.0] - 2017-08-01
9
+ ### Changed
10
+ - Use full path for varnish scripts to allow sudoers files with explicit binaries to work (@warmfusion)
11
+
12
+ ### Removed
13
+ - Removed legacy Rake code that prevented rubocop running during Ruby 1.9.3 tests (@thomasriley)
14
+
8
15
  ## [1.0.0] - 2017-07-02
9
16
  ### Breaking Changes
10
17
  - removed ruby 1.9 support (@majormoses)
@@ -41,7 +48,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
41
48
  ### Added
42
49
  - initial release
43
50
 
44
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-varnish/compare/1.0.0...HEAD
51
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-varnish/compare/1.1.0...HEAD
52
+ [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-varnish/compare/1.0.0...1.1.0
45
53
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-varnish/compare/0.1.0...1.0.0
46
54
  [0.1.0]: https://github.com/sensu-plugins/sensu-plugins-varnish/compare/0.0.5...0.1.0
47
55
  [0.0.5]: https://github.com/sensu-plugins/sensu-plugins-varnish/compare/0.0.4...0.0.5
data/README.md CHANGED
@@ -14,6 +14,16 @@
14
14
 
15
15
  ## Usage
16
16
 
17
+ These checks need to sudo certain varnish scripts to be able to get status and metrics data.
18
+ To ensure sensu can run these commands, add the following to `/etc/sudoers.d/sensu-varnish` or wherever you
19
+ manage your sudo lists;
20
+
21
+ ```
22
+ # Assuming that your varnish scripts are located in /usr/bin;
23
+ sensu ALL=(ALL) NOPASSWD: /usr/bin/varnishadm /usr/bin/varnishstat
24
+ ```
25
+
26
+
17
27
  ## Installation
18
28
 
19
29
  [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
@@ -76,8 +76,10 @@ class CheckVarnishStatus < Sensu::Plugin::Check::CLI
76
76
 
77
77
  # Main Function
78
78
  def run
79
- unknown 'varnishadm is not installed!' unless `which varnishadm 2>/dev/null`.to_s.include? 'varnish'
80
- command = `sudo varnishadm -T #{config[:host]}:#{config[:port]} -S #{config[:secret]} -t #{config[:timeout]} #{config[:command]}`
79
+ # Keep a full reference for the varnish binary so sudo uses a full path
80
+ varnishadm = `which varnishadm 2>/dev/null`.to_s
81
+ unknown 'varnishadm is not installed!' unless varnishadm.include? 'varnish'
82
+ command = `sudo #{varnishadm} -T #{config[:host]}:#{config[:port]} -S #{config[:secret]} -t #{config[:timeout]} #{config[:command]}`
81
83
  if config[:command] == 'status'
82
84
  if command.include? 'state running'
83
85
  ok 'Up & Running'
@@ -61,6 +61,10 @@ class VarnishMetrics < Sensu::Plugin::Metric::CLI::Graphite
61
61
  end
62
62
 
63
63
  def run
64
+ # Keep a full reference for the varnish binary so sudo uses a full path
65
+ varnishstat_command = `which varnishstat 2>/dev/null`.to_s
66
+ unknown 'varnishstat is not installed!' unless varnishstat_command.include? 'varnish'
67
+
64
68
  begin
65
69
  fieldargs = ''
66
70
  if config[:fields]
@@ -74,10 +78,11 @@ class VarnishMetrics < Sensu::Plugin::Metric::CLI::Graphite
74
78
  end
75
79
 
76
80
  varnishstat = if config[:varnish_name]
77
- `varnishstat -x -n #{config[:varnish_name]} #{fieldargs}`
81
+ `sudo #{varnishstat_command} -x -n #{config[:varnish_name]} #{fieldargs}`
78
82
  else
79
- `varnishstat -x #{fieldargs}`
83
+ `sudo #{varnishstat_command} -x #{fieldargs}`
80
84
  end
85
+
81
86
  stats = Crack::XML.parse(varnishstat)
82
87
  if stats['varnishstat']['stat']
83
88
  stats['varnishstat']['stat'].each do |stat|
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsVarnish
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 0
4
+ MINOR = 1
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-varnish
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-02 00:00:00.000000000 Z
11
+ date: 2017-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: crack