sensu-plugins-openbsd 1.0.4 → 1.0.5
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.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/bin/check-bgpd.rb +53 -0
- data/bin/check-ntp.rb +1 -1
- data/lib/sensu-plugins-openbsd/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 109efa3bb9b2d1773a2cd0cd7728363cdf6c1d9420dd0bb67978afdd59f7c12c
|
4
|
+
data.tar.gz: c87f1ba88565e60e0bdf305c745b9b19ef3895d223d84463b1ea9a5133b8748b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83c9db762ca15e1fb6c0c96bd97232d42d0ea92f38c80c0b2d477757815b4f9f8e57163fa27591d61f6ad21a1e630474678708cf01f0200fb99ffdf0d22172d3
|
7
|
+
data.tar.gz: f227d5db0d317532ccf8b1b6c35969935820c76c6e8e7bdd574a814114d686e221b64152efc9379594451820458c63d1825d7fb0001a6ce29dc31f4a72f5f957
|
data/README.md
CHANGED
@@ -3,6 +3,13 @@
|
|
3
3
|
[](https://travis-ci.org/Sigterm-no/sensu-plugins-openbsd)
|
4
4
|
[](https://badge.fury.io/rb/sensu-plugins-openbsd)
|
5
5
|
|
6
|
+
## Checks
|
7
|
+
|
8
|
+
* `bin/check-bgpd.rb` - A check for OpenBGPd peers health
|
9
|
+
* `bin/check-cmd.rb` - A check that runs a choosen command and can regex it's output
|
10
|
+
* `bin/check-ntp.rb` - A check that queries ntpctl
|
11
|
+
* `bin/check-process.rb` - A check to find running processes
|
12
|
+
|
6
13
|
## Installation
|
7
14
|
|
8
15
|
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
data/bin/check-bgpd.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# check-bgpd
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
#
|
7
|
+
# OUTPUT:
|
8
|
+
# plain text
|
9
|
+
#
|
10
|
+
# PLATFORMS:
|
11
|
+
# OpenBSD
|
12
|
+
#
|
13
|
+
# DEPENDENCIES:
|
14
|
+
# gem: sensu-plugin
|
15
|
+
|
16
|
+
require 'sensu-plugin/check/cli'
|
17
|
+
|
18
|
+
class CheckOpenBGPd < Sensu::Plugin::Check::CLI
|
19
|
+
option :warn,
|
20
|
+
short: '-w WARN',
|
21
|
+
description: 'Percetage of peers in a connecting/not-working state before warning',
|
22
|
+
proc: proc(&:to_f),
|
23
|
+
default: 50
|
24
|
+
|
25
|
+
option :crit,
|
26
|
+
short: '-c CRIT',
|
27
|
+
description: 'Percetage of peers in a connecting/not-working state before critical',
|
28
|
+
proc: proc(&:to_f),
|
29
|
+
default: 90
|
30
|
+
|
31
|
+
def run
|
32
|
+
begin
|
33
|
+
num_peers = `bgpctl show | egrep -v "Connect$|Active$" | tail -n +2 | wc -l`.strip.to_i
|
34
|
+
num_issue_peers = `bgpctl show | egrep '(Active|Connect)$' | wc -l`.strip.to_i
|
35
|
+
num_fib_routes = `bgpctl show fib | tail -n +6 | wc -l`.strip.to_i
|
36
|
+
num_rib_routes = `bgpctl show rib | tail -n +7 | wc -l`.strip.to_i
|
37
|
+
|
38
|
+
total_peers = num_peers + num_issue_peers
|
39
|
+
peers_success_ratio = ((num_peers.to_f / total_peers.to_f) * 100).truncate(2)
|
40
|
+
|
41
|
+
message = "OpenBGPd running with #{total_peers} peers, "
|
42
|
+
message << "#{peers_success_ratio}% (#{num_issue_peers}) in a connecting or errored state, "
|
43
|
+
message << "#{num_fib_routes}. Knows FIB routes and #{num_rib_routes} RIB routes."
|
44
|
+
rescue StandardError => e
|
45
|
+
unknown "OpenBGPd command Failed: #{e}"
|
46
|
+
end
|
47
|
+
|
48
|
+
critical message if num_peers.zero?
|
49
|
+
critical message if peers_success_ratio >= config[:crit] || peers_success_ratio <= -config[:crit]
|
50
|
+
warning message if peers_success_ratio >= config[:warn] || peers_success_ratio <= -config[:warn]
|
51
|
+
ok message
|
52
|
+
end
|
53
|
+
end
|
data/bin/check-ntp.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-openbsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu-Plugins and contributors
|
@@ -170,12 +170,14 @@ executables:
|
|
170
170
|
- check-ntp.rb
|
171
171
|
- check-process.rb
|
172
172
|
- check-cmd.rb
|
173
|
+
- check-bgpd.rb
|
173
174
|
extensions: []
|
174
175
|
extra_rdoc_files: []
|
175
176
|
files:
|
176
177
|
- CHANGELOG.md
|
177
178
|
- LICENSE
|
178
179
|
- README.md
|
180
|
+
- bin/check-bgpd.rb
|
179
181
|
- bin/check-cmd.rb
|
180
182
|
- bin/check-ntp.rb
|
181
183
|
- bin/check-process.rb
|