riemann-mysql-slave 0.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.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +14 -0
  4. data/bin/riemann-mysql-slave +41 -0
  5. metadata +74 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ede81897b1341109b9bb94446468c46d2cd32531
4
+ data.tar.gz: cae3c74f30c393cd43cdd50366c3df46b94f203c
5
+ SHA512:
6
+ metadata.gz: 4f90c6b3760f4ed449ef1d1e71aaaf419ca40303fd66dde77f19fb6f0b02c7b7d1cdec76ecbf3fd27288b1f91a6b7468c1b3ee160c9bb1787d1506fc9a7ba2aa
7
+ data.tar.gz: b3dc4e0956045d13516dd990543fdbaa4080ea525d1bb9bab3026bd84eaffca71cd35fa138e6de964d45b0ab395dbcc7719892453f575c7adb4d1867bf37d51b
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2011 Kyle Kingsbury
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ Riemann Slave Mysql
2
+ ===================
3
+
4
+ Simple MySql Slave riemann client.
5
+
6
+ Submits the result of SHOW SLAVE STATUS query into riemann.
7
+
8
+ Get started
9
+ ==========
10
+
11
+ ``` bash
12
+ gem install riemann-mysql-slave
13
+ riemann-mysql-slave --help
14
+ ```
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Gathers mysql STATUS and submits them to Riemann.
4
+
5
+ require 'riemann/tools'
6
+
7
+ class Riemann::Tools::MysqlSlave
8
+ require 'mysql2'
9
+ include Riemann::Tools
10
+
11
+ opt :mysql_host, "MySQL hostname", :default => 'localhost'
12
+ opt :mysql_port, "MySQL port", :default => 3306
13
+ opt :mysql_username, "MySQL username", :default => ''
14
+ opt :mysql_password, "MySQL password", :default => ''
15
+
16
+ def initialize
17
+ options = { :host => opts[:mysql_host],
18
+ :port => opts[:mysql_port],
19
+ :username => opts[:mysql_username],
20
+ :password => opts[:mysql_password],
21
+ :reconnect => true }
22
+ @mysql = ::Mysql2::Client.new(options)
23
+ end
24
+
25
+ def tick
26
+ begin
27
+ @mysql.query("SHOW SLAVE STATUS;").each do |var|
28
+ data = {
29
+ :host => opts[:mysql_host],
30
+ :service => "mysql #{var["Variable_name"]}",
31
+ :metric => var["Value"],
32
+ :tags => ["mysql"]
33
+ }
34
+ report(data)
35
+ end
36
+ end
37
+ end
38
+
39
+ end
40
+
41
+ Riemann::Tools::MysqlSlave.run
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: riemann-mysql-slave
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Christian Blunden
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: riemann-tools
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.9
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.9
27
+ - !ruby/object:Gem::Dependency
28
+ name: mysql2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.13
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.3.13
41
+ description:
42
+ email: christian.blunden@uswitch.com
43
+ executables:
44
+ - riemann-mysql-slave
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - bin/riemann-mysql-slave
49
+ - LICENSE
50
+ - README.md
51
+ homepage: https://github.com/uswitch/riemann-mysql-slave
52
+ licenses: []
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 1.8.7
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project: riemann-mysql-slave
70
+ rubygems_version: 2.1.10
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: MySQL client that submit slave status events to Riemann.
74
+ test_files: []