Allow filtering by domain
This commit is contained in:
parent
e3d9312a1e
commit
37d091c3da
@ -66,6 +66,7 @@ class AttributeFilter:
|
||||
class Entities(nagiosplugin.Resource):
|
||||
url: str
|
||||
token: str
|
||||
domain: str
|
||||
device_class: str
|
||||
numeric: bool
|
||||
area: str
|
||||
@ -149,6 +150,8 @@ class Entities(nagiosplugin.Resource):
|
||||
|
||||
def probe(self):
|
||||
template_filter = "states"
|
||||
if self.domain:
|
||||
template_filter += f"|selectattr('domain', 'eq', '{ self.domain }')"
|
||||
if self.device_class:
|
||||
template_filter += (
|
||||
f"|selectattr('attributes.device_class', 'eq', '{ self.device_class }')"
|
||||
@ -351,6 +354,12 @@ def main():
|
||||
common_args = shared_parser.add_argument_group(
|
||||
"Common Arguments", "Arguments shared between metric types"
|
||||
)
|
||||
common_args.add_argument(
|
||||
"--domain",
|
||||
type=str,
|
||||
required=False,
|
||||
help="domain of entities to monitor",
|
||||
)
|
||||
common_args.add_argument(
|
||||
"-d",
|
||||
"--device-class",
|
||||
|
Loading…
x
Reference in New Issue
Block a user