sensu-plugins-ftp 0.0.2 → 1.0.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: 46d0c97dc2a66be21d00dec3825656342a93ac7b
4
- data.tar.gz: 49579d5ccf89fecfb3e7898e9b8a69e7aab90b07
3
+ metadata.gz: 5ffa02f11c10b20ca3c6b1025cb1103c7431d8a9
4
+ data.tar.gz: 96ac957cf4f4289a254d1d375b45fb7017f1d235
5
5
  SHA512:
6
- metadata.gz: 43a9588294f461d3ccd63678a64b9c95150e4b295acfd245110638fc3656c8c26649d16cf1d74157c19b160a6558bd954b589998ca1c3c34c2a877e7d4e63ed2
7
- data.tar.gz: a44152c3dbf4fa77acca62db12f91e6545742c1ce6fde29a82b44963e4adf6efb85d3aaa2974a66992fc9c58e1b9988270ee2427c7c498c2083a608bc13d6d75
6
+ metadata.gz: b77645699046ccfc107bbcb7fcbb2937f76a2ea09819c066bb3ed74453f43e740159e04faef9812152b8583f9fcbc5a679503f42b6cfbf54c765d8200fe3ec91
7
+ data.tar.gz: bbf7969ebddb11d148646ddc909552c592818e7d30cdea2be04bad0ff59ea756c0b64bca044b3c48f7f76d7ca626abdcdd6a95ba7ddb350a940dbdfff0e0fd07
data/CHANGELOG.md CHANGED
@@ -1,9 +1,21 @@
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
- ## Unreleased][unreleased]
6
+ ## [Unreleased]
7
+
8
+ ## [1.0.0] - 2017-05-14
9
+ ### Added
10
+ - Add support for writing test files (@sstarcher)
11
+ - Support for Ruby 2.3 and 2.4 (@eheydrick)
12
+
13
+ ### Removed
14
+ - Support for Ruby 1.9.3 (@eheydrick)
15
+
16
+ ### Changed
17
+ - Relax `sensu-plugin` dependency to `~> 1.2` (@mattyjones)
18
+ - Rubocop upgrade and cleanup (@eheydrick)
7
19
 
8
20
  ## [0.0.2] - 2015-07-14
9
21
  ### Changed
@@ -12,3 +24,7 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
12
24
  ## [0.0.1] - 2015-06-04
13
25
  ### Added
14
26
  - initial release
27
+
28
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-ftp/compare/1.0.0...HEAD
29
+ [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-ftp/compare/0.0.2...1.0.0
30
+ [0.0.2]: https://github.com/sensu-plugins/sensu-plugins-ftp/compare/0.0.1...0.0.2
data/README.md CHANGED
@@ -5,7 +5,6 @@
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-ftp/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-ftp)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-ftp/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-ftp)
7
7
  [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-ftp.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-ftp)
