sensu-plugins-mysql 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6fc129aec007bdfaffa716935047b1e7d26c6ca5
4
- data.tar.gz: cc1f3bc4826df392a45733f03684ac40bf94f424
3
+ metadata.gz: b4771377cb28536973ce544b4e55ee253750b268
4
+ data.tar.gz: 0781a896efb30553b88c61b4b4d2670c9843bcec
5
5
  SHA512:
6
- metadata.gz: 592b3556770a10083ff8d0d455702ab862a332e19fa63ffbddae0d2d8819f2da673a3441ecb67d0a569932fd63339bd1889d8883ae47e24549182a04230eefda
7
- data.tar.gz: b1076197ce8353cd35570be284f47662a9c4309014c35b81a6f305826b1ee70c30eeb3b41c23df966e971b7212ca84a790646870a6aec439f428e2477b691836
6
+ metadata.gz: 8751c800dc87b5bb2883ac8587eb4a238f43e6555b03d8e65d4c8767ca369e124d60cc7fad9149f49526efce968269448f5f23bdba7146e8138ee366c399ee4d
7
+ data.tar.gz: 277002253e87872b4239a5579dc8b7721c39331fe4eddbdefdcd42902f94421700ae87f3d502faf2128731c1fc8f9060e427822a445b91edb547482cf3cad6e1
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -5,10 +5,12 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## Unreleased][unreleased]
7
7
 
8
- ## 0.0.1 - 2015-05-29
8
+ ## [0.0.3] - 2015-07-14
9
+ ### Changed
10
+ - updated sensu-plugin gem to 1.2.0
9
11
 
10
12
  ### Added
11
- - initial release
13
+ - ability to read configuration data from an ini file
12
14
 
13
15
  ## [0.0.2] - 2015-06-03
14
16
 
@@ -16,4 +18,10 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
16
18
  - added binstubs
17
19
 
18
20
  ### Changed
19
- - removed cruft from /lib
21
+ - removed cruft from /lib
22
+
23
+ ## 0.0.1 - 2015-05-29
24
+
25
+ ### Added
26
+ - initial release
27
+
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Sensu-Plugins-mysql
2
2
 
