riemann-babbler 2.0.5 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/riemann/babbler/plugin_loader.rb +1 -0
- data/lib/riemann/babbler/plugins/iptables.rb +30 -0
- data/lib/riemann/babbler/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8076b21e91b26cb3d8323585c13ae84de045a4ec
|
4
|
+
data.tar.gz: 959a7ecac63b0dadd24f9a2d8abdf763a71b6472
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 071a83b298c637d3bd27f28853a7602e4a38a9d0e8a80861c476fdc7a387b5e36d1f36df952a6ef0e27bd9803817a7c84e39c2285c97fa9509532cf03c858a33
|
7
|
+
data.tar.gz: 612abe7638ace391e9a70cb978e3cee95499e0632a398d258bb594bd7b7c58ab55d002fb42ba033c274beefb0ae26db69d764ec1cdb66144fc27d2f8c50997a1
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
class Riemann::Babbler::Plugin::Iptables < Riemann::Babbler::Plugin
|
2
|
+
|
3
|
+
def init
|
4
|
+
plugin.set_default(:service, 'iptables')
|
5
|
+
plugin.set_default(:rules_file, '/etc/network/iptables')
|
6
|
+
plugin.set_default(:interval, 60)
|
7
|
+
end
|
8
|
+
|
9
|
+
def run_plugin
|
10
|
+
File.exists? plugin.rules_file
|
11
|
+
end
|
12
|
+
|
13
|
+
def collect
|
14
|
+
|
15
|
+
current_rules = shell('iptables-save | grep -v "^#"').split("\n").map {|x| x.strip}.compact.join("\n")
|
16
|
+
|
17
|
+
saved_rules = File.read(plugin.rules_file).split("\n").map do |x|
|
18
|
+
x[0] == "#" ? nil : x.gsub(/\[\d+\:\d+\]/, '').strip # delete counters and comments
|
19
|
+
end.compact.join("\n")
|
20
|
+
|
21
|
+
status = current_rules == saved_rules ? 'ok' : 'critical'
|
22
|
+
{
|
23
|
+
:service => "#{plugin.service} #{plugin.rules_file}",
|
24
|
+
:state => status, # status 'ok' will be minimized
|
25
|
+
:description => "#{plugin.service} rules different between file: #{plugin.rules_file} and iptables-save"
|
26
|
+
}
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riemann-babbler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasiliev Dmitry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: riemann-client
|
@@ -245,6 +245,7 @@ files:
|
|
245
245
|
- lib/riemann/babbler/plugins/helpers/shell.rb
|
246
246
|
- lib/riemann/babbler/plugins/helpers/unixnow.rb
|
247
247
|
- lib/riemann/babbler/plugins/http.rb
|
248
|
+
- lib/riemann/babbler/plugins/iptables.rb
|
248
249
|
- lib/riemann/babbler/plugins/la.rb
|
249
250
|
- lib/riemann/babbler/plugins/mdadm.rb
|
250
251
|
- lib/riemann/babbler/plugins/mega_cli.rb
|