sensu-plugins-mysql-boutetnico 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/README.md +6 -5
- data/bin/metrics-mysql-disk.rb +84 -0
- data/bin/metrics-mysql-graphite.rb +31 -19
- data/lib/sensu-plugins-mysql/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88083d7375aae12be494d3310c685d57a4eca02a
|
4
|
+
data.tar.gz: 537c91b7469ff45310daf460474250a0f8788d5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15254f89788f46d9e3bed61b3875f88f2c30a9ef3fa114c32afef080ed6f13b4e55d8d43501675c07f9cffe3a3dc106539aaf23e4bc28fdeef9112a81820a0a5
|
7
|
+
data.tar.gz: 8c7696536a30026176bf86b19e245a36d29cb2c9fa42b664382fb56e099401d9ef002487b0d803e04aa7851808f2481ce15f9418abc2e67ee41ef3357c9d7a69
|
data/CHANGELOG.md
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Can be found at [https://github.com/boutetnico/sensu-plugins-mysql/releases](https://github.com/boutetnico/sensu-plugins-mysql/releases).
|
1
|
+
Can be found at [https://github.com/boutetnico/sensu-plugins-mysql/releases](https://github.com/boutetnico/sensu-plugins-mysql/releases).
|
data/README.md
CHANGED
@@ -10,21 +10,22 @@ This fork is automatically tested, built and published to [RubyGems](https://rub
|
|
10
10
|
## Files
|
11
11
|
* bin/check-cloudwatch-mysql-sensu.rb
|
12
12
|
* bin/check-mysql-alive.rb
|
13
|
-
* bin/check-mysql-status.rb
|
14
13
|
* bin/check-mysql-connections.rb
|
15
14
|
* bin/check-mysql-disk.rb
|
16
15
|
* bin/check-mysql-innodb-lock.rb
|
17
|
-
* bin/check-mysql-
|
16
|
+
* bin/check-mysql-msr-replication-status.rb
|
18
17
|
* bin/check-mysql-query-result-count.rb
|
19
18
|
* bin/check-mysql-select-count.rb
|
20
|
-
* bin/check-mysql-
|
19
|
+
* bin/check-mysql-status.rb
|
20
|
+
* bin/check-mysql-threads.rb
|
21
|
+
* bin/metrics-mysql-disk.rb
|
21
22
|
* bin/metrics-mysql-graphite.rb
|
22
23
|
* bin/metrics-mysql-multiple-select-count.rb
|
23
24
|
* bin/metrics-mysql-processes.rb
|
24
|
-
* bin/metrics-mysql-raw.rb
|
25
|
-
* bin/metrics-mysql.rb
|
26
25
|
* bin/metrics-mysql-query-result-count.rb
|
26
|
+
* bin/metrics-mysql-raw.rb
|
27
27
|
* bin/metrics-mysql-select-count.rb
|
28
|
+
* bin/metrics-mysql.rb
|
28
29
|
* bin/mysql-metrics.sql
|
29
30
|
|
30
31
|
## Usage
|
@@ -0,0 +1,84 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# MySQL Disk Usage Metrics
|
4
|
+
# ===
|
5
|
+
|
6
|
+
require 'sensu-plugin/metric/cli'
|
7
|
+
require 'mysql'
|
8
|
+
require 'inifile'
|
9
|
+
|
10
|
+
class CheckMysqlDisk < Sensu::Plugin::Metric::CLI::Graphite
|
11
|
+
option :host,
|
12
|
+
short: '-h',
|
13
|
+
long: '--host=VALUE',
|
14
|
+
description: 'Database host'
|
15
|
+
|
16
|
+
option :user,
|
17
|
+
short: '-u',
|
18
|
+
long: '--username=VALUE',
|
19
|
+
description: 'Database username'
|
20
|
+
|
21
|
+
option :pass,
|
22
|
+
short: '-p',
|
23
|
+
long: '--password=VALUE',
|
24
|
+
description: 'Database password'
|
25
|
+
|
26
|
+
option :ini,
|
27
|
+
description: 'My.cnf ini file',
|
28
|
+
short: '-i',
|
29
|
+
long: '--ini VALUE'
|
30
|
+
|
31
|
+
option :scheme,
|
32
|
+
description: 'Metric naming scheme, text to prepend to metric',
|
33
|
+
short: '-s SCHEME',
|
34
|
+
long: '--scheme SCHEME',
|
35
|
+
default: "#{Socket.gethostname}.mysql"
|
36
|
+
|
37
|
+
def run
|
38
|
+
if config[:ini]
|
39
|
+
ini = IniFile.load(config[:ini])
|
40
|
+
section = ini['client']
|
41
|
+
db_user = section['user']
|
42
|
+
db_pass = section['password']
|
43
|
+
else
|
44
|
+
db_user = config[:user]
|
45
|
+
db_pass = config[:pass]
|
46
|
+
end
|
47
|
+
db_host = config[:host]
|
48
|
+
mysql_shorthostname = db_host.split('.')[0]
|
49
|
+
|
50
|
+
if [db_host, db_user, db_pass].any?(&:nil?)
|
51
|
+
unknown 'Must specify host, user and password'
|
52
|
+
end
|
53
|
+
|
54
|
+
begin
|
55
|
+
db = Mysql.new(db_host, db_user, db_pass)
|
56
|
+
|
57
|
+
results = db.query <<-EOSQL
|
58
|
+
select table_schema,
|
59
|
+
count(*) as tables,
|
60
|
+
sum(table_rows) as rows,
|
61
|
+
sum(data_length) as data,
|
62
|
+
sum(index_length) as idx,
|
63
|
+
sum(data_length + index_length) as total_size
|
64
|
+
from information_schema.tables
|
65
|
+
where table_schema not in ("information_schema", "mysql", "performance_schema", "sys")
|
66
|
+
group by table_schema
|
67
|
+
EOSQL
|
68
|
+
|
69
|
+
unless results.nil?
|
70
|
+
results.each_hash do |row|
|
71
|
+
output "#{config[:scheme]}.#{mysql_shorthostname}.disk.#{row['table_schema']}.tables", row['tables']
|
72
|
+
output "#{config[:scheme]}.#{mysql_shorthostname}.disk.#{row['table_schema']}.rows", row['rows']
|
73
|
+
output "#{config[:scheme]}.#{mysql_shorthostname}.disk.#{row['table_schema']}.data", row['data']
|
74
|
+
output "#{config[:scheme]}.#{mysql_shorthostname}.disk.#{row['table_schema']}.idx", row['idx']
|
75
|
+
output "#{config[:scheme]}.#{mysql_shorthostname}.disk.#{row['table_schema']}.total_size", row['total_size']
|
76
|
+
end
|
77
|
+
end
|
78
|
+
ensure
|
79
|
+
db.close if db
|
80
|
+
end
|
81
|
+
|
82
|
+
ok
|
83
|
+
end
|
84
|
+
end
|
@@ -175,25 +175,37 @@ class MysqlGraphite < Sensu::Plugin::Metric::CLI::Graphite
|
|
175
175
|
'Handler_savepoint_rollback' => 'handlerSavepointRollback',
|
176
176
|
},
|
177
177
|
'innodb' => {
|
178
|
-
'Innodb_buffer_pool_pages_total' =>
|
179
|
-
'Innodb_buffer_pool_pages_free' =>
|
180
|
-
'Innodb_buffer_pool_pages_dirty' =>
|
181
|
-
'Innodb_buffer_pool_pages_data' =>
|
182
|
-
'
|
183
|
-
'
|
184
|
-
'
|
185
|
-
'
|
186
|
-
'
|
187
|
-
'
|
188
|
-
'
|
189
|
-
'
|
190
|
-
'
|
191
|
-
'
|
192
|
-
'
|
193
|
-
'
|
194
|
-
'
|
195
|
-
'
|
196
|
-
'
|
178
|
+
'Innodb_buffer_pool_pages_total' => 'bufferTotal_pages',
|
179
|
+
'Innodb_buffer_pool_pages_free' => 'bufferFree_pages',
|
180
|
+
'Innodb_buffer_pool_pages_dirty' => 'bufferDirty_pages',
|
181
|
+
'Innodb_buffer_pool_pages_data' => 'bufferUsed_pages',
|
182
|
+
'Innodb_buffer_pool_pages_flushed' => 'bufferFlushed_pages',
|
183
|
+
'Innodb_buffer_pool_pages_misc' => 'bufferMisc_pages',
|
184
|
+
'Innodb_buffer_pool_bytes_data' => 'bufferUsed_bytes',
|
185
|
+
'Innodb_buffer_pool_bytes_dirty' => 'bufferDirty_bytes',
|
186
|
+
'Innodb_buffer_pool_read_ahead_rnd' => 'bufferReadAheadRnd',
|
187
|
+
'Innodb_buffer_pool_read_ahead' => 'bufferReadAhead',
|
188
|
+
'Innodb_buffer_pool_read_ahead_evicted' => 'bufferReadAheadEvicted',
|
189
|
+
'Innodb_buffer_pool_read_requests' => 'bufferReadRequests',
|
190
|
+
'Innodb_buffer_pool_reads' => 'bufferReads',
|
191
|
+
'Innodb_buffer_pool_wait_free' => 'bufferWaitFree',
|
192
|
+
'Innodb_buffer_pool_write_requests' => 'bufferWriteRequests',
|
193
|
+
'innodb_buffer_pool_size' => 'poolSize',
|
194
|
+
'Innodb_page_size' => 'pageSize',
|
195
|
+
'Innodb_pages_created' => 'pagesCreated',
|
196
|
+
'Innodb_pages_read' => 'pagesRead',
|
197
|
+
'Innodb_pages_written' => 'pagesWritten',
|
198
|
+
'Innodb_row_lock_current_waits' => 'currentLockWaits',
|
199
|
+
'Innodb_row_lock_waits' => 'lockWaitTimes',
|
200
|
+
'Innodb_row_lock_time' => 'rowLockTime',
|
201
|
+
'Innodb_data_reads' => 'fileReads',
|
202
|
+
'Innodb_data_writes' => 'fileWrites',
|
203
|
+
'Innodb_data_fsyncs' => 'fileFsyncs',
|
204
|
+
'Innodb_log_writes' => 'logWrites',
|
205
|
+
'Innodb_rows_updated' => 'rowsUpdated',
|
206
|
+
'Innodb_rows_read' => 'rowsRead',
|
207
|
+
'Innodb_rows_deleted' => 'rowsDeleted',
|
208
|
+
'Innodb_rows_inserted' => 'rowsInserted',
|
197
209
|
},
|
198
210
|
'configuration' => {
|
199
211
|
'max_connections' => 'MaxConnections',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-mysql-boutetnico
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
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: 2020-06-
|
11
|
+
date: 2020-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inifile
|
@@ -191,6 +191,7 @@ executables:
|
|
191
191
|
- check-mysql-select-count.rb
|
192
192
|
- metrics-mysql-query-result-count.rb
|
193
193
|
- metrics-mysql-graphite.rb
|
194
|
+
- metrics-mysql-disk.rb
|
194
195
|
- check-mysql-status.rb
|
195
196
|
- metrics-mysql.rb
|
196
197
|
- check-mysql-replication-status.rb
|
@@ -219,6 +220,7 @@ files:
|
|
219
220
|
- bin/check-mysql-select-count.rb
|
220
221
|
- bin/check-mysql-status.rb
|
221
222
|
- bin/check-mysql-threads.rb
|
223
|
+
- bin/metrics-mysql-disk.rb
|
222
224
|
- bin/metrics-mysql-graphite.rb
|
223
225
|
- bin/metrics-mysql-multiple-select-count.rb
|
224
226
|
- bin/metrics-mysql-processes.rb
|