sensu-plugins-f5 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ca7e66765d6a69f4a49cc7c4b3cc1bad82799f60
4
+ data.tar.gz: 51338b441b4bc3a7f47661077f4abc564651af26
5
+ SHA512:
6
+ metadata.gz: 6fb1770e52c8439c7251bd3a057f70d9fafd0b59d34b73945c2f262e7612d1a4c3ede5a941340419e2ca9d2cf3dc16e12a273deae37b985c16c4f11ff7b88e87
7
+ data.tar.gz: aea9dc48719f7880df9c391d8289e01d43c86d3b9400e8184365f5f0ccefc720eaf79f28ae5f0f03f24d8c2273f64e5bca7f54c89b03fa638abbde768ef34827
@@ -0,0 +1,6 @@
1
+ #Change Log
2
+ This project adheres to [Semantic Versioning](http://semver.org/).
3
+
4
+ ## 0.0.1 - 2016-08-09
5
+ ### Added
6
+ - Initial release
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Sensu-Plugins
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,27 @@
1
+ ## sensu-plugins-f5
2
+
3
+ [![Build Status](https://travis-ci.org/smbambling/sensu-plugins-f5.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-f5)
4
+ [![Gem Version](https://badge.fury.io/rb/sensu-plugins-f5.svg)](http://badge.fury.io/rb/sensu-plugins-f5)
5
+ [![Code Climate](https://codeclimate.com/github/champain/sensu-plugins-f5/badges/gpa.svg)](https://codeclimate.com/github/champain/sensu-plugins-f5)
6
+ [![Test Coverage](https://codeclimate.com/github/champain/sensu-plugins-f5/badges/coverage.svg)](https://codeclimate.com/github/champain/sensu-plugins-f5)
7
+ [![Dependency Status](https://gemnasium.com/champain/sensu-plugins-f5.svg)](https://gemnasium.com/champain/sensu-plugins-f5)
8
+
9
+ ## Functionality
10
+
11
+ **check-f5-load.rb**
12
+ Checks the reported SNMP system load for an F5 load balancer
13
+
14
+ **check-f5-mem-pcnt.rb**
15
+ Checks the reported SNMP memory usage percentage for an F5 load balancer
16
+
17
+
18
+
19
+ ## Files
20
+ * check-f5-load.rb
21
+ * check-f5-mem-pcnt.rb
22
+
23
+ ## Usage
24
+
25
+ ## Installation
26
+
27
+ [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env ruby
2
+ # F5 BigIP Load Check
3
+ # ===
4
+ #
5
+ # Checks the reported SNMP system load for F5 BigIP
6
+ # load balancer
7
+ #
8
+ # DEPENDENCIES:
9
+ # gem: sensu-plugin
10
+ # gem: snmp
11
+ #
12
+ # USAGE:
13
+ #
14
+ # check-f5-load -h host -C community -p prefix
15
+ #
16
+
17
+ require 'sensu-plugin/check/cli'
18
+ require 'snmp'
19
+
20
+ class CheckF5Load < Sensu::Plugin::Check::CLI
21
+ option :host,
22
+ short: '-h host',
23
+ boolean: true,
24
+ default: '127.0.0.1',
25
+ required: true
26
+
27
+ option :community,
28
+ short: '-C snmp community',
29
+ boolean: true,
30
+ default: 'public'
31
+
32
+ option :snmp_version,
33
+ short: '-v version',
34
+ description: 'SNMP version to use (SNMPv1, SNMPv2c (default))',
35
+ default: 'SNMPv2c'
36
+
37
+ option :warn,
38
+ description: 'Warning load average threshold',
39
+ short: '-w VALUE',
40
+ long: '--warning VALUE',
41
+ default: '90',
42
+ required: true
43
+
44
+ option :crit,
45
+ description: 'Critical load average threshold',
46
+ short: '-c VALUE',
47
+ long: '--critical VALUE',
48
+ default: '95',
49
+ required: true
50
+
51
+ def run
52
+ per_cpu_usage_mib = '1.3.6.1.4.1.3375.2.1.7.5.2.1.11'
53
+ total_cpu_usage = 0
54
+ total_cpu_count = 0
55
+ begin
56
+ manager = SNMP::Manager.new(host: config[:host].to_s, community: config[:community].to_s, version: config[:snmp_version].to_sym)
57
+ manager.walk([per_cpu_usage_mib.to_s]) do |usage|
58
+ total_cpu_count += 1
59
+ usage.each do |per_cpu_usage|
60
+ total_cpu_usage += per_cpu_usage.value.to_i
61
+ end
62
+ end
63
+ rescue SNMP::RequestTimeout
64
+ unknown "#{config[:host]} not responding"
65
+ rescue => e
66
+ unknown "An unknown error occured: #{e.inspect}"
67
+ end
68
+ manager.close
69
+
70
+ cpu_usage_avg = total_cpu_usage / total_cpu_count
71
+ if cpu_usage_avg >= config[:crit].to_f
72
+ critical "Load average #{cpu_usage_avg}"
73
+ elsif cpu_usage_avg >= config[:warn].to_f
74
+ warning "Load average #{cpu_usage_avg}"
75
+ else
76
+ ok "Load average #{cpu_usage_avg}"
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env ruby
2
+ # F5 BigIP SNMP Memory Check
3
+ # ===
4
+ #
5
+ # Checks the reported SNMP memory usage percentage for an F5 BigIP
6
+ # load balancer
7
+ #
8
+ # DEPENDENCIES:
9
+ # gem: sensu-plugin
10
+ # gem: snmp
11
+ #
12
+ # USAGE:
13
+ #
14
+ # check-f5-mem-pcnt.rb -h host -C community
15
+ #
16
+
17
+ require 'sensu-plugin/check/cli'
18
+ require 'snmp'
19
+
20
+ class CheckF5Memory < Sensu::Plugin::Check::CLI
21
+ option :host,
22
+ short: '-h host',
23
+ boolean: true,
24
+ default: '127.0.0.1',
25
+ required: true
26
+
27
+ option :community,
28
+ short: '-C snmp community',
29
+ boolean: true,
30
+ default: 'public'
31
+
32
+ option :snmp_version,
33
+ short: '-v version',
34
+ description: 'SNMP version to use (SNMPv1, SNMPv2c (default))',
35
+ default: 'SNMPv2c'
36
+
37
+ option :mem_warn,
38
+ description: 'Warning memory usage percentage threshold',
39
+ short: '-w VALUE',
40
+ long: '--mem_warning VALUE',
41
+ default: '85',
42
+ required: true
43
+
44
+ option :mem_crit,
45
+ description: 'Critical memory usage percentage threshold',
46
+ short: '-c VALUE',
47
+ long: '--mem_critical VALUE',
48
+ default: '90',
49
+ required: true
50
+
51
+ option :swap_warn,
52
+ description: 'Warning swap usage percentage threshold',
53
+ short: '-x VALUE',
54
+ long: '--swap_warning VALUE',
55
+ default: '20',
56
+ required: true
57
+
58
+ option :swap_crit,
59
+ description: 'Critical swap usage percentage threshold',
60
+ short: '-y VALUE',
61
+ long: '--swap_critical VALUE',
62
+ default: '30',
63
+ required: true
64
+
65
+ def run
66
+ metrics = {
67
+ '1.3.6.1.4.1.3375.2.1.1.2.1.45.0' => 'mem.used',
68
+ '1.3.6.1.4.1.3375.2.1.1.2.1.44.0' => 'mem.total',
69
+ '1.3.6.1.4.1.3375.2.1.1.2.20.47.0' => 'swap.used',
70
+ '1.3.6.1.4.1.3375.2.1.1.2.20.46.0' => 'swap.total'
71
+ }
72
+ response_hash = {}
73
+ metrics.each do |objectid, suffix|
74
+ begin
75
+ manager = SNMP::Manager.new(host: config[:host].to_s, community: config[:community].to_s, version: config[:snmp_version].to_sym)
76
+ response = manager.get([objectid.to_s])
77
+ rescue SNMP::RequestTimeout
78
+ unknown "#{config[:host]} not responding"
79
+ rescue => e
80
+ unknown "An unknown error occured: #{e.inspect}"
81
+ end
82
+ response.each_varbind do |vb|
83
+ response_hash[suffix.to_s] = vb.value.to_f
84
+ end
85
+ manager.close
86
+ end
87
+
88
+ mem_pct_used = ((response_hash['mem.used'] / response_hash['mem.total']) * 100).round.to_i
89
+ swap_pct_used = ((response_hash['swap.used'] / response_hash['swap.total']) * 100).to_i
90
+
91
+ if mem_pct_used >= config[:mem_crit].to_i || swap_pct_used >= config[:swap_crit].to_i
92
+ critical "Active TMM Memory Usage: #{mem_pct_used}% -- Swap Usage: #{swap_pct_used}%"
93
+ elsif mem_pct_used >= config[:mem_warn].to_i || swap_pct_used >= config[:swap_warn].to_i
94
+ warning "Active TMM Memory Usage: #{mem_pct_used}% -- Swap Usage: #{swap_pct_used}%"
95
+ else
96
+ ok "Active TMM Memory Usage: #{mem_pct_used}% -- Swap Usage: #{swap_pct_used}%"
97
+ end
98
+ end
99
+ end
@@ -0,0 +1 @@
1
+ require 'sensu-plugins-f5/version'
@@ -0,0 +1,9 @@
1
+ module SensuPluginsF5
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ PATCH = 1
6
+
7
+ VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,212 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-f5
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sensu-Plugins and contributors
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-06-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sensu-plugin
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: snmp
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codeclimate-test-reporter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: github-markup
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.10'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.10'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '10.5'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '10.5'
111
+ - !ruby/object:Gem::Dependency
112
+ name: redcarpet
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.2'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.2'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.40.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.40.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '3.4'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '3.4'
153
+ - !ruby/object:Gem::Dependency
154
+ name: yard
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '0.8'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '0.8'
167
+ description: Sensu plugins for F5
168
+ email: "<sensu-users@googlegroups.com>"
169
+ executables:
170
+ - check-f5-mem-pcnt.rb
171
+ - check-f5-load.rb
172
+ extensions: []
173
+ extra_rdoc_files: []
174
+ files:
175
+ - CHANGELOG.md
176
+ - LICENSE
177
+ - README.md
178
+ - bin/check-f5-load.rb
179
+ - bin/check-f5-mem-pcnt.rb
180
+ - lib/sensu-plugins-f5.rb
181
+ - lib/sensu-plugins-f5/version.rb
182
+ homepage: https://github.com/sensu-plugins/sensu-plugins-f5
183
+ licenses:
184
+ - MIT
185
+ metadata:
186
+ maintainer: sensu-plugin
187
+ development_status: active
188
+ production_status: unstable - testing recommended
189
+ release_draft: 'false'
190
+ release_prerelease: 'false'
191
+ post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
192
+ in /etc/default/sensu
193
+ rdoc_options: []
194
+ require_paths:
195
+ - lib
196
+ required_ruby_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: 1.9.3
201
+ required_rubygems_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ requirements: []
207
+ rubyforge_project:
208
+ rubygems_version: 2.5.1
209
+ signing_key:
210
+ specification_version: 4
211
+ summary: Sensu plugins for F5
212
+ test_files: []