8
- [ ![Codeship Status for sensu-plugins/sensu-plugins-ftp](https://codeship.com/projects/8355b200-ea2c-0132-eecc-32dfa18a9fce/status?branch=master)](https://codeship.com/projects/83056)
9
8
 
10
9
  ## Functionality
11
10
 
@@ -16,6 +15,6 @@
16
15
 
17
16
  ## Installation
18
17
 
19
- [Installation and Setup](https://github.com/sensu-plugins/documentation/blob/master/user_docs/installation_instructions.md)
18
+ [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
20
19
 
21
20
  ## Notes
data/bin/check-ftp.rb CHANGED
@@ -29,6 +29,8 @@
29
29
 
30
30
  require 'sensu-plugin/check/cli'
31
31
  require 'net/http'
32
+ require 'tempfile'
33
+ require 'pathname'
32
34
 
33
35
  class CheckFTP < Sensu::Plugin::Check::CLI
34
36
  option :host,
@@ -42,6 +44,14 @@ class CheckFTP < Sensu::Plugin::Check::CLI
42
44
  short: '-n',
43
45
  boolean: true,
44
46
  default: false
47
+ option :write_file,
48
+ short: '-w',
49
+ boolean: true,
50
+ default: false
51
+ option :passive,
52
+ short: '-x',
53
+ boolean: true,
54
+ default: false
45
55
  option :user,
46
56
  short: '-u',
47
57
  long: '--username USER',
@@ -54,14 +64,29 @@ class CheckFTP < Sensu::Plugin::Check::CLI
54
64
  proc: proc(&:to_i),
55
65
  default: 15
56
66
 
67
+ def write_file
68
+ file = Tempfile.new("sensu_#{Time.now.to_i}.txt")
69
+
70
+ filename = Pathname.new(file.path).basename.to_s
71
+
72
+ puts ftp.passive
73
+ file.write("Generated from Sensu at #{Time.now}")
74
+ file.close
75
+
76
+ ftp.put(file.path, filename)
77
+ puts ftp.list
78
+ ftp.delete(filename)
79
+
80
+ file.unlink
81
+ end
82
+
57
83
  def run
58
84
  begin
59
85
  timeout(config[:timeout]) do
60
- if config[:tls]
61
- ftps_login
62
- else
63
- ftp_login
64
- end
86
+ ftp.login(config[:user], config[:pass])
87
+ ftp.passive = config[:passive]
88
+ write_file if config[:write_file]
89
+ ftp.quit
65
90
  end
66
91
  rescue Timeout::Error
67
92
  critical 'Connection timed out'
@@ -71,6 +96,14 @@ class CheckFTP < Sensu::Plugin::Check::CLI
71
96
  ok
72
97
  end
73
98
 
99
+ def ftp
100
+ @ftp ||= if config[:tls]
101
+ ftps_login
102
+ else
103
+ ftp_login
104
+ end
105
+ end
106
+
74
107
  def ftps_login
75
108
  require 'double_bag_ftps'
76
109
  verify = OpenSSL::SSL::VERIFY_PEER
@@ -82,8 +115,7 @@ class CheckFTP < Sensu::Plugin::Check::CLI
82
115
  verify_mode: verify
83
116
  )
84
117
  ftps.connect(config[:host])
85
- ftps.login(config[:user], config[:pass])
86
- ftps.quit
118
+ ftps
87
119
  rescue => e
88
120
  critical "Failed to log in (#{e.to_s.chomp})"
89
121
  end
@@ -93,8 +125,7 @@ class CheckFTP < Sensu::Plugin::Check::CLI
93
125
  require 'net/ftp'
94
126
  begin
95
127
  ftp = Net::FTP.new(config[:host])
96
- ftp.login(config[:user], config[:pass])
97
- ftp.quit
128
+ ftp
98
129
  rescue => e
99
130
  critical "Failed to log in (#{e.to_s.chomp})"
100
131
  end
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsFtp
2
2
  module Version
3
- MAJOR = 0
3
+ MAJOR = 1
4
4
  MINOR = 0
5
- PATCH = 2
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,51 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-ftp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRIwEAYDVQQDDAltYXR0
14
- am9uZXMxGDAWBgoJkiaJk/IsZAEZFgh5aWVsZGJvdDETMBEGCgmSJomT8ixkARkW
15
- A2NvbTAeFw0xNTAxMjgyMTAyNTFaFw0xNjAxMjgyMTAyNTFaMEMxEjAQBgNVBAMM
16
- CW1hdHRqb25lczEYMBYGCgmSJomT8ixkARkWCHlpZWxkYm90MRMwEQYKCZImiZPy
17
- LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyTSzVYnO
18
- CLgyrIyT1mBQakArQyW8xhi6MlDqyzXHJGeERT790U6EgoBVeS4XoK0ptFZNR8Tf
19
- zko0w+Nv47TarSCgkPOaxY+mxWnAVR10dOmfeLr7huiMyps+YD56/EF2FqQ3jf/+
20
- qohENfKD91qy1ieEy+Fn7Pf74ltbNKUdkb9a9eFXQ0DQ4ip5vik7DzjQkUTj4lca
21
- k6ArwnmHX4YDhZoYtrQJ8jVktN0/+NtA40M5qkCYHNe5tUW25b/tKVYuioxG6b2Z
22
- oIzaZxRLxf6HVAWpCVRT/F5+/yjigkX4u++eYacfLGleXQzoK7BL65vHGMJygWEE
23
- 0TKGqFOrl/L0AQIDAQABo38wfTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
24
- HQ4EFgQUEf6a8Td7MrSZc8ImbLFZAENPbz0wIQYDVR0RBBowGIEWbWF0dGpvbmVz
25
- QHlpZWxkYm90LmNvbTAhBgNVHRIEGjAYgRZtYXR0am9uZXNAeWllbGRib3QuY29t
26
- MA0GCSqGSIb3DQEBBQUAA4IBAQBbzXAYA3BVGw8DZ0YYoY1VHPNEcH5qPIApmHO8
27
- rvSmuUT0yMEi7u00H/5uHRFf4LleGT/+sTdyXKsNPGT9kdRuQEgwi+vf7Zfvd8aX
28
- UF/+4VkEYf/8rV8Ere6u2QaWPgApdMV6JjKr1fAwCTd8AuGXNaWItiPPMseSQzLJ
29
- JKP4hVvbc1d+oS925B1lcBiqn2aYvElbyNAVmQPywNNqkWmvtlqj9ZVJfV5HQLdu
30
- 8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
- HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
- -----END CERTIFICATE-----
33
- date: 2015-07-14 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2017-05-15 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: sensu-plugin
37
15
  requirement: !ruby/object:Gem::Requirement
38
16
  requirements:
39
- - - '='
17
+ - - "~>"
40
18
  - !ruby/object:Gem::Version
41
- version: 1.2.0
19
+ version: '1.2'
42
20
  type: :runtime
43
21
  prerelease: false
44
22
  version_requirements: !ruby/object:Gem::Requirement
45
23
  requirements:
46
- - - '='
24
+ - - "~>"
47
25
  - !ruby/object:Gem::Version
48
- version: 1.2.0
26
+ version: '1.2'
49
27
  - !ruby/object:Gem::Dependency
50
28
  name: bundler
51
29
  requirement: !ruby/object:Gem::Requirement
@@ -106,16 +84,16 @@ dependencies:
106
84
  name: rubocop
107
85
  requirement: !ruby/object:Gem::Requirement
108
86
  requirements:
109
- - - '='
87
+ - - "~>"
110
88
  - !ruby/object:Gem::Version
111
- version: '0.30'
89
+ version: 0.40.0
112
90
  type: :development
113
91
  prerelease: false
114
92
  version_requirements: !ruby/object:Gem::Requirement
115
93
  requirements:
116
- - - '='
94
+ - - "~>"
117
95
  - !ruby/object:Gem::Version
118
- version: '0.30'
96
+ version: 0.40.0
119
97
  - !ruby/object:Gem::Dependency
120
98
  name: rspec
121
99
  requirement: !ruby/object:Gem::Requirement
@@ -172,7 +150,9 @@ dependencies:
172
150
  - - "~>"
173
151
  - !ruby/object:Gem::Version
174
152
  version: '0.8'
175
- description: Sensu ftp plugins
153
+ description: |-
154
+ This plugin provides native FTP/FTPS instrumentation
155
+ for monitoring service connectivity
176
156
  email: "<sensu-users@googlegroups.com>"
177
157
  executables:
178
158
  - check-ftp.rb
@@ -203,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
203
183
  requirements:
204
184
  - - ">="
205
185
  - !ruby/object:Gem::Version
206
- version: 1.9.3
186
+ version: 2.0.0
207
187
  required_rubygems_version: !ruby/object:Gem::Requirement
208
188
  requirements:
209
189
  - - ">="
@@ -211,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
191
  version: '0'
212
192
  requirements: []
213
193
  rubyforge_project:
214
- rubygems_version: 2.4.6
194
+ rubygems_version: 2.4.5
215
195
  signing_key:
216
196
  specification_version: 4
217
197
  summary: Sensu plugins for ftp
checksums.yaml.gz.sig DELETED
@@ -1 +0,0 @@
1
- �Q"r�z�F��+��-8js��
data.tar.gz.sig DELETED
@@ -1,2 +0,0 @@
1
- ��)㚴{3|��q��J���B ������kY5�Ӈ�x_�d��-3�%~�rgJ���"&uѿ7���?���0���� V��zf,�q����f��'M�$܍c=��:���ڋ]�@
2
- ������o�pr0 U�i�슞x� ģG�B���oZ�(BرC�i �� ͍�����lbd�AH$%���ܝ����Z�>W�n���|�F�ӗDσ)p�f�w�yVR�M>^�X�����d���K>)�C�P���
metadata.gz.sig DELETED
Binary file