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
7 changes: 3 additions & 4 deletions check_azure_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class NagiosAzureResourceMonitor(Plugin):
"""Implements functionalities to grab metrics from Azure resource objects."""

DEFAULT_AZURE_SERVICE_HOST = 'management.azure.com'
_AZURE_METRICS_API = '2017-05-01-preview'
_AZURE_METRICS_API = '2018-01-01'
_AZURE_METRICS_UNIT_SYMBOLS = {'Percent': '%', 'Bytes': 'B', 'Seconds': 's'}

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -166,12 +166,11 @@ def _is_dimension_required(self):
def _get_metric_value(self):
"""Get latest metric value available for the Azure resource object."""

query = {'metric': self['metric']}
query = {'metricnames': self['metric']}
if self['dimension'] is not None:
query['$filter'] = "{} eq '{}'".format(self['dimension'], self['dimension-value'])

path = '{}/providers/Microsoft.Insights/metrics/{}'.format(self['resource'],
self['metric'])
path = '{}/providers/Microsoft.Insights/metrics/'.format(self['resource'])

try:
metric_values = _call_arm_rest_api(self._client, path,
Expand Down