sumo-check-sumo 0.0.30 → 0.0.31

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
- SHA1:
3
- metadata.gz: 636061ccb1bcb2eb4cbb9b1784e067a402030399
4
- data.tar.gz: 7ea3c27ed58453988ba07648e263c7af45fe05a3
2
+ SHA256:
3
+ metadata.gz: 4fc8939a3f8273eadff06ea6d54f023cdca792635a6336f0b070be760349e661
4
+ data.tar.gz: b67502d741a74cdd27eb76a8ad7aab0cfe8f44302b54218e2d2f55881c9f0c9b
5
5
  SHA512:
6
- metadata.gz: 283981a37c0d86c1d4bf633bd199d9c54233ed417ffd110a3dac486b8f2fd07b3405692a1950858945ae9916c2b22d9bdd1b0ee640ac49d9aa095d6d2ec63872
7
- data.tar.gz: f782721101b3e9ea632f47490e4a4fb39f25d65776c591589aa798867a6e2bdf212dfee7f5d08fe2b41bc1d0ec93cf37c2c89297c1d8af340642d711fa00c1c9
6
+ metadata.gz: 93ea46b6cd0e4ccde094faab596ddc14d3f2b74bd47ca9717463c7a4dba023f258ad44f30cea78862c5d2f10645483cec975791f8f8641b222b88a611ac17273
7
+ data.tar.gz: 33035df3fd1eba5b0cb304644247ee733e12e67e5fd8976ba9753667e8a446a7a05f101d637789017f4517dee958fe80990d7e62c6aac1ab0b70dd0ad0268f75
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+
4
+ require 'sensu-plugin/metric/cli'
5
+ require 'mysql2'
6
+ require 'inifile'
7
+
8
+ class SumoMessageCenterCampaignMetrics < Sensu::Plugin::Metric::CLI::Graphite
9
+
10
+ def run
11
+ ini = IniFile.load('/root/.my.cnf')
12
+ check_prefix_name="SumoMessageCenterCampaignMetrics"
13
+ section = ini['client']
14
+ db_user = section['user']
15
+ db_pass = section['password']
16
+ db = Mysql2::Client.new(:host => "127.0.0.1", :username => db_user, :database => "sumome", :password => db_pass)
17
+ metrics = ["timedout", "template", "sent", "sending", "scheduled", "queued", "paused", "frozen", "error", "draft" ]
18
+ metrics.each do |m|
19
+ result = db.query("SELECT COUNT(*) as count FROM MessageCenterCampaign WHERE state='#{m}' AND created_at < DATE_SUB(NOW(), INTERVAL 10 minute);")
20
+ if result.count > 0
21
+ output "#{check_prefix_name}.#{m}.count".tr(' ', '_'),result.first["count"].to_i,Time.now.to_i
22
+ end
23
+ end
24
+ ok
25
+ rescue Mysql2::Error => e
26
+ errstr = "Error code: #{e.errno} Error message: #{e.error}"
27
+ critical "#{errstr} SQLSTATE: #{e.sqlstate}" if e.respond_to?('sqlstate')
28
+ rescue => e
29
+ critical e
30
+ ensure
31
+ db.close if db
32
+ end
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sumo-check-sumo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.30
4
+ version: 0.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr. Ogg
@@ -124,9 +124,11 @@ executables:
124
124
  - sumo-check-message-center.rb
125
125
  - sumo-check-SumoMailEmail.rb
126
126
  - sumo-SumoMailEmail-metrics.rb
127
+ - sumo-MessageCenterCampaign-metrics.rb
127
128
  extensions: []
128
129
  extra_rdoc_files: []
129
130
  files:
131
+ - bin/sumo-MessageCenterCampaign-metrics.rb
130
132
  - bin/sumo-SumoMailEmail-metrics.rb
131
133
  - bin/sumo-check-SumoMailEmail.rb
132
134
  - bin/sumo-check-docker.rb
@@ -155,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
157
  version: '0'
156
158
  requirements: []
157
159
  rubyforge_project:
158
- rubygems_version: 2.6.13
160
+ rubygems_version: 2.7.6.2
159
161
  signing_key:
160
162
  specification_version: 4
161
163
  summary: Sumo Sensu gem for testing our front end website