diff --git a/README.rst b/README.rst index 26daa01..f806ffe 100644 --- a/README.rst +++ b/README.rst @@ -44,20 +44,36 @@ Server installed with PostgreSQL database user: grafana password: passwd -Server installed with default StackLight JSON dashboards +Server installed with default StackLight JSON dashboards. This will +be replaced by the possibility for a service to provide its own dashboard +using salt-mine. .. code-block:: yaml grafana: server: enabled: true - admin: - user: admin - password: passwd dashboards: enabled: true path: /var/lib/grafana/dashboards +Server with theme overrides + +.. code-block:: yaml + + grafana: + server: + enabled: true + theme: + light: + css_override: + source: http://path.to.theme + source_hash: sha256=xyz + build: xyz + dark: + css_override: + source: salt://path.to.theme + Collector setup --------------- @@ -74,7 +90,7 @@ Used to aggregate dashboards from monitoring node. Client setups ------------- -Client enforced data sources +Client with token based auth .. code-block:: yaml @@ -86,12 +102,43 @@ Client enforced data sources host: grafana.host port: 3000 token: token + +Client with base auth + +.. code-block:: yaml + + grafana: + client: + enabled: true + server: + protocol: https + host: grafana.host + port: 3000 + user: admin + password: password + +Client enforcing graphite data source + +.. code-block:: yaml + + grafana: + client: + enabled: true datasource: graphite: type: graphite host: mtr01.domain.com protocol: https port: 443 + +Client enforcing elasticsearch data source + +.. code-block:: yaml + + grafana: + client: + enabled: true + datasource: elasticsearch: type: elasticsearch host: log01.domain.com @@ -157,7 +204,7 @@ The default format of Grafana dashboards with lists for rows, panels and targets span: 6 editable: false type: graph - targets: + targets: - refId: A target: "support_prd.cfg01_iot_tcpcloud_eu.cpu.0.idle" datasource: graphite01 diff --git a/_states/grafana3_dashboard.py b/_states/grafana3_dashboard.py new file mode 100644 index 0000000..63090ab --- /dev/null +++ b/_states/grafana3_dashboard.py @@ -0,0 +1,584 @@ +# -*- coding: utf-8 -*- +''' +Manage Grafana v3.0 Dashboards + +.. versionadded:: 2016.3.0 + +.. code-block:: yaml + + grafana: + grafana_timeout: 3 + grafana_token: qwertyuiop + grafana_url: 'https://url.com' + +.. code-block:: yaml + + Ensure minimum dashboard is managed: + grafana_dashboard.present: + - name: insightful-dashboard + - base_dashboards_from_pillar: + - default_dashboard + - base_rows_from_pillar: + - default_row + - base_panels_from_pillar: + - default_panel + - dashboard: + rows: + - title: Usage + panels: + - targets: + - target: alias(constantLine(50), 'max') + title: Imaginary + type: graph + + +The behavior of this module is to create dashboards if they do not exist, to +add rows if they do not exist in existing dashboards, and to update rows if +they exist in dashboards. The module will not manage rows that are not defined, +allowing users to manage their own custom rows. +''' + +# Import Python libs +from __future__ import absolute_import +import copy +import json +import requests + +# Import Salt libs +import salt.ext.six as six +from salt.utils.dictdiffer import DictDiffer + + +def __virtual__(): + '''Only load if grafana v2.0 is configured.''' + return __salt__['config.get']('grafana_version', 1) == 3 + + +_DEFAULT_DASHBOARD_PILLAR = 'grafana_dashboards:default' +_DEFAULT_PANEL_PILLAR = 'grafana_panels:default' +_DEFAULT_ROW_PILLAR = 'grafana_rows:default' +_PINNED_ROWS_PILLAR = 'grafana_pinned_rows' + + +def present(name, + base_dashboards_from_pillar=None, + base_panels_from_pillar=None, + base_rows_from_pillar=None, + dashboard=None, + dashboard_format='yaml', + profile='grafana'): + ''' + Ensure the grafana dashboard exists and is managed. + + name + Name of the grafana dashboard. + + base_dashboards_from_pillar + A pillar key that contains a list of dashboards to inherit from + + base_panels_from_pillar + A pillar key that contains a list of panels to inherit from + + base_rows_from_pillar + A pillar key that contains a list of rows to inherit from + + dashboard + A dict that defines a dashboard that should be managed. + + dashboard_format + You can use two formats for dashboards. You can use the JSON format + if you provide a complete dashboard in raw JSON or you can use the YAML + format (this is the default) and provide a description of the + dashboard in YAML. + + profile + A pillar key or dict that contains grafana information + ''' + ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} + dashboard = dashboard or {} + + if isinstance(profile, six.string_types): + profile = __salt__['config.option'](profile) + + if dashboard_format == 'json': + # In this case, a raw JSON of the full dashboard is provided. + response = _update(dashboard, profile) + + if response.get('status') == 'success': + ret['comment'] = 'Dashboard {0} created.'.format(name) + ret['changes']['new'] = 'Dashboard {0} created.'.format(name) + else: + ret['result'] = False + ret['comment'] = ("Failed to create dashboard {0}, " + "response={1}").format(name, response) + + return ret + + base_dashboards_from_pillar = base_dashboards_from_pillar or [] + base_panels_from_pillar = base_panels_from_pillar or [] + base_rows_from_pillar = base_rows_from_pillar or [] + + # Add pillar keys for default configuration + base_dashboards_from_pillar = ([_DEFAULT_DASHBOARD_PILLAR] + + base_dashboards_from_pillar) + base_panels_from_pillar = ([_DEFAULT_PANEL_PILLAR] + + base_panels_from_pillar) + base_rows_from_pillar = [_DEFAULT_ROW_PILLAR] + base_rows_from_pillar + + # Build out all dashboard fields + new_dashboard = _inherited_dashboard( + dashboard, base_dashboards_from_pillar, ret) + new_dashboard['title'] = name + rows = new_dashboard.get('rows', []) + for i, row in enumerate(rows): + rows[i] = _inherited_row(row, base_rows_from_pillar, ret) + for row in rows: + panels = row.get('panels', []) + for i, panel in enumerate(panels): + panels[i] = _inherited_panel(panel, base_panels_from_pillar, ret) + _auto_adjust_panel_spans(new_dashboard) + _ensure_panel_ids(new_dashboard) + _ensure_annotations(new_dashboard) + + # Create dashboard if it does not exist + url = 'db/{0}'.format(name) + old_dashboard = _get(url, profile) + if not old_dashboard: + if __opts__['test']: + ret['result'] = None + ret['comment'] = 'Dashboard {0} is set to be created.'.format(name) + return ret + + response = _update(new_dashboard, profile) + if response.get('status') == 'success': + ret['comment'] = 'Dashboard {0} created.'.format(name) + ret['changes']['new'] = 'Dashboard {0} created.'.format(name) + else: + ret['result'] = False + ret['comment'] = ("Failed to create dashboard {0}, " + "response={1}").format(name, response) + return ret + + # Add unmanaged rows to the dashboard. They appear at the top if they are + # marked as pinned. They appear at the bottom otherwise. + managed_row_titles = [row.get('title') + for row in new_dashboard.get('rows', [])] + new_rows = new_dashboard.get('rows', []) + for old_row in old_dashboard.get('rows', []): + if old_row.get('title') not in managed_row_titles: + new_rows.append(copy.deepcopy(old_row)) + _ensure_pinned_rows(new_dashboard) + _ensure_panel_ids(new_dashboard) + + # Update dashboard if it differs + dashboard_diff = DictDiffer(_cleaned(new_dashboard), + _cleaned(old_dashboard)) + updated_needed = (dashboard_diff.changed() or + dashboard_diff.added() or + dashboard_diff.removed()) + if updated_needed: + if __opts__['test']: + ret['result'] = None + ret['comment'] = ('Dashboard {0} is set to be updated, ' + 'changes={1}').format( + name, + json.dumps( + _dashboard_diff( + _cleaned(new_dashboard), + _cleaned(old_dashboard) + ), + indent=4 + )) + return ret + + response = _update(new_dashboard, profile) + if response.get('status') == 'success': + updated_dashboard = _get(url, profile) + dashboard_diff = DictDiffer(_cleaned(updated_dashboard), + _cleaned(old_dashboard)) + ret['comment'] = 'Dashboard {0} updated.'.format(name) + ret['changes'] = _dashboard_diff(_cleaned(new_dashboard), + _cleaned(old_dashboard)) + else: + ret['result'] = False + ret['comment'] = ("Failed to update dashboard {0}, " + "response={1}").format(name, response) + return ret + + ret['comment'] = 'Dashboard present' + return ret + + +def absent(name, profile='grafana'): + ''' + Ensure the named grafana dashboard is absent. + + name + Name of the grafana dashboard. + + profile + A pillar key or dict that contains grafana information + ''' + ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} + + if isinstance(profile, six.string_types): + profile = __salt__['config.option'](profile) + + url = 'db/{0}'.format(name) + existing_dashboard = _get(url, profile) + if existing_dashboard: + if __opts__['test']: + ret['result'] = None + ret['comment'] = 'Dashboard {0} is set to be deleted.'.format(name) + return ret + + _delete(url, profile) + ret['comment'] = 'Dashboard {0} deleted.'.format(name) + ret['changes']['new'] = 'Dashboard {0} deleted.'.format(name) + return ret + + ret['comment'] = 'Dashboard absent' + return ret + + +_IGNORED_DASHBOARD_FIELDS = [ + 'id', + 'originalTitle', + 'version', +] +_IGNORED_ROW_FIELDS = [] +_IGNORED_PANEL_FIELDS = [ + 'grid', + 'mode', + 'tooltip', +] +_IGNORED_TARGET_FIELDS = [ + 'textEditor', +] + + +def _cleaned(_dashboard): + '''Return a copy without fields that can differ.''' + dashboard = copy.deepcopy(_dashboard) + + for ignored_dashboard_field in _IGNORED_DASHBOARD_FIELDS: + dashboard.pop(ignored_dashboard_field, None) + for row in dashboard.get('rows', []): + for ignored_row_field in _IGNORED_ROW_FIELDS: + row.pop(ignored_row_field, None) + for i, panel in enumerate(row.get('panels', [])): + for ignored_panel_field in _IGNORED_PANEL_FIELDS: + panel.pop(ignored_panel_field, None) + for target in panel.get('targets', []): + for ignored_target_field in _IGNORED_TARGET_FIELDS: + target.pop(ignored_target_field, None) + row['panels'][i] = _stripped(panel) + + return dashboard + + +def _inherited_dashboard(dashboard, base_dashboards_from_pillar, ret): + '''Return a dashboard with properties from parents.''' + base_dashboards = [] + for base_dashboard_from_pillar in base_dashboards_from_pillar: + base_dashboard = __salt__['pillar.get'](base_dashboard_from_pillar) + if base_dashboard: + base_dashboards.append(base_dashboard) + elif base_dashboard_from_pillar != _DEFAULT_DASHBOARD_PILLAR: + ret.setdefault('warnings', []) + warning_message = 'Cannot find dashboard pillar "{0}".'.format( + base_dashboard_from_pillar) + if warning_message not in ret['warnings']: + ret['warnings'].append(warning_message) + base_dashboards.append(dashboard) + + result_dashboard = {} + tags = set() + for dashboard in base_dashboards: + tags.update(dashboard.get('tags', [])) + result_dashboard.update(dashboard) + result_dashboard['tags'] = list(tags) + return result_dashboard + + +def _inherited_row(row, base_rows_from_pillar, ret): + '''Return a row with properties from parents.''' + base_rows = [] + for base_row_from_pillar in base_rows_from_pillar: + base_row = __salt__['pillar.get'](base_row_from_pillar) + if base_row: + base_rows.append(base_row) + elif base_row_from_pillar != _DEFAULT_ROW_PILLAR: + ret.setdefault('warnings', []) + warning_message = 'Cannot find row pillar "{0}".'.format( + base_row_from_pillar) + if warning_message not in ret['warnings']: + ret['warnings'].append(warning_message) + base_rows.append(row) + + result_row = {} + for row in base_rows: + result_row.update(row) + return result_row + + +def _inherited_panel(panel, base_panels_from_pillar, ret): + '''Return a panel with properties from parents.''' + base_panels = [] + for base_panel_from_pillar in base_panels_from_pillar: + base_panel = __salt__['pillar.get'](base_panel_from_pillar) + if base_panel: + base_panels.append(base_panel) + elif base_panel_from_pillar != _DEFAULT_PANEL_PILLAR: + ret.setdefault('warnings', []) + warning_message = 'Cannot find panel pillar "{0}".'.format( + base_panel_from_pillar) + if warning_message not in ret['warnings']: + ret['warnings'].append(warning_message) + base_panels.append(panel) + + result_panel = {} + for panel in base_panels: + result_panel.update(panel) + return result_panel + + +_FULL_LEVEL_SPAN = 12 +_DEFAULT_PANEL_SPAN = 2.5 + + +def _auto_adjust_panel_spans(dashboard): + '''Adjust panel spans to take up the available width. + + For each group of panels that would be laid out on the same level, scale up + the unspecified panel spans to fill up the level. + ''' + for row in dashboard.get('rows', []): + levels = [] + current_level = [] + levels.append(current_level) + for panel in row.get('panels', []): + current_level_span = sum(panel.get('span', _DEFAULT_PANEL_SPAN) + for panel in current_level) + span = panel.get('span', _DEFAULT_PANEL_SPAN) + if current_level_span + span > _FULL_LEVEL_SPAN: + current_level = [panel] + levels.append(current_level) + else: + current_level.append(panel) + + for level in levels: + specified_panels = [panel for panel in level if 'span' in panel] + unspecified_panels = [panel for panel in level + if 'span' not in panel] + if not unspecified_panels: + continue + + specified_span = sum(panel['span'] for panel in specified_panels) + available_span = _FULL_LEVEL_SPAN - specified_span + auto_span = float(available_span) / len(unspecified_panels) + for panel in unspecified_panels: + panel['span'] = auto_span + + +def _ensure_pinned_rows(dashboard): + '''Pin rows to the top of the dashboard.''' + pinned_row_titles = __salt__['pillar.get'](_PINNED_ROWS_PILLAR) + if not pinned_row_titles: + return + + pinned_row_titles_lower = [] + for title in pinned_row_titles: + pinned_row_titles_lower.append(title.lower()) + rows = dashboard.get('rows', []) + pinned_rows = [] + for i, row in enumerate(rows): + if row.get('title', '').lower() in pinned_row_titles_lower: + del rows[i] + pinned_rows.append(row) + rows = pinned_rows + rows + + +def _ensure_panel_ids(dashboard): + '''Assign panels auto-incrementing IDs.''' + panel_id = 1 + for row in dashboard.get('rows', []): + for panel in row.get('panels', []): + panel['id'] = panel_id + panel_id += 1 + + +def _ensure_annotations(dashboard): + '''Explode annotation_tags into annotations.''' + if 'annotation_tags' not in dashboard: + return + tags = dashboard['annotation_tags'] + annotations = { + 'enable': True, + 'list': [], + } + for tag in tags: + annotations['list'].append({ + 'datasource': "graphite", + 'enable': False, + 'iconColor': "#C0C6BE", + 'iconSize': 13, + 'lineColor': "rgba(255, 96, 96, 0.592157)", + 'name': tag, + 'showLine': True, + 'tags': tag, + }) + del dashboard['annotation_tags'] + dashboard['annotations'] = annotations + + +def _get(url, profile): + '''Get a specific dashboard.''' + request_url = "{0}/api/dashboards/{1}".format(profile.get('grafana_url'), + url) + if profile.get('grafana_token', False): + response = requests.get( + request_url, + headers=_get_headers(profile), + timeout=profile.get('grafana_timeout', 3), + ) + else: + response = requests.get( + request_url, + auth=_get_auth(profile), + timeout=profile.get('grafana_timeout', 3), + ) + data = response.json() + if data.get('message') == 'Not found': + return None + if 'dashboard' not in data: + return None + return data['dashboard'] + + +def _delete(url, profile): + '''Delete a specific dashboard.''' + request_url = "{0}/api/dashboards/{1}".format(profile.get('grafana_url'), + url) + response = requests.delete( + request_url, + auth=_get_auth(profile), + headers=_get_headers(profile), + timeout=profile.get('grafana_timeout'), + ) + data = response.json() + return data + + +def _update(dashboard, profile): + '''Update a specific dashboard.''' + payload = { + 'dashboard': dashboard, + 'overwrite': True + } + response = requests.post( + "{0}/api/dashboards/db".format(profile.get('grafana_url')), + auth=_get_auth(profile), + headers=_get_headers(profile), + json=payload + ) + return response.json() + + +def _get_headers(profile): + headers = {'Content-type': 'application/json'} + + if profile.get('grafana_token', False): + headers['Authorization'] = 'Bearer {0}'.format(profile['grafana_token']) + + return headers + + +def _get_auth(profile): + if profile.get('grafana_token', False): + return None + + return requests.auth.HTTPBasicAuth( + profile['grafana_user'], + profile['grafana_password'] + ) + + +def _dashboard_diff(_new_dashboard, _old_dashboard): + '''Return a dictionary of changes between dashboards.''' + diff = {} + + # Dashboard diff + new_dashboard = copy.deepcopy(_new_dashboard) + old_dashboard = copy.deepcopy(_old_dashboard) + dashboard_diff = DictDiffer(new_dashboard, old_dashboard) + diff['dashboard'] = _stripped({ + 'changed': list(dashboard_diff.changed()) or None, + 'added': list(dashboard_diff.added()) or None, + 'removed': list(dashboard_diff.removed()) or None, + }) + + # Row diff + new_rows = new_dashboard.get('rows', []) + old_rows = old_dashboard.get('rows', []) + new_rows_by_title = {} + old_rows_by_title = {} + for row in new_rows: + if 'title' in row: + new_rows_by_title[row['title']] = row + for row in old_rows: + if 'title' in row: + old_rows_by_title[row['title']] = row + rows_diff = DictDiffer(new_rows_by_title, old_rows_by_title) + diff['rows'] = _stripped({ + 'added': list(rows_diff.added()) or None, + 'removed': list(rows_diff.removed()) or None, + }) + for changed_row_title in rows_diff.changed(): + old_row = old_rows_by_title[changed_row_title] + new_row = new_rows_by_title[changed_row_title] + row_diff = DictDiffer(new_row, old_row) + diff['rows'].setdefault('changed', {}) + diff['rows']['changed'][changed_row_title] = _stripped({ + 'changed': list(row_diff.changed()) or None, + 'added': list(row_diff.added()) or None, + 'removed': list(row_diff.removed()) or None, + }) + + # Panel diff + old_panels_by_id = {} + new_panels_by_id = {} + for row in old_dashboard.get('rows', []): + for panel in row.get('panels', []): + if 'id' in panel: + old_panels_by_id[panel['id']] = panel + for row in new_dashboard.get('rows', []): + for panel in row.get('panels', []): + if 'id' in panel: + new_panels_by_id[panel['id']] = panel + panels_diff = DictDiffer(new_panels_by_id, old_panels_by_id) + diff['panels'] = _stripped({ + 'added': list(panels_diff.added()) or None, + 'removed': list(panels_diff.removed()) or None, + }) + for changed_panel_id in panels_diff.changed(): + old_panel = old_panels_by_id[changed_panel_id] + new_panel = new_panels_by_id[changed_panel_id] + panels_diff = DictDiffer(new_panel, old_panel) + diff['panels'].setdefault('changed', {}) + diff['panels']['changed'][changed_panel_id] = _stripped({ + 'changed': list(panels_diff.changed()) or None, + 'added': list(panels_diff.added()) or None, + 'removed': list(panels_diff.removed()) or None, + }) + + return diff + + +def _stripped(d): + '''Strip falsey entries.''' + ret = {} + for k, v in six.iteritems(d): + if v: + ret[k] = v + return ret diff --git a/_states/grafana3_datasource.py b/_states/grafana3_datasource.py new file mode 100644 index 0000000..3ac5338 --- /dev/null +++ b/_states/grafana3_datasource.py @@ -0,0 +1,260 @@ +# -*- coding: utf-8 -*- +''' +Manage Grafana v3.0 data sources + +.. versionadded:: 2016.3.0 + +Token auth setup + +.. code-block:: yaml + + grafana_version: 3 + grafana: + grafana_timeout: 5 + grafana_token: qwertyuiop + grafana_url: 'https://url.com' + +Basic auth setup + +.. code-block:: yaml + + grafana_version: 3 + grafana: + grafana_timeout: 5 + grafana_user: grafana + grafana_password: qwertyuiop + grafana_url: 'https://url.com' + +.. code-block:: yaml + + Ensure influxdb data source is present: + grafana_datasource.present: + - name: influxdb + - type: influxdb + - url: http://localhost:8086 + - access: proxy + - basic_auth: true + - basic_auth_user: myuser + - basic_auth_password: mypass + - is_default: true +''' +from __future__ import absolute_import + +import json +import requests + +from salt.ext.six import string_types + + +def __virtual__(): + '''Only load if grafana v3.0 is configured.''' + return __salt__['config.get']('grafana_version', 1) == 3 + + +def present(name, + type, + url, + access='proxy', + user='', + password='', + database='', + basic_auth=False, + basic_auth_user='', + basic_auth_password='', + is_default=False, + profile='grafana'): + ''' + Ensure that a data source is present. + + name + Name of the data source. + + type + Which type of data source it is ('graphite', 'influxdb' etc.). + + access + Use proxy or direct. Default: proxy + + url + The URL to the data source API. + + user + Optional - user to authenticate with the data source + + password + Optional - password to authenticate with the data source + + database + Optional - database to use with the data source + + basic_auth + Optional - set to True to use HTTP basic auth to authenticate with the + data source. + + basic_auth_user + Optional - HTTP basic auth username. + + basic_auth_password + Optional - HTTP basic auth password. + + is_default + Optional - Set data source as default. Default: False + ''' + if isinstance(profile, string_types): + profile = __salt__['config.option'](profile) + + ret = {'name': name, 'result': None, 'comment': None, 'changes': None} + datasource = _get_datasource(profile, name) + data = _get_json_data(name, type, url, + access=access, + user=user, + password=password, + database=database, + basic_auth=basic_auth, + basic_auth_user=basic_auth_user, + basic_auth_password=basic_auth_password, + is_default=is_default) + + if datasource: + requests.put( + _get_url(profile, datasource['id']), + data=json.dumps(data), + auth=_get_auth(profile), + headers=_get_headers(profile), + timeout=profile.get('grafana_timeout', 3), + ) + ret['result'] = True + ret['changes'] = _diff(datasource, data) + if ret['changes']['new'] or ret['changes']['old']: + ret['comment'] = 'Data source {0} updated'.format(name) + else: + ret['changes'] = None + ret['comment'] = 'Data source {0} already up-to-date'.format(name) + else: + requests.post( + '{0}/api/datasources'.format(profile['grafana_url']), + data=json.dumps(data), + auth=_get_auth(profile), + headers=_get_headers(profile), + timeout=profile.get('grafana_timeout', 3), + ) + ret['result'] = True + ret['comment'] = 'New data source {0} added'.format(name) + ret['changes'] = data + + return ret + + +def absent(name, profile='grafana'): + ''' + Ensure that a data source is present. + + name + Name of the data source to remove. + ''' + if isinstance(profile, string_types): + profile = __salt__['config.option'](profile) + + ret = {'result': None, 'comment': None, 'changes': None} + datasource = _get_datasource(profile, name) + + if not datasource: + ret['result'] = True + ret['comment'] = 'Data source {0} already absent'.format(name) + return ret + + requests.delete( + _get_url(profile, datasource['id']), + auth=_get_auth(profile), + headers=_get_headers(profile), + timeout=profile.get('grafana_timeout', 3), + ) + + ret['result'] = True + ret['comment'] = 'Data source {0} was deleted'.format(name) + + return ret + + +def _get_url(profile, datasource_id): + return '{0}/api/datasources/{1}'.format( + profile['grafana_url'], + datasource_id + ) + + +def _get_datasource(profile, name): + response = requests.get( + '{0}/api/datasources'.format(profile['grafana_url']), + auth=_get_auth(profile), + headers=_get_headers(profile), + timeout=profile.get('grafana_timeout', 3), + ) + data = response.json() + for datasource in data: + if datasource['name'] == name: + return datasource + return None + + +def _get_headers(profile): + + headers = {'Content-type': 'application/json'} + + if profile.get('grafana_token', False): + headers['Authorization'] = 'Bearer {0}'.format(profile['grafana_token']) + + return headers + + +def _get_auth(profile): + if profile.get('grafana_token', False): + return None + + return requests.auth.HTTPBasicAuth( + profile['grafana_user'], + profile['grafana_password'] + ) + + +def _get_json_data(name, + type, + url, + access='proxy', + user='', + password='', + database='', + basic_auth=False, + basic_auth_user='', + basic_auth_password='', + is_default=False, + type_logo_url='public/app/plugins/datasource/influxdb/img/influxdb_logo.svg', + with_credentials=False): + return { + 'name': name, + 'type': type, + 'url': url, + 'access': access, + 'user': user, + 'password': password, + 'database': database, + 'basicAuth': basic_auth, + 'basicAuthUser': basic_auth_user, + 'basicAuthPassword': basic_auth_password, + 'isDefault': is_default, + 'typeLogoUrl': type_logo_url, + 'withCredentials': with_credentials, + } + + +def _diff(old, new): + old_keys = old.keys() + old = old.copy() + new = new.copy() + for key in old_keys: + if key == 'id' or key == 'orgId': + del old[key] + elif old[key] == new[key]: + del old[key] + del new[key] + return {'old': old, 'new': new} diff --git a/grafana/client.sls b/grafana/client.sls index 804fa12..596b2e0 100644 --- a/grafana/client.sls +++ b/grafana/client.sls @@ -1,5 +1,5 @@ {%- from "grafana/map.jinja" import client with context %} -{%- if client.enabled %} +{%- if client.get('enabled', False) %} /etc/salt/minion.d/_grafana.conf: file.managed: @@ -11,7 +11,7 @@ {%- for datasource_name, datasource in client.datasource.iteritems() %} grafana_client_datasource_{{ datasource_name }}: - grafana_datasource.present: + grafana3_datasource.present: - name: {{ datasource_name }} - type: {{ datasource.type }} - url: http://{{ datasource.host }}:{{ datasource.get('port', 80) }} @@ -19,9 +19,14 @@ grafana_client_datasource_{{ datasource_name }}: - access: proxy {%- endif %} {%- if datasource.user is defined %} - - basic_auth: true - - basic_auth_user: {{ datasource.user }} - - basic_auth_password: {{ datasource.password }} + - user: {{ datasource.user }} + - password: {{ datasource.password }} + {%- endif %} + {%- if datasource.get('is_default', False) %} + - is_default: {{ datasource.is_default|lower }} + {%- endif %} + {%- if datasource.database is defined %} + - database: {{ datasource.database }} {%- endif %} {%- endfor %} @@ -31,42 +36,56 @@ grafana_client_datasource_{{ datasource_name }}: {%- if client.remote_data.engine == 'salt_mine' %} {%- for node_name, node_grains in salt['mine.get']('*', 'grains.items').iteritems() %} -{%- if node_grains.grafana is defined %} -{%- set raw_dict = salt['grains.filter_by']({'default': raw_dict}, merge=node_grains.grafana.get('dashboard', {})) %} -{%- endif %} + {%- if node_grains.grafana is defined %} + {%- set raw_dict = salt['grains.filter_by']({'default': raw_dict}, merge=node_grains.grafana.get('dashboard', {})) %} + {%- endif %} {%- endfor %} {%- endif %} {%- if client.dashboard is defined %} -{%- set raw_dict = salt['grains.filter_by']({'default': raw_dict}, merge=client.dashboard) %} + {%- set raw_dict = salt['grains.filter_by']({'default': raw_dict}, merge=client.dashboard) %} {%- endif %} {%- for dashboard_name, dashboard in raw_dict.iteritems() %} -{%- set rows = [] %} -{%- for row_name, row in dashboard.get('row', {}).iteritems() %} -{%- set panels = [] %} -{%- for panel_name, panel in row.get('panel', {}).iteritems() %} -{%- set targets = [] %} -{%- for target_name, target in panel.get('target', {}).iteritems() %} -{%- do targets.extend([target]) %} -{%- endfor %} -{%- do panel.update({'targets': targets}) %} -{%- do panels.extend([panel]) %} -{%- endfor %} -{%- do row.update({'panels': panels}) %} -{%- do rows.extend([row]) %} -{%- endfor %} -{%- do dashboard.update({'rows': rows}) %} -{%- do final_dict.update({dashboard_name: dashboard}) %} + {%- if dashboard.get('format', 'yaml')|lower == 'yaml' %} + # Dashboards in JSON format are considered as blob + {%- set rows = [] %} + {%- for row_name, row in dashboard.get('row', {}).iteritems() %} + {%- set panels = [] %} + {%- for panel_name, panel in row.get('panel', {}).iteritems() %} + {%- set targets = [] %} + {%- for target_name, target in panel.get('target', {}).iteritems() %} + {%- do targets.extend([target]) %} + {%- endfor %} + {%- do panel.update({'targets': targets}) %} + {%- do panels.extend([panel]) %} + {%- endfor %} + {%- do row.update({'panels': panels}) %} + {%- do rows.extend([row]) %} + {%- endfor %} + {%- do dashboard.update({'rows': rows}) %} + {%- endif %} + + {%- do final_dict.update({dashboard_name: dashboard}) %} {%- endfor %} {%- for dashboard_name, dashboard in final_dict.iteritems() %} - + {%- if dashboard.get('enabled', True) %} grafana_client_dashboard_{{ dashboard_name }}: - grafana_dashboard.present: + grafana3_dashboard.present: - name: {{ dashboard_name }} + {%- if dashboard.get('format', 'yaml')|lower == 'json' %} + {%- import_json dashboard.template as dash %} + - dashboard: {{ dash|json }} + - dashboard_format: json + {%- else %} - dashboard: {{ dashboard }} - + {%- endif %} + {%- else %} +grafana_client_dashboard_{{ dashboard_name }}: + grafana3_dashboard.absent: + - name: {{ dashboard_name }} + {%- endif %} {%- endfor %} {%- endif %} diff --git a/grafana/collector.sls b/grafana/collector.sls index b1f76b1..4532547 100644 --- a/grafana/collector.sls +++ b/grafana/collector.sls @@ -13,6 +13,7 @@ grafana_grains_dir: {# Loading the other service support metadata for localhost #} {%- for service_name, service in pillar.iteritems() %} +{%- if service.get('_support', {}).get('grafana', {}).get('enabled', False) %} {%- macro load_grains_file(grains_fragment_file) %}{% include grains_fragment_file ignore missing %}{% endmacro %} @@ -20,6 +21,7 @@ grafana_grains_dir: {%- set grains_yaml = load_grains_file(grains_fragment_file)|load_yaml %} {%- set service_grains = salt['grains.filter_by']({'default': service_grains}, merge=grains_yaml) %} +{%- endif %} {%- endfor %} grafana_grain: diff --git a/grafana/files/_grafana.conf b/grafana/files/_grafana.conf index 105af23..1d64503 100644 --- a/grafana/files/_grafana.conf +++ b/grafana/files/_grafana.conf @@ -1,8 +1,13 @@ {%- from "grafana/map.jinja" import client with context %} -grafana_version: 2 +grafana_version: {{ client.server.get('version', 3) }} grafana: grafana_timeout: 3 + {%- if client.server.token is defined %} grafana_token: {{ client.server.token }} - grafana_url: 'http://{{ client.server.host }}:{{ client.server.get('port', 80) }}' + {%- else %} + grafana_user: {{ client.server.user }} + grafana_password: {{ client.server.password }} + {%- endif %} + grafana_url: '{{ client.server.get('protocol', 'http') }}://{{ client.server.host }}:{{ client.server.get('port', 80) }}' diff --git a/grafana/files/dashboards/Apache.json b/grafana/files/dashboards/Apache.json index a986223..c09be61 100644 --- a/grafana/files/dashboards/Apache.json +++ b/grafana/files/dashboards/Apache.json @@ -219,7 +219,7 @@ "groupByTags": [], "measurement": "apache_requests", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"apache_requests\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"apache_requests\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -333,7 +333,7 @@ "groupByTags": [], "measurement": "apache_bytes", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"apache_bytes\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"apache_bytes\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -447,7 +447,7 @@ "groupByTags": [], "measurement": "apache_connections", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"apache_connections\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"apache_connections\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -561,7 +561,7 @@ "groupByTags": [], "measurement": "apache_connections", "policy": "default", - "query": "SELECT last(\"value\") FROM \"apache_connections\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"apache_connections\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -662,7 +662,7 @@ "groupByTags": [], "measurement": "/apache_workers/", "policy": "default", - "query": "SELECT mean(\"value\") FROM /apache_workers/ WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM /apache_workers/ WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -777,7 +777,7 @@ "groupByTags": [], "measurement": "apache_idle_workers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"apache_idle_workers\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"apache_idle_workers\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -849,7 +849,7 @@ "includeAll": false, "name": "server", "options": [], - "query": "show tag values from apache_requests with key = hostname where environment_label = '$environment'", + "query": "show tag values from apache_requests with key = hostname where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", diff --git a/grafana/files/dashboards/Ceph.json b/grafana/files/dashboards/Ceph.json index 2584415..d8c7201 100644 --- a/grafana/files/dashboards/Ceph.json +++ b/grafana/files/dashboards/Ceph.json @@ -200,7 +200,7 @@ "groupByTags": [], "measurement": "ceph_quorum_count", "policy": "default", - "query": "SELECT last(\"value\") FROM \"ceph_quorum_count\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"ceph_quorum_count\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -299,7 +299,7 @@ "groupByTags": [], "measurement": "ceph_monitor_count", "policy": "default", - "query": "SELECT last(\"value\") FROM \"ceph_monitor_count\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"ceph_monitor_count\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -396,7 +396,7 @@ "groupByTags": [], "measurement": "ceph_objects_count", "policy": "default", - "query": "SELECT last(\"value\") FROM \"ceph_objects_count\" WHERE \"environment_label\" = '$environment' AND \"cluster\" =~ /$cluster/ AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"ceph_objects_count\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster\" =~ /$cluster/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -498,7 +498,7 @@ "groupByTags": [], "measurement": "ceph_pg_count", "policy": "default", - "query": "SELECT last(\"value\") FROM \"ceph_pg_count\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"ceph_pg_count\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -596,7 +596,7 @@ "groupByTags": [], "measurement": "ceph_pool_total_percent_free", "policy": "default", - "query": "SELECT last(\"value\") FROM \"ceph_pool_total_percent_free\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"ceph_pool_total_percent_free\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -696,7 +696,7 @@ "groupByTags": [], "measurement": "ceph_pool_total_bytes_used", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"ceph_pool_total_bytes_used\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"ceph_pool_total_bytes_used\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -744,7 +744,7 @@ "groupByTags": [], "measurement": "ceph_pool_total_bytes_free", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"ceph_pool_total_bytes_free\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"ceph_pool_total_bytes_free\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2992,7 +2992,7 @@ "includeAll": false, "name": "mon", "options": [], - "query": "show tag values from ceph_health with key = hostname where environment_label = '$environment'", + "query": "show tag values from ceph_health with key = hostname where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", @@ -3006,7 +3006,7 @@ "includeAll": false, "name": "cluster", "options": [], - "query": "show tag values from ceph_health with key = cluster where environment_label = '$environment'", + "query": "show tag values from ceph_health with key = cluster where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", @@ -3020,7 +3020,7 @@ "includeAll": false, "name": "pool", "options": [], - "query": "show tag values from ceph_pool_size with key = pool where environment_label = '$environment'", + "query": "show tag values from ceph_pool_size with key = pool where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "/^[^.]/", @@ -3034,7 +3034,7 @@ "includeAll": false, "name": "osd", "options": [], - "query": "show tag values from ceph_osd_space_total with key = osd where environment_label = '$environment'", + "query": "show tag values from ceph_osd_space_total with key = osd where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", diff --git a/grafana/files/dashboards/Ceph_OSD.json b/grafana/files/dashboards/Ceph_OSD.json index 9bd2924..080eb2b 100644 --- a/grafana/files/dashboards/Ceph_OSD.json +++ b/grafana/files/dashboards/Ceph_OSD.json @@ -191,7 +191,7 @@ ], "measurement": "ceph_perf_osd_op", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -309,7 +309,7 @@ "interval": "", "measurement": "ceph_perf_osd_op_in_bytes", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_in_bytes\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_in_bytes\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -358,7 +358,7 @@ "interval": "", "measurement": "ceph_perf_osd_op_out_bytes", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_out_bytes\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_out_bytes\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -612,7 +612,7 @@ "interval": "", "measurement": "ceph_perf_osd_op_r_out_bytes", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_r_out_bytes\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_r_out_bytes\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -661,7 +661,7 @@ "interval": "", "measurement": "ceph_perf_osd_op_r", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_r\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_r\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -961,7 +961,7 @@ ], "measurement": "ceph_perf_osd_op_w_in_bytes", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_w_in_bytes\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_w_in_bytes\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1009,7 +1009,7 @@ ], "measurement": "ceph_perf_osd_op_w", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_w\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_w\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -1057,7 +1057,7 @@ ], "measurement": "ceph_perf_osd_op_w_rlat", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_w_rlat\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_w_rlat\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "C", "resultFormat": "time_series", @@ -1366,7 +1366,7 @@ ], "measurement": "ceph_perf_osd_op_rw_in_bytes", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_rw_in_bytes\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_rw_in_bytes\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1414,7 +1414,7 @@ ], "measurement": "ceph_perf_osd_op_rw", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_rw\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_rw\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -1462,7 +1462,7 @@ ], "measurement": "ceph_perf_osd_op_rw_rlat", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_rw_rlat\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"ceph_perf_osd_op_rw_rlat\" WHERE \"cluster\" =~ /$cluster/ AND \"osd\" =~ /$osd/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "C", "resultFormat": "time_series", @@ -1869,7 +1869,7 @@ "includeAll": false, "name": "cluster", "options": [], - "query": "show tag values from ceph_health with key = cluster where environment_label = '$environment'", + "query": "show tag values from ceph_health with key = cluster where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", @@ -1883,7 +1883,7 @@ "includeAll": false, "name": "osd", "options": [], - "query": "show tag values from ceph_perf_osd_op_latency with key = osd where environment_label = '$environment'", + "query": "show tag values from ceph_perf_osd_op_latency with key = osd where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", diff --git a/grafana/files/dashboards/Cinder.json b/grafana/files/dashboards/Cinder.json index 419a0d1..34ae2f7 100644 --- a/grafana/files/dashboards/Cinder.json +++ b/grafana/files/dashboards/Cinder.json @@ -85,7 +85,7 @@ "interval": "", "measurement": "cluster_status", "policy": "default", - "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" = '$environment' AND \"cluster_name\" = 'cinder' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'cinder' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -206,7 +206,7 @@ "interval": "", "measurement": "cluster_status", "policy": "default", - "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" = '$environment' AND \"cluster_name\" = 'cinder' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'cinder' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -722,7 +722,7 @@ ], "measurement": "openstack_check_api", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_check_api\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'cinder-api' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_check_api\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'cinder-api' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1202,7 +1202,7 @@ ], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'cinder-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'cinder-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1327,7 +1327,7 @@ ], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'cinder-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'cinder-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1468,7 +1468,7 @@ ], "measurement": "openstack_cinder_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'scheduler' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'scheduler' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1578,7 +1578,7 @@ ], "measurement": "openstack_cinder_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'scheduler' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'scheduler' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1688,7 +1688,7 @@ ], "measurement": "openstack_cinder_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'scheduler' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'scheduler' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1797,7 +1797,7 @@ ], "measurement": "openstack_cinder_service", "policy": "default", - "query": "SELECT state, last(value) FROM \"openstack_cinder_service\" WHERE $timeFilter AND \"environment_label\" = '$environment'and service = 'scheduler' GROUP BY time($interval), hostname", + "query": "SELECT state, last(value) FROM \"openstack_cinder_service\" WHERE $timeFilter AND \"environment_label\" =~ /^$environment$/and service = 'scheduler' GROUP BY time($interval), hostname", "rawQuery": true, "refId": "A", "resultFormat": "table", @@ -1895,7 +1895,7 @@ ], "measurement": "openstack_cinder_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'scheduler' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'scheduler' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2005,7 +2005,7 @@ ], "measurement": "openstack_cinder_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'volume' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'volume' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2115,7 +2115,7 @@ ], "measurement": "openstack_cinder_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'volume' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'volume' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2224,7 +2224,7 @@ ], "measurement": "openstack_cinder_service", "policy": "default", - "query": "SELECT state, last(value) FROM \"openstack_cinder_service\" WHERE $timeFilter AND \"environment_label\" = '$environment'and service = 'volume' GROUP BY time($interval), hostname", + "query": "SELECT state, last(value) FROM \"openstack_cinder_service\" WHERE $timeFilter AND \"environment_label\" =~ /^$environment$/and service = 'volume' GROUP BY time($interval), hostname", "rawQuery": true, "refId": "A", "resultFormat": "table", @@ -2322,7 +2322,7 @@ ], "measurement": "openstack_cinder_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'backup' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'backup' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2432,7 +2432,7 @@ ], "measurement": "openstack_cinder_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'backup' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'backup' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2542,7 +2542,7 @@ ], "measurement": "openstack_cinder_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'backup' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'backup' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2651,7 +2651,7 @@ ], "measurement": "openstack_cinder_service", "policy": "default", - "query": "SELECT state, last(value) FROM \"openstack_cinder_service\" WHERE $timeFilter AND \"environment_label\" = '$environment'and service = 'backup' GROUP BY time($interval), hostname", + "query": "SELECT state, last(value) FROM \"openstack_cinder_service\" WHERE $timeFilter AND \"environment_label\" =~ /^$environment$/and service = 'backup' GROUP BY time($interval), hostname", "rawQuery": true, "refId": "A", "resultFormat": "table", @@ -2739,7 +2739,7 @@ ], "measurement": "openstack_cinder_volumes", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_volumes\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_volumes\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2837,7 +2837,7 @@ ], "measurement": "openstack_cinder_volumes", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_volumes\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_volumes\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2935,7 +2935,7 @@ ], "measurement": "openstack_cinder_volumes", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_volumes\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_volumes\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3039,7 +3039,7 @@ "hide": false, "measurement": "openstack_cinder_volumes", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_cinder_volumes\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_cinder_volumes\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3090,7 +3090,7 @@ ], "measurement": "openstack_cinder_volumes", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_cinder_volumes\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_cinder_volumes\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -3143,7 +3143,7 @@ "hide": false, "measurement": "openstack_cinder_volumes", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_cinder_volumes\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_cinder_volumes\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -3256,7 +3256,7 @@ ], "measurement": "openstack_cinder_volumes_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_volumes_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_volumes_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3353,7 +3353,7 @@ ], "measurement": "openstack_cinder_volumes_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_volumes_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_volumes_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3450,7 +3450,7 @@ ], "measurement": "openstack_cinder_volumes_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_volumes_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_volumes_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3552,7 +3552,7 @@ ], "measurement": "openstack_cinder_volumes_size", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_cinder_volumes_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_cinder_volumes_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3604,7 +3604,7 @@ ], "measurement": "openstack_cinder_volumes_size", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_cinder_volumes_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_cinder_volumes_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -3656,7 +3656,7 @@ ], "measurement": "openstack_cinder_volumes_size", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_cinder_volumes_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_cinder_volumes_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -3769,7 +3769,7 @@ ], "measurement": "openstack_cinder_volume_creation_time", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_volume_creation_time\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_volume_creation_time\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3885,7 +3885,7 @@ "interval": "", "measurement": "openstack_cinder_volume_creation_time", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"openstack_cinder_volume_creation_time\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"openstack_cinder_volume_creation_time\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3934,7 +3934,7 @@ "interval": "", "measurement": "openstack_cinder_volume_creation_time", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_cinder_volume_creation_time\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_cinder_volume_creation_time\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -3983,7 +3983,7 @@ "interval": "", "measurement": "openstack_cinder_volume_creation_time", "policy": "default", - "query": "SELECT min(\"value\") FROM \"openstack_cinder_volume_creation_time\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT min(\"value\") FROM \"openstack_cinder_volume_creation_time\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -4100,7 +4100,7 @@ ], "measurement": "openstack_cinder_snapshots", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_snapshots\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_snapshots\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4197,7 +4197,7 @@ ], "measurement": "openstack_cinder_snapshots", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_snapshots\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_snapshots\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4294,7 +4294,7 @@ ], "measurement": "openstack_cinder_snapshots", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_snapshots\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_snapshots\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4398,7 +4398,7 @@ "hide": false, "measurement": "openstack_cinder_snapshots", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_cinder_snapshots\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_cinder_snapshots\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4449,7 +4449,7 @@ ], "measurement": "openstack_cinder_snapshots", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_cinder_snapshots\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_cinder_snapshots\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -4502,7 +4502,7 @@ "hide": false, "measurement": "openstack_cinder_snapshots", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_cinder_snapshots\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_cinder_snapshots\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -4615,7 +4615,7 @@ ], "measurement": "openstack_cinder_snapshots_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_snapshots_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_snapshots_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4712,7 +4712,7 @@ ], "measurement": "openstack_cinder_snapshots_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_snapshots_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_snapshots_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4809,7 +4809,7 @@ ], "measurement": "openstack_cinder_snapshots_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_cinder_snapshots_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_cinder_snapshots_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4911,7 +4911,7 @@ ], "measurement": "openstack_cinder_snapshots_size", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_cinder_snapshots_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_cinder_snapshots_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'available' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4962,7 +4962,7 @@ ], "measurement": "openstack_cinder_snapshots_size", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_cinder_snapshots_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_cinder_snapshots_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'in-use' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -5013,7 +5013,7 @@ ], "measurement": "openstack_cinder_snapshots_size", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_cinder_snapshots_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_cinder_snapshots_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -5107,7 +5107,7 @@ "includeAll": true, "name": "server", "options": [], - "query": "show tag values from pacemaker_local_resource_active with key = hostname where environment_label = '$environment'", + "query": "show tag values from openstack_cinder_http_response_times with key = hostname where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", @@ -5153,4 +5153,4 @@ "timezone": "browser", "title": "Cinder", "version": 4 -} \ No newline at end of file +} diff --git a/grafana/files/dashboards/Elasticsearch.json b/grafana/files/dashboards/Elasticsearch.json index 0a1b099..2a07913 100644 --- a/grafana/files/dashboards/Elasticsearch.json +++ b/grafana/files/dashboards/Elasticsearch.json @@ -680,7 +680,7 @@ ], "measurement": "lma_components_threads", "policy": "default", - "query": "SELECT last(\"value\") FROM \"lma_components_threads\" WHERE \"service\" = 'elasticsearch' AND \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"lma_components_threads\" WHERE \"service\" = 'elasticsearch' AND \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -785,7 +785,7 @@ ], "measurement": "lma_components_memory_rss", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_memory_rss\" WHERE \"service\" = 'elasticsearch' AND \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT mean(\"value\") FROM \"lma_components_memory_rss\" WHERE \"service\" = 'elasticsearch' AND \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -906,7 +906,7 @@ ], "measurement": "lma_components_disk_bytes_read", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_disk_bytes_read\" WHERE \"service\" = 'elasticsearch' AND \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_disk_bytes_read\" WHERE \"service\" = 'elasticsearch' AND \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -959,7 +959,7 @@ ], "measurement": "lma_components_disk_bytes_write", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_disk_bytes_write\" WHERE \"service\" = 'elasticsearch' AND \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_disk_bytes_write\" WHERE \"service\" = 'elasticsearch' AND \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -1080,7 +1080,7 @@ ], "measurement": "lma_components_cputime_syst", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_cputime_syst\" WHERE \"service\" = 'elasticsearch' AND \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_cputime_syst\" WHERE \"service\" = 'elasticsearch' AND \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1133,7 +1133,7 @@ ], "measurement": "lma_components_cputime_user", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_cputime_user\" WHERE \"service\" = 'elasticsearch' AND \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_cputime_user\" WHERE \"service\" = 'elasticsearch' AND \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -1245,7 +1245,7 @@ ], "measurement": "fs_space_percent_free", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"fs_space_percent_free\" WHERE \"fs\" = '/opt/es/data' AND \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT mean(\"value\") FROM \"fs_space_percent_free\" WHERE \"fs\" = '/opt/es/data' AND \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1348,7 +1348,7 @@ ], "measurement": "fs_space_free", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"fs_space_free\" WHERE \"fs\" = '/opt/es/data' AND \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"fs_space_free\" WHERE \"fs\" = '/opt/es/data' AND \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1399,7 +1399,7 @@ ], "measurement": "fs_space_used", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"fs_space_used\" WHERE \"fs\" = '/opt/es/data' AND \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"fs_space_used\" WHERE \"fs\" = '/opt/es/data' AND \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -1450,7 +1450,7 @@ ], "measurement": "fs_space_percent_reserved", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"fs_space_percent_reserved\" WHERE \"fs\" = '/opt/es/data' AND \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"fs_space_percent_reserved\" WHERE \"fs\" = '/opt/es/data' AND \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -1546,7 +1546,7 @@ "includeAll": false, "name": "server", "options": [], - "query": "show tag values from elasticsearch_cluster_health with key = \"hostname\" where environment_label = '$environment'", + "query": "show tag values from elasticsearch_cluster_health with key = \"hostname\" where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", diff --git a/grafana/files/dashboards/Glance.json b/grafana/files/dashboards/Glance.json index 8f6c616..6a62e1d 100644 --- a/grafana/files/dashboards/Glance.json +++ b/grafana/files/dashboards/Glance.json @@ -92,7 +92,7 @@ "interval": "", "measurement": "cluster_status", "policy": "default", - "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" = '$environment' AND \"cluster_name\" = 'glance' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'glance' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -679,7 +679,7 @@ "groupByTags": [], "measurement": "openstack_check_api", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_check_api\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'glance-api' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_check_api\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'glance-api' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1171,7 +1171,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'glance-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'glance-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1279,7 +1279,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'glance-registry-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'glance-registry-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1411,7 +1411,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'glance-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'glance-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1519,7 +1519,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'glance-registry-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'glance-registry-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1649,7 +1649,7 @@ "groupByTags": [], "measurement": "openstack_glance_images", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_images\" WHERE \"environment_label\" = '$environment' AND \"visibility\" = 'public' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_images\" WHERE \"environment_label\" =~ /^$environment$/ AND \"visibility\" = 'public' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1758,7 +1758,7 @@ "groupByTags": [], "measurement": "openstack_glance_images", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_images\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'active' AND \"visibility\" = 'private' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_images\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'active' AND \"visibility\" = 'private' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1868,7 +1868,7 @@ "hide": false, "measurement": "openstack_glance_images", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_images\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'active' AND \"visibility\" = 'public' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_images\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'active' AND \"visibility\" = 'public' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1925,7 +1925,7 @@ "groupByTags": [], "measurement": "openstack_glance_images", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_images\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'active' AND \"visibility\" = 'private' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_images\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'active' AND \"visibility\" = 'private' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2052,7 +2052,7 @@ "groupByTags": [], "measurement": "openstack_glance_images_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_images_size\" WHERE \"environment_label\" = '$environment' AND \"visibility\" = 'public' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_images_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"visibility\" = 'public' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2161,7 +2161,7 @@ "groupByTags": [], "measurement": "openstack_glance_images_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_images_size\" WHERE \"environment_label\" = '$environment' AND \"visibility\" = 'private' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_images_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"visibility\" = 'private' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2269,7 +2269,7 @@ "groupByTags": [], "measurement": "openstack_glance_images_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_images_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'active' AND \"visibility\" = 'public' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_images_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'active' AND \"visibility\" = 'public' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2326,7 +2326,7 @@ "groupByTags": [], "measurement": "openstack_glance_images_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_images_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'active' AND \"visibility\" = 'private' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_images_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'active' AND \"visibility\" = 'private' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2453,7 +2453,7 @@ "groupByTags": [], "measurement": "openstack_glance_snapshots", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots\" WHERE \"environment_label\" = '$environment' AND \"visibility\" = 'public' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots\" WHERE \"environment_label\" =~ /^$environment$/ AND \"visibility\" = 'public' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2562,7 +2562,7 @@ "groupByTags": [], "measurement": "openstack_glance_snapshots", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots\" WHERE \"environment_label\" = '$environment' AND \"visibility\" = 'private' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots\" WHERE \"environment_label\" =~ /^$environment$/ AND \"visibility\" = 'private' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2671,7 +2671,7 @@ "groupByTags": [], "measurement": "openstack_glance_snapshots", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots\" WHERE \"environment_label\" = '$environment' AND \"visibility\" = 'public' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots\" WHERE \"environment_label\" =~ /^$environment$/ AND \"visibility\" = 'public' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2723,7 +2723,7 @@ "groupByTags": [], "measurement": "openstack_glance_snapshots", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots\" WHERE \"environment_label\" = '$environment' AND \"visibility\" = 'private' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots\" WHERE \"environment_label\" =~ /^$environment$/ AND \"visibility\" = 'private' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2844,7 +2844,7 @@ "groupByTags": [], "measurement": "openstack_glance_snapshots_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'active' AND \"visibility\" = 'public' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'active' AND \"visibility\" = 'public' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2953,7 +2953,7 @@ "groupByTags": [], "measurement": "openstack_glance_snapshots_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'active' AND \"visibility\" = 'private' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'active' AND \"visibility\" = 'private' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3061,7 +3061,7 @@ "groupByTags": [], "measurement": "openstack_glance_snapshots_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'active' AND \"visibility\" = 'public' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'active' AND \"visibility\" = 'public' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3118,7 +3118,7 @@ "groupByTags": [], "measurement": "openstack_glance_snapshots_size", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots_size\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'active' AND \"visibility\" = 'private' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_glance_snapshots_size\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'active' AND \"visibility\" = 'private' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -3218,7 +3218,7 @@ "includeAll": true, "name": "server", "options": [], - "query": "show tag values from pacemaker_local_resource_active with key = hostname where environment_label = '$environment' ", + "query": "show tag values from openstack_glance_http_response_times with key = hostname where environment_label =~ /^$environment$/ ", "refresh": 1, "refresh_on_load": true, "regex": "", diff --git a/grafana/files/dashboards/HAProxy.json b/grafana/files/dashboards/HAProxy.json index ea2155d..6d80660 100644 --- a/grafana/files/dashboards/HAProxy.json +++ b/grafana/files/dashboards/HAProxy.json @@ -982,7 +982,7 @@ "interval": "", "measurement": "haproxy_frontend_bytes_in", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_bytes_in\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_bytes_in\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1032,7 +1032,7 @@ "interval": "", "measurement": "haproxy_frontend_bytes_out", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_bytes_out\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_bytes_out\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -1149,7 +1149,7 @@ "interval": "", "measurement": "haproxy_frontend_response_1xx", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_response_1xx\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_response_1xx\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1197,7 +1197,7 @@ ], "measurement": "haproxy_frontend_response_2xx", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_response_2xx\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_response_2xx\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -1245,7 +1245,7 @@ ], "measurement": "haproxy_frontend_response_3xx", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_response_3xx\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_response_3xx\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "C", "resultFormat": "time_series", @@ -1293,7 +1293,7 @@ ], "measurement": "haproxy_frontend_response_4xx", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_response_4xx\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_response_4xx\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval)", "rawQuery": true, "refId": "D", "resultFormat": "time_series", @@ -1341,7 +1341,7 @@ ], "measurement": "haproxy_frontend_response_5xx", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_response_5xx\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_response_5xx\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "E", "resultFormat": "time_series", @@ -1389,7 +1389,7 @@ ], "measurement": "haproxy_frontend_response_other", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_response_other\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_response_other\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "F", "resultFormat": "time_series", @@ -1730,7 +1730,7 @@ ], "measurement": "haproxy_frontend_error_requests", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_error_requests\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_error_requests\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1778,7 +1778,7 @@ ], "measurement": "haproxy_frontend_denied_requests", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_denied_requests\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_denied_requests\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -1827,7 +1827,7 @@ ], "measurement": "haproxy_frontend_denied_responses", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_denied_responses\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_frontend_denied_responses\" WHERE \"hostname\" =~ /$server/ AND \"frontend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "C", "resultFormat": "time_series", @@ -1956,7 +1956,7 @@ "interval": "", "measurement": "haproxy_backend_bytes_in", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_bytes_in\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_bytes_in\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -2006,7 +2006,7 @@ "interval": "", "measurement": "haproxy_backend_bytes_out", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_bytes_out\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_bytes_out\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -2123,7 +2123,7 @@ "interval": "", "measurement": "haproxy_backend_response_1xx", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_response_1xx\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_response_1xx\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -2171,7 +2171,7 @@ ], "measurement": "haproxy_backend_response_2xx", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_response_2xx\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_response_2xx\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -2219,7 +2219,7 @@ ], "measurement": "haproxy_backend_response_3xx", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_response_3xx\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_response_3xx\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "C", "resultFormat": "time_series", @@ -2267,7 +2267,7 @@ ], "measurement": "haproxy_backend_response_4xx", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_response_4xx\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_response_4xx\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "D", "resultFormat": "time_series", @@ -2315,7 +2315,7 @@ ], "measurement": "haproxy_backend_response_5xx", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_response_5xx\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_response_5xx\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "E", "resultFormat": "time_series", @@ -2363,7 +2363,7 @@ ], "measurement": "haproxy_backend_response_other", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_response_other\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_response_other\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "F", "resultFormat": "time_series", @@ -2702,7 +2702,7 @@ ], "measurement": "haproxy_backend_error_connection", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_error_connection\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_error_connection\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -2749,7 +2749,7 @@ ], "measurement": "haproxy_backend_error_responses", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_error_responses\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_error_responses\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -2799,7 +2799,7 @@ "interval": "", "measurement": "haproxy_backend_denied_requests", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_denied_requests\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_denied_requests\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "C", "resultFormat": "time_series", @@ -2849,7 +2849,7 @@ "interval": "", "measurement": "haproxy_backend_denied_responses", "policy": "default", - "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_denied_responses\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval) fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"haproxy_backend_denied_responses\" WHERE \"hostname\" =~ /$server/ AND \"backend\" =~ /$service/ AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "D", "resultFormat": "time_series", @@ -2947,7 +2947,7 @@ "includeAll": false, "name": "server", "options": [], - "query": "show tag values from pacemaker_local_resource_active with key = hostname where environment_label = '$environment' ", + "query": "show tag values from haproxy_backend_servers with key = hostname where environment_label =~ /^$environment$/ ", "refresh": 1, "refresh_on_load": true, "regex": "", @@ -2961,7 +2961,7 @@ "includeAll": false, "name": "service", "options": [], - "query": "show tag values from haproxy_backend_servers with key = backend where hostname = '$server' and environment_label = '$environment'", + "query": "show tag values from haproxy_backend_servers with key = backend where hostname =~ /^$server$/ and environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", @@ -3007,4 +3007,4 @@ "timezone": "browser", "title": "HAProxy", "version": 3 -} \ No newline at end of file +} diff --git a/grafana/files/dashboards/Heat.json b/grafana/files/dashboards/Heat.json index 917c536..4cb60c9 100644 --- a/grafana/files/dashboards/Heat.json +++ b/grafana/files/dashboards/Heat.json @@ -92,7 +92,7 @@ "interval": "", "measurement": "cluster_status", "policy": "default", - "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" = '$environment' AND \"cluster_name\" = 'heat' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'heat' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -595,7 +595,7 @@ "groupByTags": [], "measurement": "openstack_check_api", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_check_api\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'heat-api' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_check_api\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'heat-api' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1088,7 +1088,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'heat-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'heat-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1197,7 +1197,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'heat-cfn-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'heat-cfn-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1330,7 +1330,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'heat-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'heat-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1439,7 +1439,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'heat-cfn-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'heat-cfn-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1534,7 +1534,7 @@ "includeAll": true, "name": "server", "options": [], - "query": "show tag values from pacemaker_local_resource_active with key = hostname where environment_label = '$environment'", + "query": "show tag values from openstack_heat_http_response_times with key = hostname where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", diff --git a/grafana/files/dashboards/Hypervisor.json b/grafana/files/dashboards/Hypervisor.json index 974584b..2b9bf5e 100644 --- a/grafana/files/dashboards/Hypervisor.json +++ b/grafana/files/dashboards/Hypervisor.json @@ -79,7 +79,7 @@ ], "measurement": "cpu_user", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_user\" WHERE \"hostname\" = '$hostname' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT mean(\"value\") FROM \"cpu_user\" WHERE \"hostname\" =~ /^$hostname$/ AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -133,7 +133,7 @@ ], "measurement": "cpu_idle", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_idle\" WHERE \"hostname\" = '$hostname' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT mean(\"value\") FROM \"cpu_idle\" WHERE \"hostname\" =~ /^$hostname$/ AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -188,7 +188,7 @@ ], "measurement": "cpu_interrupt", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_interrupt\" WHERE \"hostname\" = '$hostname' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT mean(\"value\") FROM \"cpu_interrupt\" WHERE \"hostname\" =~ /^$hostname$/ AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -243,7 +243,7 @@ ], "measurement": "cpu_nice", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_nice\" WHERE \"hostname\" = '$hostname' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT mean(\"value\") FROM \"cpu_nice\" WHERE \"hostname\" =~ /^$hostname$/ AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "D", "resultFormat": "time_series", @@ -298,7 +298,7 @@ ], "measurement": "cpu_system", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_system\" WHERE \"hostname\" = '$hostname' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT mean(\"value\") FROM \"cpu_system\" WHERE \"hostname\" =~ /^$hostname$/ AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "E", "resultFormat": "time_series", @@ -353,7 +353,7 @@ ], "measurement": "cpu_steal", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_steal\" WHERE \"hostname\" = '$hostname' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT mean(\"value\") FROM \"cpu_steal\" WHERE \"hostname\" =~ /^$hostname$/ AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "F", "resultFormat": "time_series", @@ -408,7 +408,7 @@ ], "measurement": "cpu_wait", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_wait\" WHERE \"hostname\" = '$hostname' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT mean(\"value\") FROM \"cpu_wait\" WHERE \"hostname\" =~ /^$hostname$/ AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "G", "resultFormat": "time_series", @@ -541,7 +541,7 @@ "interval": "", "measurement": "memory_used", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memory_used\" WHERE \"hostname\" = '$hostname' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memory_used\" WHERE \"hostname\" =~ /^$hostname$/ AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -597,7 +597,7 @@ "interval": "", "measurement": "memory_buffered", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memory_buffered\" WHERE \"hostname\" = '$hostname' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memory_buffered\" WHERE \"hostname\" =~ /^$hostname$/ AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -653,7 +653,7 @@ "interval": "", "measurement": "memory_cached", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memory_cached\" WHERE \"hostname\" = '$hostname' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memory_cached\" WHERE \"hostname\" =~ /^$hostname$/ AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -709,7 +709,7 @@ "interval": "", "measurement": "memory_free", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memory_free\" WHERE \"hostname\" = '$hostname' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memory_free\" WHERE \"hostname\" =~ /^$hostname$/ AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "D", "resultFormat": "time_series", @@ -834,7 +834,7 @@ ], "measurement": "fs_space_percent_free", "policy": "default", - "query": "SELECT last(\"value\") FROM \"fs_space_percent_free\" WHERE \"hostname\" = '$hostname' AND \"fs\" = '/var/lib/nova' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT last(\"value\") FROM \"fs_space_percent_free\" WHERE \"hostname\" =~ /^$hostname$/ AND \"fs\" = '/var/lib/nova' AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -946,7 +946,7 @@ ], "measurement": "openstack_nova_running_instances", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_running_instances\" WHERE \"hostname\" = '$hostname' AND $timeFilter GROUP BY time($interval) fill(previous)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_running_instances\" WHERE \"hostname\" =~ /^$hostname$/ AND $timeFilter GROUP BY time($interval) fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2178,7 +2178,7 @@ "multiFormat": "glob", "name": "hostname", "options": [], - "query": "show tag values from openstack_nova_running_instances with key = hostname where environment_label = '$environment'", + "query": "show tag values from openstack_nova_running_instances with key = hostname where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", @@ -2194,7 +2194,7 @@ "multiFormat": "glob", "name": "instance_id", "options": [], - "query": "show tag values from virt_cpu_time with key = instance_id where hostname = '$hostname' and environment_label = '$environment'", + "query": "show tag values from virt_cpu_time with key = instance_id where hostname =~ /^$hostname$/ and environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "type": "query" @@ -2209,7 +2209,7 @@ "multiFormat": "glob", "name": "disk", "options": [], - "query": "show tag values from virt_disk_octets_read with key = device where hostname = '$hostname' and instance_id = '$instance_id' and environment_label = '$environment'", + "query": "show tag values from virt_disk_octets_read with key = device where hostname =~ /^$hostname$/ and instance_id =~ /^$instance_id$/ and environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", @@ -2225,7 +2225,7 @@ "multiFormat": "glob", "name": "interface", "options": [], - "query": "show tag values from virt_if_octets_rx with key = interface where hostname = '$hostname' and instance_id = '$instance_id' and environment_label = '$environment'", + "query": "show tag values from virt_if_octets_rx with key = interface where hostname =~ /^$hostname$/ and instance_id =~ /^$instance_id$/ and environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "type": "query" diff --git a/grafana/files/dashboards/InfluxDB.json b/grafana/files/dashboards/InfluxDB.json index e7c065b..69a66c4 100644 --- a/grafana/files/dashboards/InfluxDB.json +++ b/grafana/files/dashboards/InfluxDB.json @@ -2487,7 +2487,7 @@ "multiFormat": "glob", "name": "server", "options": [], - "query": "show tag values from influxdb_go_routines with key=\"hostname\" where environment_label = '$environment' ", + "query": "show tag values from influxdb_go_routines with key=\"hostname\" where environment_label =~ /^$environment$/ ", "refresh": 1, "refresh_on_load": true, "regex": "", diff --git a/grafana/files/dashboards/Keystone.json b/grafana/files/dashboards/Keystone.json index 2c0073e..e047354 100644 --- a/grafana/files/dashboards/Keystone.json +++ b/grafana/files/dashboards/Keystone.json @@ -92,7 +92,7 @@ "interval": "", "measurement": "cluster_status", "policy": "default", - "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" = '$environment' AND \"cluster_name\" = 'keystone' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'keystone' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -613,7 +613,7 @@ "groupByTags": [], "measurement": "openstack_check_api", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_check_api\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'keystone-public-api' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_check_api\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'keystone-public-api' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1075,7 +1075,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'keystone-public-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'keystone-public-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1183,7 +1183,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'keystone-admin-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'keystone-admin-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1315,7 +1315,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'keystone-public-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'keystone-public-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1423,7 +1423,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'keystone-admin-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'keystone-admin-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1552,7 +1552,7 @@ "groupByTags": [], "measurement": "openstack_keystone_users", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_keystone_users\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'enabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_keystone_users\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'enabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1650,7 +1650,7 @@ ], "measurement": "openstack_keystone_users", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_keystone_users\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'enabled' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"openstack_keystone_users\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'enabled' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1771,7 +1771,7 @@ "groupByTags": [], "measurement": "openstack_keystone_tenants", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_keystone_tenants\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'enabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_keystone_tenants\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'enabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1875,7 +1875,7 @@ "groupByTags": [], "measurement": "openstack_keystone_tenants", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_keystone_tenants\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'enabled' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_keystone_tenants\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'enabled' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1970,7 +1970,7 @@ "includeAll": true, "name": "server", "options": [], - "query": "show tag values from pacemaker_local_resource_active with key = hostname where environment_label = '$environment'", + "query": "show tag values from openstack_keystone_http_response_times with key = hostname where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", diff --git a/grafana/files/dashboards/LMA.json b/grafana/files/dashboards/LMA.json index 1ac01b5..0c51874 100644 --- a/grafana/files/dashboards/LMA.json +++ b/grafana/files/dashboards/LMA.json @@ -66,7 +66,7 @@ ], "measurement": "lma_components_threads", "policy": "default", - "query": "SELECT last(\"value\") FROM \"lma_components_threads\" WHERE \"hostname\" = '$node' AND \"service\" = 'hekad' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"lma_components_threads\" WHERE \"hostname\" =~ /^$node$/ AND \"service\" = 'hekad' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -169,7 +169,7 @@ ], "measurement": "lma_components_memory_rss", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_memory_rss\" WHERE \"hostname\" = '$node' AND \"service\" = 'hekad' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_memory_rss\" WHERE \"hostname\" =~ /^$node$/ AND \"service\" = 'hekad' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -288,7 +288,7 @@ ], "measurement": "lma_components_disk_bytes_read", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_disk_bytes_read\" WHERE \"hostname\" = '$node' AND \"service\" = 'hekad' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_disk_bytes_read\" WHERE \"hostname\" =~ /^$node$/ AND \"service\" = 'hekad' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -339,7 +339,7 @@ ], "measurement": "lma_components_disk_bytes_write", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_disk_bytes_write\" WHERE \"hostname\" = '$node' AND \"service\" = 'hekad' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_disk_bytes_write\" WHERE \"hostname\" =~ /^$node$/ AND \"service\" = 'hekad' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -458,7 +458,7 @@ ], "measurement": "lma_components_cputime_syst", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_cputime_syst\" WHERE \"hostname\" = '$node' AND \"service\" = 'hekad' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_cputime_syst\" WHERE \"hostname\" =~ /^$node$/ AND \"service\" = 'hekad' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -509,7 +509,7 @@ ], "measurement": "lma_components_cputime_user", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_cputime_user\" WHERE \"hostname\" = '$node' AND \"service\" = 'hekad' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_cputime_user\" WHERE \"hostname\" =~ /^$node$/ AND \"service\" = 'hekad' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -641,7 +641,7 @@ ], "hide": false, "measurement": "hekad_msg_count", - "query": "SELECT derivative(first(value),1s) FROM \"hekad_msg_count\" WHERE \"hostname\" = '$node' AND \"type\" = 'decoder' AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval), \"name\" fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"hekad_msg_count\" WHERE \"hostname\" =~ /^$node$/ AND \"type\" = 'decoder' AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval), \"name\" fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -766,7 +766,7 @@ } ], "measurement": "hekad_msg_avg_duration", - "query": "SELECT mean(\"value\") FROM \"hekad_msg_avg_duration\" WHERE \"hostname\" = '$node' AND \"type\" = 'decoder' AND $timeFilter GROUP BY time($interval), \"name\" fill(0)", + "query": "SELECT mean(\"value\") FROM \"hekad_msg_avg_duration\" WHERE \"hostname\" =~ /^$node$/ AND \"type\" = 'decoder' AND $timeFilter GROUP BY time($interval), \"name\" fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -895,7 +895,7 @@ ], "hide": false, "measurement": "hekad_memory", - "query": "SELECT mean(\"value\") FROM \"hekad_memory\" WHERE \"hostname\" = '$node' AND \"type\" = 'decoder' AND $timeFilter GROUP BY time($interval), \"name\" fill(0)", + "query": "SELECT mean(\"value\") FROM \"hekad_memory\" WHERE \"hostname\" =~ /^$node$/ AND \"type\" = 'decoder' AND $timeFilter GROUP BY time($interval), \"name\" fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1025,7 +1025,7 @@ } ], "measurement": "hekad_msg_count", - "query": "SELECT derivative(first(value),1s) FROM \"hekad_msg_count\" WHERE \"hostname\" = '$node' AND \"type\" = 'filter' AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval), \"name\" fill(0)", + "query": "SELECT derivative(first(value),1s) FROM \"hekad_msg_count\" WHERE \"hostname\" =~ /^$node$/ AND \"type\" = 'filter' AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval), \"name\" fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1150,7 +1150,7 @@ } ], "measurement": "hekad_msg_avg_duration", - "query": "SELECT mean(\"value\") FROM \"hekad_msg_avg_duration\" WHERE \"hostname\" = '$node' AND \"type\" = 'filter' AND $timeFilter GROUP BY time($interval), \"name\" fill(0)", + "query": "SELECT mean(\"value\") FROM \"hekad_msg_avg_duration\" WHERE \"hostname\" =~ /^$node$/ AND \"type\" = 'filter' AND $timeFilter GROUP BY time($interval), \"name\" fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1279,7 +1279,7 @@ ], "hide": false, "measurement": "hekad_memory", - "query": "SELECT mean(\"value\") FROM \"hekad_memory\" WHERE \"hostname\" = '$node' AND \"type\" = 'filter' AND $timeFilter GROUP BY time($interval), \"name\" fill(0)", + "query": "SELECT mean(\"value\") FROM \"hekad_memory\" WHERE \"hostname\" =~ /^$node$/ AND \"type\" = 'filter' AND $timeFilter GROUP BY time($interval), \"name\" fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1404,7 +1404,7 @@ ], "hide": false, "measurement": "hekad_timer_event_count", - "query": "SELECT derivative(first(value),1s) AS \"first(value),1s\" FROM \"hekad_timer_event_count\" WHERE \"hostname\" = '$node' AND \"type\" = 'filter' AND $timeFilter AND \"environment_label\" = '$environment'GROUP BY time($interval), \"name\" fill(0)", + "query": "SELECT derivative(first(value),1s) AS \"first(value),1s\" FROM \"hekad_timer_event_count\" WHERE \"hostname\" =~ /^$node$/ AND \"type\" = 'filter' AND $timeFilter AND \"environment_label\" =~ /^$environment$/GROUP BY time($interval), \"name\" fill(0)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1529,7 +1529,7 @@ } ], "measurement": "hekad_timer_event_avg_duration", - "query": "SELECT mean(\"value\") FROM \"hekad_timer_event_avg_duration\" WHERE \"hostname\" = '$node' AND \"type\" = 'filter' AND $timeFilter GROUP BY time($interval), \"name\" fill(0)", + "query": "SELECT mean(\"value\") FROM \"hekad_timer_event_avg_duration\" WHERE \"hostname\" =~ /^$node$/ AND \"type\" = 'filter' AND $timeFilter GROUP BY time($interval), \"name\" fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1652,7 +1652,7 @@ ], "measurement": "lma_components_threads", "policy": "default", - "query": "SELECT last(\"value\") FROM \"lma_components_threads\" WHERE \"hostname\" = '$node' AND \"service\" = 'collectd' AND $timeFilter GROUP BY time($interval)", + "query": "SELECT last(\"value\") FROM \"lma_components_threads\" WHERE \"hostname\" =~ /^$node$/ AND \"service\" = 'collectd' AND $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1755,7 +1755,7 @@ ], "measurement": "lma_components_memory_rss", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_memory_rss\" WHERE \"hostname\" = '$node' AND \"service\" = 'collectd' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_memory_rss\" WHERE \"hostname\" =~ /^$node$/ AND \"service\" = 'collectd' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1874,7 +1874,7 @@ ], "measurement": "lma_components_disk_bytes_read", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_disk_bytes_read\" WHERE \"hostname\" = '$node' AND \"service\" = 'collectd' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_disk_bytes_read\" WHERE \"hostname\" =~ /^$node$/ AND \"service\" = 'collectd' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1925,7 +1925,7 @@ ], "measurement": "lma_components_disk_bytes_write", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_disk_bytes_write\" WHERE \"hostname\" = '$node' AND \"service\" = 'collectd' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_disk_bytes_write\" WHERE \"hostname\" =~ /^$node$/ AND \"service\" = 'collectd' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2044,7 +2044,7 @@ ], "measurement": "lma_components_cputime_syst", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_cputime_syst\" WHERE \"hostname\" = '$node' AND \"service\" = 'collectd' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_cputime_syst\" WHERE \"hostname\" =~ /^$node$/ AND \"service\" = 'collectd' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2095,7 +2095,7 @@ ], "measurement": "lma_components_cputime_user", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"lma_components_cputime_user\" WHERE \"hostname\" = '$node' AND \"service\" = 'collectd' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"lma_components_cputime_user\" WHERE \"hostname\" =~ /^$node$/ AND \"service\" = 'collectd' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2189,7 +2189,7 @@ "includeAll": false, "name": "node", "options": [], - "query": "show tag values from lma_components_threads with key = \"hostname\" where environment_label = '$environment'", + "query": "show tag values from lma_components_threads with key = \"hostname\" where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", diff --git a/grafana/files/dashboards/Main.json b/grafana/files/dashboards/Main.json index 01d52c1..8f77f45 100644 --- a/grafana/files/dashboards/Main.json +++ b/grafana/files/dashboards/Main.json @@ -2270,4 +2270,4 @@ "timezone": "browser", "title": "Main", "version": 8 -} \ No newline at end of file +} diff --git a/grafana/files/dashboards/Memcached.json b/grafana/files/dashboards/Memcached.json index a184dea..8fbc694 100644 --- a/grafana/files/dashboards/Memcached.json +++ b/grafana/files/dashboards/Memcached.json @@ -91,7 +91,7 @@ "interval": "", "measurement": "cluster_status", "policy": "default", - "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" = '$environment' AND \"cluster_name\" = 'memcached' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'memcached' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -230,7 +230,7 @@ ], "measurement": "memcached_items_current", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memcached_items_current\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memcached_items_current\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -352,7 +352,7 @@ ], "measurement": "memcached_df_cache_used", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memcached_df_cache_used\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memcached_df_cache_used\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -481,7 +481,7 @@ ], "measurement": "memcached_command_get", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memcached_command_get\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memcached_command_get\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -536,7 +536,7 @@ "hide": false, "measurement": "memcached_command_set", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memcached_command_set\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memcached_command_set\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -658,7 +658,7 @@ ], "measurement": "memcached_df_cache_free", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memcached_df_cache_free\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memcached_df_cache_free\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -806,7 +806,7 @@ "interval": "", "measurement": "memcached_percent_hitratio", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memcached_percent_hitratio\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memcached_percent_hitratio\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -938,7 +938,7 @@ "interval": "", "measurement": "memcached_ops_hits", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memcached_ops_hits\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memcached_ops_hits\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -994,7 +994,7 @@ "interval": "", "measurement": "memcached_ops_misses", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memcached_ops_misses\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memcached_ops_misses\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -1048,7 +1048,7 @@ ], "measurement": "memcached_ops_evictions", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memcached_ops_evictions\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memcached_ops_evictions\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -1191,7 +1191,7 @@ "interval": "", "measurement": "memcached_octets_tx", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memcached_octets_tx\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memcached_octets_tx\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1246,7 +1246,7 @@ "interval": "", "measurement": "memcached_octets_rx", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memcached_octets_rx\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memcached_octets_rx\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -1372,7 +1372,7 @@ "interval": "", "measurement": "memcached_connections_current", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memcached_connections_current\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"memcached_connections_current\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", diff --git a/grafana/files/dashboards/MySQL.json b/grafana/files/dashboards/MySQL.json index fe06ec6..86031f7 100644 --- a/grafana/files/dashboards/MySQL.json +++ b/grafana/files/dashboards/MySQL.json @@ -92,7 +92,7 @@ "interval": "", "measurement": "cluster_status", "policy": "default", - "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" = '$environment' AND \"cluster_name\" = 'mysql' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'mysql' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -383,7 +383,7 @@ "groupByTags": [], "measurement": "mysql_locks_immediate", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"mysql_locks_immediate\" WHERE \"environment_label\" = '$environment' AND \"hostname\" =~ /$server/ AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"mysql_locks_immediate\" WHERE \"environment_label\" =~ /^$environment$/ AND \"hostname\" =~ /$server/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -435,7 +435,7 @@ "groupByTags": [], "measurement": "mysql_locks_waited", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"mysql_locks_waited\" WHERE \"environment_label\" = '$environment' AND \"hostname\" =~ /$server/ AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"mysql_locks_waited\" WHERE \"environment_label\" =~ /^$environment$/ AND \"hostname\" =~ /$server/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -1240,7 +1240,7 @@ "includeAll": false, "name": "server", "options": [], - "query": "show tag values from mysql_commands with key = hostname where environment_label = '$environment' ", + "query": "show tag values from mysql_commands with key = hostname where environment_label =~ /^$environment$/ ", "refresh": 1, "refresh_on_load": true, "regex": "", diff --git a/grafana/files/dashboards/Neutron.json b/grafana/files/dashboards/Neutron.json index c12ddd8..8bd139f 100644 --- a/grafana/files/dashboards/Neutron.json +++ b/grafana/files/dashboards/Neutron.json @@ -92,7 +92,7 @@ "interval": "", "measurement": "cluster_status", "policy": "default", - "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" = '$environment' AND \"cluster_name\" = 'neutron' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'neutron' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -220,7 +220,7 @@ "interval": "", "measurement": "cluster_status", "policy": "default", - "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" = '$environment' AND \"cluster_name\" = 'neutron' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'neutron' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -742,7 +742,7 @@ "groupByTags": [], "measurement": "openstack_check_api", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_check_api\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'neutron-api' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_check_api\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'neutron-api' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1234,7 +1234,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'neutron-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'neutron-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1366,7 +1366,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'neutron-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'neutron-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1508,7 +1508,7 @@ ], "measurement": "openstack_neutron_agents", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'dhcp' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'dhcp' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1619,7 +1619,7 @@ ], "measurement": "openstack_neutron_agents", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'dhcp' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'dhcp' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1730,7 +1730,7 @@ ], "measurement": "openstack_neutron_agents", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'dhcp' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'dhcp' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1839,7 +1839,7 @@ ], "measurement": "openstack_nova_service", "policy": "default", - "query": "SELECT state, last(value) FROM \"openstack_neutron_agent\" WHERE $timeFilter AND \"environment_label\" = '$environment'and service = 'dhcp' GROUP BY time($interval), hostname", + "query": "SELECT state, last(value) FROM \"openstack_neutron_agent\" WHERE $timeFilter AND \"environment_label\" =~ /^$environment$/and service = 'dhcp' GROUP BY time($interval), hostname", "rawQuery": true, "refId": "A", "resultFormat": "table", @@ -1938,7 +1938,7 @@ ], "measurement": "openstack_neutron_agents", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'l3' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'l3' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2049,7 +2049,7 @@ ], "measurement": "openstack_neutron_agents", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'l3' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'l3' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2160,7 +2160,7 @@ ], "measurement": "openstack_neutron_agents", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'l3' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'l3' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2269,7 +2269,7 @@ ], "measurement": "openstack_neutron_agent", "policy": "default", - "query": "SELECT state, last(value) FROM \"openstack_neutron_agent\" WHERE $timeFilter AND \"environment_label\" = '$environment'and service = 'l3' GROUP BY time($interval), hostname", + "query": "SELECT state, last(value) FROM \"openstack_neutron_agent\" WHERE $timeFilter AND \"environment_label\" =~ /^$environment$/and service = 'l3' GROUP BY time($interval), hostname", "rawQuery": true, "refId": "A", "resultFormat": "table", @@ -2368,7 +2368,7 @@ ], "measurement": "openstack_neutron_agents", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'metadata' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'metadata' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2479,7 +2479,7 @@ ], "measurement": "openstack_neutron_agents", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'metadata' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'metadata' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2590,7 +2590,7 @@ ], "measurement": "openstack_neutron_agents", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'metadata' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'metadata' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2699,7 +2699,7 @@ ], "measurement": "openstack_neutron_agent", "policy": "default", - "query": "SELECT state, last(value) FROM \"openstack_neutron_agent\" WHERE $timeFilter AND \"environment_label\" = '$environment'and service = 'metadata' GROUP BY time($interval), hostname", + "query": "SELECT state, last(value) FROM \"openstack_neutron_agent\" WHERE $timeFilter AND \"environment_label\" =~ /^$environment$/and service = 'metadata' GROUP BY time($interval), hostname", "rawQuery": true, "refId": "A", "resultFormat": "table", @@ -2798,7 +2798,7 @@ ], "measurement": "openstack_neutron_agents", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'openvswitch' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'openvswitch' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2909,7 +2909,7 @@ ], "measurement": "openstack_neutron_agents", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'openvswitch' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'openvswitch' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3020,7 +3020,7 @@ ], "measurement": "openstack_neutron_agents", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'openvswitch' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_agents\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'openvswitch' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3129,7 +3129,7 @@ ], "measurement": "openstack_neutron_agent", "policy": "default", - "query": "SELECT state, last(value) FROM \"openstack_neutron_agent\" WHERE $timeFilter AND \"environment_label\" = '$environment'and service = 'openvswitch' GROUP BY time($interval), hostname", + "query": "SELECT state, last(value) FROM \"openstack_neutron_agent\" WHERE $timeFilter AND \"environment_label\" =~ /^$environment$/and service = 'openvswitch' GROUP BY time($interval), hostname", "rawQuery": true, "refId": "A", "resultFormat": "table", @@ -3226,7 +3226,7 @@ "groupByTags": [], "measurement": "openstack_neutron_networks", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_networks\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_networks\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3332,7 +3332,7 @@ ], "measurement": "openstack_neutron_networks", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_networks\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_networks\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3448,7 +3448,7 @@ "groupByTags": [], "measurement": "openstack_neutron_subnets", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_subnets\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_subnets\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3548,7 +3548,7 @@ "groupByTags": [], "measurement": "openstack_neutron_subnets", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_subnets\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_subnets\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3664,7 +3664,7 @@ "groupByTags": [], "measurement": "openstack_neutron_ports", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_ports\" WHERE \"environment_label\" = '$environment' AND \"owner\" = 'compute' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_ports\" WHERE \"environment_label\" =~ /^$environment$/ AND \"owner\" = 'compute' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3783,7 +3783,7 @@ ], "measurement": "openstack_neutron_ports", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_ports\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_ports\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3900,7 +3900,7 @@ "groupByTags": [], "measurement": "openstack_neutron_routers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_routers\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_routers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4012,7 +4012,7 @@ ], "measurement": "openstack_neutron_routers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_routers\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_routers\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4128,7 +4128,7 @@ "groupByTags": [], "measurement": "openstack_neutron_floatingips", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_floatingips\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'associated' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_floatingips\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'associated' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4239,7 +4239,7 @@ ], "measurement": "openstack_neutron_floatingips", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_neutron_floatingips\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_neutron_floatingips\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4330,7 +4330,7 @@ "includeAll": true, "name": "server", "options": [], - "query": " show tag values from pacemaker_local_resource_active with key = hostname where environment_label = '$environment' ", + "query": " show tag values from openstack_neutron_http_response_times with key = hostname where environment_label =~ /^$environment$/ ", "refresh": 1, "refresh_on_load": true, "regex": "", @@ -4376,4 +4376,4 @@ "timezone": "browser", "title": "Neutron", "version": 3 -} \ No newline at end of file +} diff --git a/grafana/files/dashboards/Nova.json b/grafana/files/dashboards/Nova.json index a217703..5f9befd 100644 --- a/grafana/files/dashboards/Nova.json +++ b/grafana/files/dashboards/Nova.json @@ -93,7 +93,7 @@ "interval": "", "measurement": "cluster_status", "policy": "default", - "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" = '$environment' AND \"cluster_name\" = 'nova' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'nova' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -222,7 +222,7 @@ "interval": "", "measurement": "cluster_status", "policy": "default", - "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" = '$environment' AND \"cluster_name\" = 'nova' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'nova' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -747,7 +747,7 @@ "groupByTags": [], "measurement": "openstack_check_api", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_check_api\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'nova-api' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT last(\"value\") FROM \"openstack_check_api\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'nova-api' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1240,7 +1240,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'nova-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'nova-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1349,7 +1349,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'nova-metadata-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'nova-metadata-api' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1458,7 +1458,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'nova-novncproxy-websocket' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'nova-novncproxy-websocket' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1591,7 +1591,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'nova-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'nova-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1700,7 +1700,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'nova-metadata-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'nova-metadata-api' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1809,7 +1809,7 @@ "groupByTags": [], "measurement": "haproxy_backend_servers", "policy": "default", - "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" = '$environment' AND \"backend\" = 'nova-novncproxy-websocket' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"haproxy_backend_servers\" WHERE \"environment_label\" =~ /^$environment$/ AND \"backend\" = 'nova-novncproxy-websocket' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1951,7 +1951,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'compute' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'compute' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2062,7 +2062,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'compute' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'compute' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2173,7 +2173,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'compute' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'compute' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2282,7 +2282,7 @@ ], "measurement": "openstack_nova_service", "policy": "default", - "query": "SELECT state, last(value) FROM \"openstack_nova_service\" WHERE $timeFilter AND \"environment_label\" = '$environment'and service = 'compute' GROUP BY time($interval), hostname", + "query": "SELECT state, last(value) FROM \"openstack_nova_service\" WHERE $timeFilter AND \"environment_label\" =~ /^$environment$/and service = 'compute' GROUP BY time($interval), hostname", "rawQuery": true, "refId": "A", "resultFormat": "table", @@ -2381,7 +2381,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'scheduler' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'scheduler' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2492,7 +2492,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'scheduler' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'scheduler' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2603,7 +2603,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'scheduler' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'scheduler' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2712,7 +2712,7 @@ ], "measurement": "openstack_nova_service", "policy": "default", - "query": "SELECT state, last(value) FROM \"openstack_nova_service\" WHERE $timeFilter AND \"environment_label\" = '$environment'and service = 'scheduler' GROUP BY time($interval), hostname", + "query": "SELECT state, last(value) FROM \"openstack_nova_service\" WHERE $timeFilter AND \"environment_label\" =~ /^$environment$/and service = 'scheduler' GROUP BY time($interval), hostname", "rawQuery": true, "refId": "A", "resultFormat": "table", @@ -2811,7 +2811,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'conductor' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'conductor' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2922,7 +2922,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'conductor' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'conductor' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3033,7 +3033,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'conductor' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'conductor' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3142,7 +3142,7 @@ ], "measurement": "openstack_nova_service", "policy": "default", - "query": "SELECT state, last(value) FROM \"openstack_nova_service\" WHERE $timeFilter AND \"environment_label\" = '$environment'and service = 'conductor' GROUP BY time($interval), hostname", + "query": "SELECT state, last(value) FROM \"openstack_nova_service\" WHERE $timeFilter AND \"environment_label\" =~ /^$environment$/and service = 'conductor' GROUP BY time($interval), hostname", "rawQuery": true, "refId": "A", "resultFormat": "table", @@ -3241,7 +3241,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'cert' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'cert' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3352,7 +3352,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'cert' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'cert' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3463,7 +3463,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'cert' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'cert' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3572,7 +3572,7 @@ ], "measurement": "openstack_nova_service", "policy": "default", - "query": "SELECT state, last(value) FROM \"openstack_nova_service\" WHERE $timeFilter AND \"environment_label\" = '$environment'and service = 'cert' GROUP BY time($interval), hostname", + "query": "SELECT state, last(value) FROM \"openstack_nova_service\" WHERE $timeFilter AND \"environment_label\" =~ /^$environment$/and service = 'cert' GROUP BY time($interval), hostname", "rawQuery": true, "refId": "A", "resultFormat": "table", @@ -3671,7 +3671,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'consoleauth' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'consoleauth' AND \"state\" = 'disabled' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3782,7 +3782,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'consoleauth' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'consoleauth' AND \"state\" = 'up' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3893,7 +3893,7 @@ ], "measurement": "openstack_nova_services", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" = '$environment' AND \"service\" = 'consoleauth' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_services\" WHERE \"environment_label\" =~ /^$environment$/ AND \"service\" = 'consoleauth' AND \"state\" = 'down' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4002,7 +4002,7 @@ ], "measurement": "openstack_nova_service", "policy": "default", - "query": "SELECT state, last(value) FROM \"openstack_nova_service\" WHERE $timeFilter AND \"environment_label\" = '$environment'and service = 'consoleauth' GROUP BY time($interval), hostname", + "query": "SELECT state, last(value) FROM \"openstack_nova_service\" WHERE $timeFilter AND \"environment_label\" =~ /^$environment$/and service = 'consoleauth' GROUP BY time($interval), hostname", "rawQuery": true, "refId": "A", "resultFormat": "table", @@ -4098,7 +4098,7 @@ "groupByTags": [], "measurement": "openstack_nova_instances", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_instances\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_instances\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4202,7 +4202,7 @@ "groupByTags": [], "measurement": "openstack_nova_instances", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_nova_instances\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_nova_instances\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'active' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4323,7 +4323,7 @@ "groupByTags": [], "measurement": "openstack_nova_instances", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_instances\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_instances\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4426,7 +4426,7 @@ "groupByTags": [], "measurement": "openstack_nova_instances", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_nova_instances\" WHERE \"environment_label\" = '$environment' AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_nova_instances\" WHERE \"environment_label\" =~ /^$environment$/ AND \"state\" = 'error' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4547,7 +4547,7 @@ "groupByTags": [], "measurement": "openstack_nova_instance_creation_time", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"openstack_nova_instance_creation_time\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT mean(\"value\") FROM \"openstack_nova_instance_creation_time\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4649,7 +4649,7 @@ "groupByTags": [], "measurement": "openstack_nova_instance_creation_time", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"openstack_nova_instance_creation_time\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"openstack_nova_instance_creation_time\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4698,7 +4698,7 @@ "groupByTags": [], "measurement": "openstack_nova_instance_creation_time", "policy": "default", - "query": "SELECT max(\"value\") FROM \"openstack_nova_instance_creation_time\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"openstack_nova_instance_creation_time\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -4747,7 +4747,7 @@ "groupByTags": [], "measurement": "openstack_nova_instance_creation_time", "policy": "default", - "query": "SELECT min(\"value\") FROM \"openstack_nova_instance_creation_time\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT min(\"value\") FROM \"openstack_nova_instance_creation_time\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -4885,7 +4885,7 @@ "groupByTags": [], "measurement": "openstack_nova_total_used_vcpus", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_total_used_vcpus\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_total_used_vcpus\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -4985,7 +4985,7 @@ "groupByTags": [], "measurement": "openstack_nova_total_used_disk", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_total_used_disk\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_total_used_disk\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -5085,7 +5085,7 @@ "groupByTags": [], "measurement": "openstack_nova_total_used_ram", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_total_used_ram\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_total_used_ram\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -5209,7 +5209,7 @@ "groupByTags": [], "measurement": "openstack_nova_total_free_vcpus", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_total_free_vcpus\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_total_free_vcpus\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -5309,7 +5309,7 @@ "groupByTags": [], "measurement": "openstack_nova_total_free_disk", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_total_free_disk\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_total_free_disk\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -5409,7 +5409,7 @@ "groupByTags": [], "measurement": "openstack_nova_total_free_ram", "policy": "default", - "query": "SELECT last(\"value\") FROM \"openstack_nova_total_free_ram\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"openstack_nova_total_free_ram\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -5495,7 +5495,7 @@ "includeAll": true, "name": "server", "options": [], - "query": "show tag values from pacemaker_local_resource_active with key = hostname where environment_label = '$environment' ", + "query": "show tag values from openstack_nova_http_response_times with key = hostname where environment_label =~ /^$environment$/ ", "refresh": 1, "refresh_on_load": true, "regex": "", @@ -5541,4 +5541,4 @@ "timezone": "browser", "title": "Nova", "version": 3 -} \ No newline at end of file +} diff --git a/grafana/files/dashboards/RabbitMQ.json b/grafana/files/dashboards/RabbitMQ.json index b12bd0f..1f49bb7 100644 --- a/grafana/files/dashboards/RabbitMQ.json +++ b/grafana/files/dashboards/RabbitMQ.json @@ -91,7 +91,7 @@ "interval": "", "measurement": "cluster_status", "policy": "default", - "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" = '$environment' AND \"cluster_name\" = 'rabbitmq' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'rabbitmq' AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -879,7 +879,7 @@ ], "measurement": "rabbitmq_messages", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"rabbitmq_messages\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"rabbitmq_messages\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1001,7 +1001,7 @@ ], "measurement": "rabbitmq_used_memory", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"rabbitmq_used_memory\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"rabbitmq_used_memory\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1122,7 +1122,7 @@ ], "measurement": "rabbitmq_disk_free", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"rabbitmq_disk_free\" WHERE \"environment_label\" = '$environment' AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", + "query": "SELECT mean(\"value\") FROM \"rabbitmq_disk_free\" WHERE \"environment_label\" =~ /^$environment$/ AND $timeFilter GROUP BY time($interval), \"hostname\" fill(previous)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1212,7 +1212,7 @@ "includeAll": true, "name": "server", "options": [], - "query": "show tag values from rabbitmq_consumers with key = hostname where environment_label = '$environment' ", + "query": "show tag values from rabbitmq_consumers with key = hostname where environment_label =~ /^$environment$/ ", "refresh": 1, "refresh_on_load": true, "regex": "", diff --git a/grafana/files/dashboards/System.json b/grafana/files/dashboards/System.json index 61d78d3..62a82a0 100644 --- a/grafana/files/dashboards/System.json +++ b/grafana/files/dashboards/System.json @@ -73,7 +73,7 @@ "groupByTags": [], "measurement": "cpu_user", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_user\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"cpu_user\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -120,7 +120,7 @@ "groupByTags": [], "measurement": "cpu_idle", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_idle\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"cpu_idle\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -168,7 +168,7 @@ "groupByTags": [], "measurement": "cpu_interrupt", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_interrupt\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"cpu_interrupt\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -216,7 +216,7 @@ "groupByTags": [], "measurement": "cpu_nice", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_nice\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"cpu_nice\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "D", "resultFormat": "time_series", @@ -264,7 +264,7 @@ "groupByTags": [], "measurement": "cpu_system", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_system\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"cpu_system\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "E", "resultFormat": "time_series", @@ -312,7 +312,7 @@ "groupByTags": [], "measurement": "cpu_steal", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_steal\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"cpu_steal\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "F", "resultFormat": "time_series", @@ -360,7 +360,7 @@ "groupByTags": [], "measurement": "cpu_wait", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_wait\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"cpu_wait\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "G", "resultFormat": "time_series", @@ -485,7 +485,7 @@ "interval": "", "measurement": "memory_used", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memory_used\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"memory_used\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -534,7 +534,7 @@ "interval": "", "measurement": "memory_buffered", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memory_buffered\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"memory_buffered\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -583,7 +583,7 @@ "interval": "", "measurement": "memory_cached", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memory_cached\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"memory_cached\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -632,7 +632,7 @@ "interval": "", "measurement": "memory_free", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"memory_free\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"memory_free\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "D", "resultFormat": "time_series", @@ -750,7 +750,7 @@ "groupByTags": [], "measurement": "load_shortterm", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"load_shortterm\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"load_shortterm\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -797,7 +797,7 @@ "groupByTags": [], "measurement": "load_midterm", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"load_midterm\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"load_midterm\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -844,7 +844,7 @@ "groupByTags": [], "measurement": "load_longterm", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"load_longterm\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"load_longterm\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -965,7 +965,7 @@ "groupByTags": [], "measurement": "processes_count", "policy": "default", - "query": "SELECT max(\"value\") FROM \"processes_count\" WHERE \"hostname\" = '$server' AND \"state\" = 'blocked' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"processes_count\" WHERE \"hostname\" =~ /^$server$/ AND \"state\" = 'blocked' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1017,7 +1017,7 @@ "groupByTags": [], "measurement": "processes_count", "policy": "default", - "query": "SELECT max(\"value\") FROM \"processes_count\" WHERE \"hostname\" = '$server' AND \"state\" = 'paging' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"processes_count\" WHERE \"hostname\" =~ /^$server$/ AND \"state\" = 'paging' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -1069,7 +1069,7 @@ "groupByTags": [], "measurement": "processes_count", "policy": "default", - "query": "SELECT max(\"value\") FROM \"processes_count\" WHERE \"hostname\" = '$server' AND \"state\" = 'running' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"processes_count\" WHERE \"hostname\" =~ /^$server$/ AND \"state\" = 'running' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -1121,7 +1121,7 @@ "groupByTags": [], "measurement": "processes_count", "policy": "default", - "query": "SELECT max(\"value\") FROM \"processes_count\" WHERE \"hostname\" = '$server' AND \"state\" = 'sleeping' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"processes_count\" WHERE \"hostname\" =~ /^$server$/ AND \"state\" = 'sleeping' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "D", "resultFormat": "time_series", @@ -1173,7 +1173,7 @@ "groupByTags": [], "measurement": "processes_count", "policy": "default", - "query": "SELECT max(\"value\") FROM \"processes_count\" WHERE \"hostname\" = '$server' AND \"state\" = 'stopped' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"processes_count\" WHERE \"hostname\" =~ /^$server$/ AND \"state\" = 'stopped' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "E", "resultFormat": "time_series", @@ -1225,7 +1225,7 @@ "groupByTags": [], "measurement": "processes_count", "policy": "default", - "query": "SELECT max(\"value\") FROM \"processes_count\" WHERE \"hostname\" = '$server' AND \"state\" = 'zombies' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"processes_count\" WHERE \"hostname\" =~ /^$server$/ AND \"state\" = 'zombies' AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "F", "resultFormat": "time_series", @@ -1344,7 +1344,7 @@ "groupByTags": [], "measurement": "processes_fork_rate", "policy": "default", - "query": "SELECT max(\"value\") FROM \"processes_fork_rate\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"processes_fork_rate\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1459,7 +1459,7 @@ "groupByTags": [], "measurement": "logged_users", "policy": "default", - "query": "SELECT last(\"value\") FROM \"logged_users\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT last(\"value\") FROM \"logged_users\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1566,7 +1566,7 @@ "groupByTags": [], "measurement": "fs_space_percent_free", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"fs_space_percent_free\" WHERE \"hostname\" = '$server' AND \"fs\" = '$mount' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT mean(\"value\") FROM \"fs_space_percent_free\" WHERE \"hostname\" =~ /^$server$/ AND \"fs\" =~ /^$mount$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1679,7 +1679,7 @@ "interval": "", "measurement": "fs_space_used", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"fs_space_used\" WHERE \"hostname\" = '$server' AND \"fs\" = '$mount' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"fs_space_used\" WHERE \"hostname\" =~ /^$server$/ AND \"fs\" =~ /^$mount$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -1733,7 +1733,7 @@ "interval": "", "measurement": "fs_space_reserved", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"fs_space_reserved\" WHERE \"hostname\" = '$server' AND \"fs\" = '$mount' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"fs_space_reserved\" WHERE \"hostname\" =~ /^$server$/ AND \"fs\" =~ /^$mount$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -1787,7 +1787,7 @@ "interval": "", "measurement": "fs_space_free", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"fs_space_free\" WHERE \"hostname\" = '$server' AND \"fs\" = '$mount' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"fs_space_free\" WHERE \"hostname\" =~ /^$server$/ AND \"fs\" =~ /^$mount$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -1910,7 +1910,7 @@ "groupByTags": [], "measurement": "fs_inodes_percent_free", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"fs_inodes_percent_free\" WHERE \"hostname\" = '$server' AND \"fs\" = '$mount' AND $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT mean(\"value\") FROM \"fs_inodes_percent_free\" WHERE \"hostname\" =~ /^$server$/ AND \"fs\" =~ /^$mount$/ AND $timeFilter GROUP BY time($interval) fill(null)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2023,7 +2023,7 @@ "interval": "", "measurement": "fs_inodes_used", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"fs_inodes_used\" WHERE \"hostname\" = '$server' AND \"fs\" = '$mount' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"fs_inodes_used\" WHERE \"hostname\" =~ /^$server$/ AND \"fs\" =~ /^$mount$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2077,7 +2077,7 @@ "interval": "", "measurement": "fs_inodes_reserved", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"fs_inodes_reserved\" WHERE \"hostname\" = '$server' AND \"fs\" = '$mount' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"fs_inodes_reserved\" WHERE \"hostname\" =~ /^$server$/ AND \"fs\" =~ /^$mount$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2131,7 +2131,7 @@ "interval": "", "measurement": "fs_inodes_free", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"fs_inodes_free\" WHERE \"hostname\" = '$server' AND \"fs\" = '$mount' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"fs_inodes_free\" WHERE \"hostname\" =~ /^$server$/ AND \"fs\" =~ /^$mount$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -2263,7 +2263,7 @@ "groupByTags": [], "measurement": "disk_merged_read", "policy": "default", - "query": "SELECT max(\"value\") FROM \"disk_merged_read\" WHERE \"hostname\" = '$server' AND \"device\" = '$disk' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"disk_merged_read\" WHERE \"hostname\" =~ /^$server$/ AND \"device\" =~ /^$disk$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2315,7 +2315,7 @@ "groupByTags": [], "measurement": "disk_merged_write", "policy": "default", - "query": "SELECT max(\"value\") FROM \"disk_merged_write\" WHERE \"hostname\" = '$server' AND \"device\" = '$disk' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"disk_merged_write\" WHERE \"hostname\" =~ /^$server$/ AND \"device\" =~ /^$disk$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2435,7 +2435,7 @@ "groupByTags": [], "measurement": "disk_ops_read", "policy": "default", - "query": "SELECT max(\"value\") FROM \"disk_ops_read\" WHERE \"hostname\" = '$server' AND \"device\" = '$disk' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"disk_ops_read\" WHERE \"hostname\" =~ /^$server$/ AND \"device\" =~ /^$disk$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2487,7 +2487,7 @@ "groupByTags": [], "measurement": "disk_ops_write", "policy": "default", - "query": "SELECT max(\"value\") FROM \"disk_ops_write\" WHERE \"hostname\" = '$server' AND \"device\" = '$disk' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"disk_ops_write\" WHERE \"hostname\" =~ /^$server$/ AND \"device\" =~ /^$disk$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2607,7 +2607,7 @@ "groupByTags": [], "measurement": "disk_octets_read", "policy": "default", - "query": "SELECT max(\"value\") FROM \"disk_octets_read\" WHERE \"hostname\" = '$server' AND \"device\" = '$disk' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"disk_octets_read\" WHERE \"hostname\" =~ /^$server$/ AND \"device\" =~ /^$disk$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2659,7 +2659,7 @@ "groupByTags": [], "measurement": "disk_octets_write", "policy": "default", - "query": "SELECT max(\"value\") FROM \"disk_octets_write\" WHERE \"hostname\" = '$server' AND \"device\" = '$disk' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"disk_octets_write\" WHERE \"hostname\" =~ /^$server$/ AND \"device\" =~ /^$disk$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2788,7 +2788,7 @@ "groupByTags": [], "measurement": "if_octets_rx", "policy": "default", - "query": "SELECT max(\"value\") FROM \"if_octets_rx\" WHERE \"hostname\" = '$server' AND \"interface\" = '$interface' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"if_octets_rx\" WHERE \"hostname\" =~ /^$server$/ AND \"interface\" =~ /^$interface$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2840,7 +2840,7 @@ "groupByTags": [], "measurement": "if_octets_tx", "policy": "default", - "query": "SELECT max(\"value\") FROM \"if_octets_tx\" WHERE \"hostname\" = '$server' AND \"interface\" = '$interface' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"if_octets_tx\" WHERE \"hostname\" =~ /^$server$/ AND \"interface\" =~ /^$interface$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2960,7 +2960,7 @@ "groupByTags": [], "measurement": "if_packets_rx", "policy": "default", - "query": "SELECT max(\"value\") FROM \"if_packets_rx\" WHERE \"hostname\" = '$server' AND \"interface\" = '$interface' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"if_packets_rx\" WHERE \"hostname\" =~ /^$server$/ AND \"interface\" =~ /^$interface$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3012,7 +3012,7 @@ "groupByTags": [], "measurement": "if_packets_tx", "policy": "default", - "query": "SELECT max(\"value\") FROM \"if_packets_tx\" WHERE \"hostname\" = '$server' AND \"interface\" = '$interface' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"if_packets_tx\" WHERE \"hostname\" =~ /^$server$/ AND \"interface\" =~ /^$interface$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -3132,7 +3132,7 @@ "groupByTags": [], "measurement": "if_errors_rx", "policy": "default", - "query": "SELECT max(\"value\") FROM \"if_errors_rx\" WHERE \"hostname\" = '$server' AND \"interface\" = '$interface' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"if_errors_rx\" WHERE \"hostname\" =~ /^$server$/ AND \"interface\" =~ /^$interface$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3184,7 +3184,7 @@ "groupByTags": [], "measurement": "if_errors_tx", "policy": "default", - "query": "SELECT max(\"value\") FROM \"if_errors_tx\" WHERE \"hostname\" = '$server' AND \"interface\" = '$interface' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"if_errors_tx\" WHERE \"hostname\" =~ /^$server$/ AND \"interface\" =~ /^$interface$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -3304,7 +3304,7 @@ "groupByTags": [], "measurement": "if_dropped_rx", "policy": "default", - "query": "SELECT max(\"value\") FROM \"if_dropped_rx\" WHERE \"hostname\" = '$server' AND \"interface\" = '$interface' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"if_dropped_rx\" WHERE \"hostname\" =~ /^$server$/ AND \"interface\" =~ /^$interface$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3359,7 +3359,7 @@ "groupByTags": [], "measurement": "if_dropped_tx", "policy": "default", - "query": "SELECT max(\"value\") FROM \"if_dropped_tx\" WHERE \"hostname\" = '$server' AND \"interface\" = '$interface' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"if_dropped_tx\" WHERE \"hostname\" =~ /^$server$/ AND \"interface\" =~ /^$interface$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -3490,7 +3490,7 @@ "groupByTags": [], "measurement": "swap_used", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"swap_used\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"swap_used\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3537,7 +3537,7 @@ "groupByTags": [], "measurement": "swap_cached", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"swap_cached\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"swap_cached\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -3584,7 +3584,7 @@ "groupByTags": [], "measurement": "swap_free", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"swap_free\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT mean(\"value\") FROM \"swap_free\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -3698,7 +3698,7 @@ "groupByTags": [], "measurement": "swap_io_out", "policy": "default", - "query": "SELECT max(\"value\") FROM \"swap_io_out\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"swap_io_out\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -3746,7 +3746,7 @@ "groupByTags": [], "measurement": "swap_io_in", "policy": "default", - "query": "SELECT max(\"value\") FROM \"swap_io_in\" WHERE \"hostname\" = '$server' AND $timeFilter GROUP BY time($interval) fill(0)", + "query": "SELECT max(\"value\") FROM \"swap_io_in\" WHERE \"hostname\" =~ /^$server$/ AND $timeFilter GROUP BY time($interval) fill(0)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -3837,7 +3837,7 @@ "includeAll": false, "name": "server", "options": [], - "query": "show tag values from cpu_idle with key=\"hostname\" where environment_label = '$environment'", + "query": "show tag values from cpu_idle with key=\"hostname\" where environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", @@ -3851,7 +3851,7 @@ "includeAll": false, "name": "disk", "options": [], - "query": "show tag values from disk_merged_read with key=\"device\" where hostname = '$server' and environment_label = '$environment'", + "query": "show tag values from disk_merged_read with key=\"device\" where hostname =~ /^$server$/ and environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "/^[a-z]+$/", @@ -3865,7 +3865,7 @@ "includeAll": false, "name": "mount", "options": [], - "query": "show tag values from fs_inodes_free with key=\"fs\" where hostname = '$server' and environment_label = '$environment'", + "query": "show tag values from fs_inodes_free with key=\"fs\" where hostname =~ /^$server$/ and environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", @@ -3879,7 +3879,7 @@ "includeAll": false, "name": "interface", "options": [], - "query": "show tag values from if_errors_rx with key=\"interface\" where hostname = '$server' and environment_label = '$environment'", + "query": "show tag values from if_errors_rx with key=\"interface\" where hostname =~ /^$server$/ and environment_label =~ /^$environment$/", "refresh": 1, "refresh_on_load": true, "regex": "", @@ -3925,4 +3925,4 @@ "timezone": "browser", "title": "System", "version": 3 -} \ No newline at end of file +} diff --git a/grafana/map.jinja b/grafana/map.jinja index 521add5..88ac842 100644 --- a/grafana/map.jinja +++ b/grafana/map.jinja @@ -1,5 +1,5 @@ -{%- load_yaml as base_defaults %} +{%- load_yaml as server_defaults %} Debian: pkgs: - grafana @@ -17,13 +17,15 @@ Debian: allow_sign_up: False allow_org_create: False auto_assign_role: Viewer + dir: + static: /usr/share/grafana/public dashboards: enabled: false {%- endload %} -{%- set server = salt['grains.filter_by'](base_defaults, merge=salt['pillar.get']('grafana:server')) %} +{%- set server = salt['grains.filter_by'](server_defaults, merge=salt['pillar.get']('grafana:server')) %} -{%- load_yaml as base_defaults %} +{%- load_yaml as client_defaults %} Debian: server: host: 127.0.0.1 @@ -34,4 +36,12 @@ Debian: dashboard: {} {%- endload %} -{%- set client = salt['grains.filter_by'](base_defaults, merge=salt['pillar.get']('grafana:client')) %} +{%- set client = salt['grains.filter_by'](client_defaults, merge=salt['pillar.get']('grafana:client')) %} + +{%- load_yaml as collector_defaults %} +default: + storage: + engine: salt-mine +{%- endload %} + +{%- set collector = salt['grains.filter_by'](collector_defaults, merge=salt['pillar.get']('grafana:collector')) %} diff --git a/grafana/meta/collectd.yml b/grafana/meta/collectd.yml new file mode 100644 index 0000000..55b7678 --- /dev/null +++ b/grafana/meta/collectd.yml @@ -0,0 +1,10 @@ +{%- if pillar.grafana.server is defined %} +{%- from "grafana/map.jinja" import server with context %} + +{%- if server.get('enabled', False) %} +local_plugin: + collectd_processes: + process: + grafana-server: {} +{%- endif %} +{%- endif %} diff --git a/grafana/server.sls b/grafana/server.sls index c3fc7ed..249898c 100644 --- a/grafana/server.sls +++ b/grafana/server.sls @@ -15,6 +15,7 @@ grafana_packages: - pkg: grafana_packages {%- if server.dashboards.enabled %} + grafana_copy_default_dashboards: file.recurse: - name: {{ server.dashboards.path }} @@ -23,17 +24,45 @@ grafana_copy_default_dashboards: - group: grafana - require: - pkg: grafana_packages + - require_in: + - service: grafana_service + {%- endif %} +{%- for theme_name, theme in server.get('theme', {}).iteritems() %} + +{%- if theme.css_override is defined %} + +grafana_{{ theme_name }}_css_override: + file.managed: + - names: + - {{ server.dir.static }}/css/grafana.{{ theme_name }}.min.css + {%- if theme.css_override.build is defined %} + - {{ server.dir.static }}/css/grafana.{{ theme_name }}.min.{{ theme.css_override.build }}.css + {%- endif %} + - source: {{ theme.css_override.source }} + {%- if theme.css_override.source_hash is defined %} + - source_hash: {{ theme.css_override.source_hash }} + {%- endif %} + - user: grafana + - group: grafana + - require: + - pkg: grafana_packages + - require_in: + - service: grafana_service + +{%- endif %} + +{%- endfor %} + grafana_service: service.running: - name: {{ server.service }} - enable: true + # It is needed if client is trying to set datasource or dashboards before + # server is ready. + - init_delay: 5 - watch: - file: /etc/grafana/grafana.ini -{%- if server.dashboards.enabled %} - - require: - - file: grafana_copy_default_dashboards -{%- endif %} {%- endif %} diff --git a/metadata/service/client/single.yml b/metadata/service/client/single.yml new file mode 100644 index 0000000..0f8aef7 --- /dev/null +++ b/metadata/service/client/single.yml @@ -0,0 +1,6 @@ +applications: +- grafana.client +parameters: + grafana: + client: + enabled: true diff --git a/metadata/service/collector.yml b/metadata/service/collector.yml new file mode 100644 index 0000000..f788dd0 --- /dev/null +++ b/metadata/service/collector.yml @@ -0,0 +1,6 @@ +applications: +- grafana +parameters: + grafana: + collector: + enabled: true diff --git a/metadata/service/support.yml b/metadata/service/support.yml index 0d44256..2bcd975 100644 --- a/metadata/service/support.yml +++ b/metadata/service/support.yml @@ -2,7 +2,7 @@ parameters: grafana: _support: collectd: - enabled: false + enabled: true heka: enabled: false sensu: