Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion check_azure_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def _set_cli_options(self):
self.add_arg('M', 'metric', 'Metric')
self.add_arg('D', 'dimension', 'Metric dimension', required=None)
self.add_arg('V', 'dimension-value', 'Metric dimension value', required=None)
self.add_arg('I', 'inverse-flag', 'Inverted metric flag', required=None)

def activate(self):
"""Parse out all command line options and get ready to process the plugin."""
Expand Down Expand Up @@ -201,7 +202,10 @@ def check_metric(self):
if self['dimension'] is not None:
message += ' and dimension {}'.format(self['dimension'])
self.nagios_exit(Plugins.UNKNOWN, message)


if self['inverse-flag'] is not None:
value := -value;

status = Plugins.check_threshold(value, warning=self['warning'], critical=self['critical'])

unit = self._AZURE_METRICS_UNIT_SYMBOLS.get(self._metric_properties['unit'])
Expand Down