sensu-plugins-network-interface 0.1.15 → 0.1.16
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/bin/check-network-interface.rb +14 -12
- data/lib/sensu-plugins-network-interface/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75e3d53b507e92a7ef4af0a53d2381ee4bc3c334
|
4
|
+
data.tar.gz: f75407255f3311f3d392327b401df8fe12570dfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88d72ab67ae4caf164a7ceb09968c22a36b5e5da334913f2873ef8a86550a8f9460379357d0970b02c1b8f9a16962e86ba895f2a494ef6424de7c6349c1099dc
|
7
|
+
data.tar.gz: db1546326e0572e8ab48dcc9727d192ab9a72c7e841fc55de2a87198910bce8cd663d5a7b7fd220eee56440ff93060216c6fd081cba998dec7b3d0b938503df3
|
@@ -92,6 +92,15 @@ class CheckNetworkInterface < Sensu::Plugin::Check::CLI
|
|
92
92
|
def initialize()
|
93
93
|
super
|
94
94
|
|
95
|
+
@ifcfg_dir = nil
|
96
|
+
# RHEL
|
97
|
+
if File.directory?("/etc/sysconfig/network-scripts")
|
98
|
+
@ifcfg_dir = "/etc/sysconfig/network-scripts"
|
99
|
+
# SuSE
|
100
|
+
elsif File.directory?("/etc/sysconfig/network")
|
101
|
+
@ifcfg_dir = "/etc/sysconfig/network"
|
102
|
+
end
|
103
|
+
|
95
104
|
@interfaces = []
|
96
105
|
find_interfaces().each do |intf|
|
97
106
|
if config[:ignore_interface].size > 0
|
@@ -135,14 +144,6 @@ class CheckNetworkInterface < Sensu::Plugin::Check::CLI
|
|
135
144
|
end
|
136
145
|
end
|
137
146
|
|
138
|
-
@ifcfg_dir = nil
|
139
|
-
# RHEL
|
140
|
-
if File.directory?("/etc/sysconfig/network-scripts")
|
141
|
-
@ifcfg_dir = "/etc/sysconfig/network-scripts"
|
142
|
-
# SuSE
|
143
|
-
elsif File.directory?("/etc/sysconfig/network")
|
144
|
-
@ifcfg_dir = "/etc/sysconfig/network"
|
145
|
-
end
|
146
147
|
end
|
147
148
|
|
148
149
|
def send_client_socket(data)
|
@@ -178,13 +179,14 @@ class CheckNetworkInterface < Sensu::Plugin::Check::CLI
|
|
178
179
|
interfaces = Dir["/sys/class/net/*"].select { |i| File.symlink?(i) }.map { |i| File.basename(i) }.reject { |i| i =~ /^dummy/ }
|
179
180
|
|
180
181
|
if @ifcfg_dir
|
182
|
+
# Remove interfaces from Array interfaces where ONBOOT = no
|
181
183
|
Dir[@ifcfg_dir + "/ifcfg-*"].map { |i| File.basename(i) }.reject { |i| i =~ /^-range.*$/ }.each do |cfg|
|
182
184
|
content = File.read(@ifcfg_dir + "/" + cfg)
|
183
|
-
|
184
|
-
|
185
|
-
|
185
|
+
device = content[/^DEVICE=["']?([\w|\d]+)["']?/, 1]
|
186
|
+
onboot = content[/^ONBOOT=["']?([\w|\d]+)["']?/, 1].downcase == 'yes' ? true : false
|
187
|
+
interfaces.delete(device) unless onboot == true
|
188
|
+
end
|
186
189
|
end
|
187
|
-
|
188
190
|
interfaces
|
189
191
|
end
|
190
192
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-network-interface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matteo Cerutti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|