3
- [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-mysql.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-mysql)
3
+ [ ![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-mysql.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-mysql)
4
4
  [![Gem Version](https://badge.fury.io/rb/sensu-plugins-mysql.svg)](http://badge.fury.io/rb/sensu-plugins-mysql)
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-mysql/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-mysql)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-mysql/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-mysql)
@@ -12,6 +12,7 @@
12
12
 
13
13
  require 'sensu-plugin/check/cli'
14
14
  require 'mysql'
15
+ require 'inifile'
15
16
 
16
17
  class CheckMySQLHealth < Sensu::Plugin::Check::CLI
17
18
  option :user,
@@ -23,8 +24,12 @@ class CheckMySQLHealth < Sensu::Plugin::Check::CLI
23
24
  option :password,
24
25
  description: 'MySQL Password',
25
26
  short: '-p PASS',
26
- long: '--password PASS',
27
- required: true
27
+ long: '--password PASS'
28
+
29
+ option :ini,
30
+ description: 'My.cnf ini file',
31
+ short: '-i',
32
+ long: '--ini VALUE'
28
33
 
29
34
  option :hostname,
30
35
  description: 'Hostname to login to',
@@ -62,7 +67,16 @@ class CheckMySQLHealth < Sensu::Plugin::Check::CLI
62
67
  default: false
63
68
 
64
69
  def run
65
- db = Mysql.real_connect(config[:hostname], config[:user], config[:password], config[:database], config[:port].to_i, config[:socket])
70
+ if config[:ini]
71
+ ini = IniFile.load(config[:ini])
72
+ section = ini['client']
73
+ db_user = section['user']
74
+ db_pass = section['password']
75
+ else
76
+ db_user = config[:user]
77
+ db_pass = config[:password]
78
+ end
79
+ db = Mysql.real_connect(config[:hostname], db_user, db_pass, config[:database], config[:port].to_i, config[:socket])
66
80
  max_con = db
67
81
  .query("SHOW VARIABLES LIKE 'max_connections'")
68
82
  .fetch_hash
@@ -12,6 +12,7 @@
12
12
 
13
13
  require 'sensu-plugin/check/cli'
14
14
  require 'mysql'
15
+ require 'inifile'
15
16
 
16
17
  class CheckMysqlDisk < Sensu::Plugin::Check::CLI
17
18
  option :host,
@@ -29,6 +30,11 @@ class CheckMysqlDisk < Sensu::Plugin::Check::CLI
29
30
  long: '--password=VALUE',
30
31
  description: 'Database password'
31
32
 
33
+ option :ini,
34
+ description: 'My.cnf ini file',
35
+ short: '-i',
36
+ long: '--ini VALUE'
37
+
32
38
  option :size,
33
39
  short: '-s',
34
40
  long: '--size=VALUE',
@@ -56,9 +62,16 @@ class CheckMysqlDisk < Sensu::Plugin::Check::CLI
56
62
  exit: 0
57
63
 
58
64
  def run
65
+ if config[:ini]
66
+ ini = IniFile.load(config[:ini])
67
+ section = ini['client']
68
+ db_user = section['user']
69
+ db_pass = section['password']
70
+ else
71
+ db_user = config[:user]
72
+ db_pass = config[:pass]
73
+ end
59
74
  db_host = config[:host]
60
- db_user = config[:user]
61
- db_pass = config[:pass]
62
75
  disk_size = config[:size].to_f
63
76
  critical_usage = config[:crit].to_f
64
77
  warning_usage = config[:warn].to_f
@@ -12,6 +12,7 @@
12
12
 
13
13
  require 'sensu-plugin/check/cli'
14
14
  require 'mysql'
15
+ require 'inifile'
15
16
 
16
17
  class CheckMySQLInnoDBLock < Sensu::Plugin::Check::CLI
17
18
  option :user,
@@ -23,8 +24,12 @@ class CheckMySQLInnoDBLock < Sensu::Plugin::Check::CLI
23
24
  option :password,
24
25
  description: 'MySQL Password',
25
26
  short: '-p PASS',
26
- long: '--password PASS',
27
- required: true
27
+ long: '--password PASS'
28
+
29
+ option :ini,
30
+ description: 'My.cnf ini file',
31
+ short: '-i',
32
+ long: '--ini VALUE'
28
33
 
29
34
  option :hostname,
30
35
  description: 'Hostname to login to',
@@ -56,7 +61,16 @@ class CheckMySQLInnoDBLock < Sensu::Plugin::Check::CLI
56
61
  default: 10
57
62
 
58
63
  def run
59
- db = Mysql.new(config[:hostname], config[:user], config[:password], config[:database], config[:port].to_i, config[:socket])
64
+ if config[:ini]
65
+ ini = IniFile.load(config[:ini])
66
+ section = ini['client']
67
+ db_user = section['user']
68
+ db_pass = section['password']
69
+ else
70
+ db_user = config[:user]
71
+ db_pass = config[:password]
72
+ end
73
+ db = Mysql.new(config[:hostname], db_user, db_pass, config[:database], config[:port].to_i, config[:socket])
60
74
 
61
75
  warn = config[:warn].to_i
62
76
  crit = config[:crit].to_i
@@ -2,7 +2,7 @@ module SensuPluginsMySql
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-mysql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
@@ -30,7 +30,7 @@ cert_chain:
30
30
  8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
31
  HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
32
  -----END CERTIFICATE-----
33
- date: 2015-06-03 00:00:00.000000000 Z
33
+ date: 2015-07-14 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sensu-plugin
@@ -38,14 +38,14 @@ dependencies:
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 1.1.0
41
+ version: 1.2.0
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 1.1.0
48
+ version: 1.2.0
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: inifile
51
51
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +120,14 @@ dependencies:
120
120
  name: rubocop
121
121
  requirement: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - "~>"
123
+ - - '='
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0.30'
126
126
  type: :development
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - "~>"
130
+ - - '='
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0.30'
133
133
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file