MonitoringPlugin: add args2checks() for quad check notation
copied from check_naf.py
This commit is contained in:
parent
af6b9daf16
commit
195b0c5b90
|
@ -80,6 +80,41 @@ class MonitoringPlugin(object):
|
||||||
self._cmdlineoptions_parsed = True
|
self._cmdlineoptions_parsed = True
|
||||||
|
|
||||||
|
|
||||||
|
def args2checks(self):
|
||||||
|
checks = []
|
||||||
|
try:
|
||||||
|
separator = self.options.separator
|
||||||
|
except AttributeError:
|
||||||
|
separator = ','
|
||||||
|
|
||||||
|
try:
|
||||||
|
subseparator = self.options.subseparator
|
||||||
|
except AttributeError:
|
||||||
|
subseparator = '+'
|
||||||
|
|
||||||
|
for quad in self.args:
|
||||||
|
quad = quad.split(separator)
|
||||||
|
quad = (quad + ['', '', ''])[:4] # Fix length to 4, fill with ''
|
||||||
|
|
||||||
|
# Convert list of checks to list
|
||||||
|
if subseparator in quad[0]:
|
||||||
|
quad[0] = quad[0].split(subseparator)
|
||||||
|
else:
|
||||||
|
quad[0] = [quad[0],]
|
||||||
|
|
||||||
|
# Convert list of targets to list
|
||||||
|
if subseparator in quad[1]:
|
||||||
|
quad[1] = quad[1].split(subseparator)
|
||||||
|
else:
|
||||||
|
quad[1] = [quad[1],]
|
||||||
|
|
||||||
|
for target in quad[1]:
|
||||||
|
for check in quad[0]:
|
||||||
|
checks.append(tuple([check, target, quad[2], quad[3]]))
|
||||||
|
|
||||||
|
return(checks)
|
||||||
|
|
||||||
|
|
||||||
def range_to_limits(self, range):
|
def range_to_limits(self, range):
|
||||||
# Check if we must negate result
|
# Check if we must negate result
|
||||||
if len(range) > 0 and range[0] == '@':
|
if len(range) > 0 and range[0] == '@':
|
||||||
|
|
Loading…
Reference in a new issue