2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2015 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
27 factory_settings
['levels_azure_sites'] = {
28 # https://www.nngroup.com/articles/response-times-3-important-limits/
29 'avg_response_time_levels': (1.0, 10.0),
30 # https://www.unigma.com/2016/07/11/best-practices-for-monitoring-microsoft-azure/
31 'error_rate_levels': (0.01, 0.04),
32 'cpu_time_percent_levels': (85., 95.),
35 _AZURE_SITES_METRICS
= ( # metric_key, cmk_key, display_name, use_rate_flag
36 ('total_CpuTime', 'cpu_time_percent', 'CPU time', True),
37 ('total_AverageResponseTime', 'avg_response_time', 'Average response time', False),
38 ('total_Http5xx', 'error_rate', 'Rate of server errors', True),
43 def check_azure_sites(_item
, params
, resource
):
45 for key
, cmk_key
, displ
, use_rate
in _AZURE_SITES_METRICS
:
46 levels
= params
.get("%s_levels" % cmk_key
, (None, None))
47 mcheck
= check_azure_metric(
48 resource
, key
, cmk_key
, displ
, levels
=levels
, minv
=0, use_rate
=use_rate
)
52 for kv_pair
in azure_iter_informative_attrs(resource
):
53 yield 0, "%s: %s" % kv_pair
56 check_info
['azure_sites'] = {
57 'parse_function': parse_azure
,
58 'inventory_function': discover(),
59 'check_function': check_azure_sites
,
61 'service_description': "Site %s",
62 'includes': ['azure.include'],
63 'default_levels_variable': 'levels_azure_sites',