From 6df0b6aafdb6c53adcbcbfb968cb793755e98aba Mon Sep 17 00:00:00 2001 From: Vitaly Zhuravlev Date: Wed, 11 May 2022 15:25:46 +0400 Subject: [PATCH] Change host:port to instance and replace apache up/down panel to state timeline Due to possible relabelling rules instances may not contain port at all. Keeping it as single value instance makes it more universal. --- .../dashboards/apache-exporter-full.libsonnet | 1187 ++++++++--------- 1 file changed, 575 insertions(+), 612 deletions(-) diff --git a/prometheus/apache-http-mixin/dashboards/apache-exporter-full.libsonnet b/prometheus/apache-http-mixin/dashboards/apache-exporter-full.libsonnet index 8a96ac6..54975bc 100644 --- a/prometheus/apache-http-mixin/dashboards/apache-exporter-full.libsonnet +++ b/prometheus/apache-http-mixin/dashboards/apache-exporter-full.libsonnet @@ -37,13 +37,12 @@ local graphPanel = grafana.graphPanel; datasource: '${datasource}', hide: 0, includeAll: false, - label: 'host', + label: 'instance', multi: false, - name: 'host', + name: 'instance', options: [], query: 'label_values(apache_up, instance)', refresh: 2, - regex: '/([^:]+):.*/', sort: 1, tagValuesQuery: '', tags: [], @@ -51,635 +50,599 @@ local graphPanel = grafana.graphPanel; type: 'query', useTags: false, }, - { - allValue: null, - current: {}, - datasource: '${datasource}', - hide: 2, - includeAll: false, - label: null, - multi: false, - name: 'port', - options: [], - query: 'label_values(apache_up, instance)', - refresh: 1, - regex: '/[^:]+:(.*)/', - sort: 0, - tagValuesQuery: '', - tags: [], - tagsQuery: '', - type: 'query', - useTags: false, - }, ] ) .addPanels([ - { - datasource: { - uid: '${datasource}', - }, - fieldConfig: { - defaults: { - color: { - mode: 'thresholds', - }, - decimals: 1, - mappings: [ - { - options: { - match: 'null', - result: { - text: 'N/A', - }, + { + datasource: { + uid: '${datasource}', + }, + fieldConfig: { + defaults: { + color: { + mode: 'thresholds', + }, + decimals: 1, + mappings: [ + { + options: { + match: 'null', + result: { + text: 'N/A', }, - type: 'special', + }, + type: 'special', + }, + ], + thresholds: { + mode: 'absolute', + steps: [ + { + color: 'green', + value: null, + }, + { + color: 'red', + value: 80, }, ], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { + }, + unit: 's', + }, + overrides: [], + }, + gridPos: { + h: 3, + w: 4, + x: 0, + y: 0, + }, + id: 8, + links: [], + maxDataPoints: 100, + options: { + colorMode: 'none', + graphMode: 'none', + justifyMode: 'auto', + orientation: 'horizontal', + reduceOptions: { + calcs: [ + 'mean', + ], + fields: '', + values: false, + }, + textMode: 'auto', + }, + pluginVersion: '8.4.5', + targets: [ + { + expr: 'apache_uptime_seconds_total{instance=~"$instance"}', + format: 'time_series', + intervalFactor: 1, + refId: 'A', + step: 240, + }, + ], + title: 'Uptime', + type: 'stat', + }, + { + id: 5, + gridPos: { + h: 3, + w: 20, + x: 4, + y: 0, + }, + type: 'state-timeline', + title: 'Apache Up / Down', + datasource: { + uid: '${datasource}', + type: 'prometheus', + }, + pluginVersion: '8.4.5', + links: [], + options: { + mergeValues: false, + showValue: 'never', + alignValue: 'left', + rowHeight: 0.9, + legend: { + displayMode: 'list', + placement: 'right', + }, + tooltip: { + mode: 'single', + sort: 'none', + }, + }, + targets: [ + { + expr: 'apache_up{instance=~"$instance"}', + legendFormat: 'Apache up', + interval: '', + exemplar: true, + format: 'time_series', + intervalFactor: 1, + refId: 'A', + step: 240, + datasource: { + type: 'prometheus', + uid: 'grafanacloud-prom', + }, + }, + ], + fieldConfig: { + defaults: { + custom: { + lineWidth: 0, + fillOpacity: 70, + spanNulls: false, + }, + color: { + mode: 'continuous-GrYlRd', + }, + mappings: [ + { + type: 'value', + options: { + '0': { + text: 'Down', color: 'red', - value: 80, + index: 1, }, - ], + '1': { + text: 'Up', + color: 'green', + index: 0, + }, + }, }, - unit: 's', - }, - overrides: [], - }, - gridPos: { - h: 3, - w: 4, - x: 0, - y: 0, - }, - id: 8, - links: [], - maxDataPoints: 100, - options: { - colorMode: 'none', - graphMode: 'none', - justifyMode: 'auto', - orientation: 'horizontal', - reduceOptions: { - calcs: [ - 'mean', + ], + thresholds: { + mode: 'absolute', + steps: [ + { + color: 'green', + value: null, + }, ], - fields: '', - values: false, }, - textMode: 'auto', }, - pluginVersion: '8.4.5', - targets: [ - { - expr: 'apache_uptime_seconds_total{instance=~"$host:$port"}', - format: 'time_series', - intervalFactor: 1, - refId: 'A', - step: 240, - }, - ], - title: 'Uptime', - type: 'stat', + overrides: [], }, - { - aliasColors: {}, - bars: false, - dashLength: 10, - dashes: false, - datasource: { - uid: '${datasource}', - }, - decimals: 0, - fill: 7, - fillGradient: 0, - gridPos: { - h: 3, - w: 20, - x: 4, - y: 0, - }, - hiddenSeries: false, - id: 5, - legend: { - alignAsTable: true, - avg: true, - current: true, - max: true, - min: true, - rightSide: true, - show: true, - total: false, - values: true, - }, - lines: true, - linewidth: 3, - links: [], - nullPointMode: 'null', - options: { - alertThreshold: true, - }, - percentage: false, - pluginVersion: '8.4.5', - pointradius: 5, - points: false, - renderer: 'flot', - seriesOverrides: [ - { - alias: 'Apache Down', - color: '#BF1B00', - }, - { - alias: 'Apache Down', - transform: 'negative-Y', - }, - ], - spaceLength: 10, - stack: false, - steppedLine: false, - targets: [ - { - expr: 'count(apache_up{instance=~"$host:$port"} == 1)', - format: 'time_series', - intervalFactor: 1, - legendFormat: 'Apache Up', - refId: 'A', - step: 240, - }, - { - expr: 'scalar(count(apache_up{instance=~"$host:$port"} == 0))', - format: 'time_series', - intervalFactor: 1, - legendFormat: 'Apache Down', - refId: 'B', - step: 240, - }, - ], - thresholds: [], - timeRegions: [], - title: 'Apache Up / Down', - tooltip: { - shared: true, - sort: 0, - value_type: 'individual', - }, - type: 'graph', - xaxis: { - mode: 'time', - show: true, - values: [], - }, - yaxes: [ - { - format: 'short', - logBase: 1, - max: '1', - show: true, - }, - { - format: 'short', - logBase: 1, - show: false, - }, - ], - yaxis: { - align: false, - }, + timeFrom: null, + timeShift: null, + }, + { + aliasColors: {}, + bars: false, + dashLength: 10, + dashes: false, + datasource: { + uid: '${datasource}', }, - { - aliasColors: {}, - bars: false, - dashLength: 10, - dashes: false, - datasource: { - uid: '${datasource}', - }, - decimals: 2, - fill: 1, - fillGradient: 0, - gridPos: { - h: 10, - w: 12, - x: 0, - y: 3, - }, - hiddenSeries: false, - id: 3, - legend: { - alignAsTable: true, - avg: true, - current: true, - max: true, - min: true, - show: true, - total: false, - values: true, - }, - lines: true, - linewidth: 1, - links: [], - nullPointMode: 'null', - options: { - alertThreshold: true, - }, - percentage: false, - pluginVersion: '8.4.5', - pointradius: 5, - points: false, - renderer: 'flot', - seriesOverrides: [], - spaceLength: 10, - stack: false, - steppedLine: false, - targets: [ - { - expr: 'rate(apache_sent_kilobytes_total{instance=~"$host:$port"}[5m])', - format: 'time_series', - intervalFactor: 1, - legendFormat: 'Kilobytes Sent', - refId: 'A', - step: 240, - }, - ], - thresholds: [], - timeRegions: [], - title: 'Current total kbytes sent', - tooltip: { - shared: true, - sort: 0, - value_type: 'individual', - }, - type: 'graph', - xaxis: { - mode: 'time', - show: true, - values: [], - }, - yaxes: [ - { - format: 'deckbytes', - logBase: 1, - show: true, - }, - { - format: 'short', - logBase: 1, - show: false, - }, - ], - yaxis: { - align: false, - }, + decimals: 2, + fill: 1, + fillGradient: 0, + gridPos: { + h: 10, + w: 12, + x: 0, + y: 3, }, - { - aliasColors: {}, - bars: false, - dashLength: 10, - dashes: false, - datasource: { - uid: '${datasource}', - }, - decimals: 2, - fill: 1, - fillGradient: 0, - gridPos: { - h: 10, - w: 12, - x: 12, - y: 3, - }, - hiddenSeries: false, - id: 1, - legend: { - alignAsTable: true, - avg: true, - current: true, - max: true, - min: true, - show: true, - total: false, - values: true, - }, - lines: true, - linewidth: 1, - links: [], - nullPointMode: 'null', - options: { - alertThreshold: true, - }, - percentage: false, - pluginVersion: '8.4.5', - pointradius: 5, - points: false, - renderer: 'flot', - seriesOverrides: [], - spaceLength: 10, - stack: false, - steppedLine: false, - targets: [ - { - expr: 'rate(apache_accesses_total{instance=~"$host:$port"}[5m])', - format: 'time_series', - intervalFactor: 1, - legendFormat: 'Accesses', - refId: 'A', - step: 240, - }, - ], - thresholds: [], - timeRegions: [], - title: 'Current total apache accesses', - tooltip: { - shared: true, - sort: 0, - value_type: 'individual', - }, - type: 'graph', - xaxis: { - mode: 'time', - show: true, - values: [], - }, - yaxes: [ - { - format: 'short', - logBase: 1, - show: true, - }, - { - format: 'short', - logBase: 1, - show: false, - }, - ], - yaxis: { - align: false, - }, + hiddenSeries: false, + id: 3, + legend: { + alignAsTable: true, + avg: true, + current: true, + max: true, + min: true, + show: true, + total: false, + values: true, }, - { - aliasColors: {}, - bars: false, - dashLength: 10, - dashes: false, - datasource: { - uid: '${datasource}', - }, - decimals: 2, - fill: 1, - fillGradient: 0, - gridPos: { - h: 10, - w: 24, - x: 0, - y: 13, - }, - hiddenSeries: false, - id: 2, - legend: { - alignAsTable: true, - avg: true, - current: true, - max: true, - min: true, - rightSide: true, - show: true, - total: false, - values: true, - }, - lines: true, - linewidth: 1, - links: [], - nullPointMode: 'null', - options: { - alertThreshold: true, - }, - percentage: false, - pluginVersion: '8.4.5', - pointradius: 5, - points: false, - renderer: 'flot', - seriesOverrides: [], - spaceLength: 10, - stack: true, - steppedLine: false, - targets: [ - { - expr: 'apache_scoreboard{instance=~"$host:$port"}', - format: 'time_series', - intervalFactor: 1, - legendFormat: '{{ state }}', - refId: 'A', - step: 240, - }, - ], - thresholds: [], - timeRegions: [], - title: 'Apache scoreboard statuses', - tooltip: { - shared: true, - sort: 0, - value_type: 'individual', - }, - type: 'graph', - xaxis: { - mode: 'time', - show: true, - values: [], - }, - yaxes: [ - { - format: 'short', - logBase: 1, - show: true, - }, - { - format: 'short', - logBase: 1, - show: false, - }, - ], - yaxis: { - align: false, - }, + lines: true, + linewidth: 1, + links: [], + nullPointMode: 'null', + options: { + alertThreshold: true, }, - { - aliasColors: {}, - bars: false, - dashLength: 10, - dashes: false, - datasource: { - uid: '${datasource}', - }, - decimals: 2, - fill: 1, - fillGradient: 0, - gridPos: { - h: 10, - w: 12, - x: 0, - y: 23, - }, - hiddenSeries: false, - id: 7, - legend: { - alignAsTable: true, - avg: true, - current: true, - max: true, - min: true, - show: true, - total: false, - values: true, - }, - lines: true, - linewidth: 1, - links: [], - nullPointMode: 'null', - options: { - alertThreshold: true, - }, - percentage: false, - pluginVersion: '8.4.5', - pointradius: 5, - points: false, - renderer: 'flot', - seriesOverrides: [], - spaceLength: 10, - stack: true, - steppedLine: false, - targets: [ - { - expr: 'apache_workers{instance=~"$host:$port"}\n', - format: 'time_series', - intervalFactor: 1, - legendFormat: '{{ state }}', - refId: 'A', - step: 240, - }, - ], - thresholds: [], - timeRegions: [], - title: 'Apache worker statuses', - tooltip: { - shared: true, - sort: 0, - value_type: 'individual', - }, - type: 'graph', - xaxis: { - mode: 'time', - show: true, - values: [], - }, - yaxes: [ - { - format: 'short', - logBase: 1, - show: true, - }, - { - format: 'short', - logBase: 1, - show: false, - }, - ], - yaxis: { - align: false, + percentage: false, + pluginVersion: '8.4.5', + pointradius: 5, + points: false, + renderer: 'flot', + seriesOverrides: [], + spaceLength: 10, + stack: false, + steppedLine: false, + targets: [ + { + expr: 'rate(apache_sent_kilobytes_total{instance=~"$instance"}[5m])', + format: 'time_series', + intervalFactor: 1, + legendFormat: 'Kilobytes Sent', + refId: 'A', + step: 240, }, + ], + thresholds: [], + timeRegions: [], + title: 'Current total kbytes sent', + tooltip: { + shared: true, + sort: 0, + value_type: 'individual', }, - { - aliasColors: {}, - bars: false, - dashLength: 10, - dashes: false, - datasource: { - uid: '${datasource}', - }, - decimals: 2, - fill: 1, - fillGradient: 0, - gridPos: { - h: 10, - w: 12, - x: 12, - y: 23, - }, - hiddenSeries: false, - id: 4, - legend: { - alignAsTable: true, - avg: true, - current: true, - max: true, - min: true, - show: true, - total: false, - values: true, - }, - lines: true, - linewidth: 1, - links: [], - nullPointMode: 'null', - options: { - alertThreshold: true, - }, - percentage: false, - pluginVersion: '8.4.5', - pointradius: 5, - points: false, - renderer: 'flot', - seriesOverrides: [], - spaceLength: 10, - stack: false, - steppedLine: false, - targets: [ - { - expr: 'apache_cpuload{instance=~"$host:$port"}', - format: 'time_series', - intervalFactor: 1, - legendFormat: 'Load', - refId: 'A', - step: 240, - }, - ], - thresholds: [], - timeRegions: [], - title: 'Apache CPU load', - tooltip: { - shared: true, - sort: 0, - value_type: 'individual', - }, - type: 'graph', - xaxis: { - mode: 'time', - show: true, - values: [], - }, - yaxes: [ - { - format: 'short', - logBase: 1, - min: '0', - show: true, - }, - { - format: 'short', - logBase: 1, - show: false, - }, - ], - yaxis: { - align: false, - }, + type: 'graph', + xaxis: { + mode: 'time', + show: true, + values: [], }, - ]), + yaxes: [ + { + format: 'deckbytes', + logBase: 1, + show: true, + }, + { + format: 'short', + logBase: 1, + show: false, + }, + ], + yaxis: { + align: false, + }, + }, + { + aliasColors: {}, + bars: false, + dashLength: 10, + dashes: false, + datasource: { + uid: '${datasource}', + }, + decimals: 2, + fill: 1, + fillGradient: 0, + gridPos: { + h: 10, + w: 12, + x: 12, + y: 3, + }, + hiddenSeries: false, + id: 1, + legend: { + alignAsTable: true, + avg: true, + current: true, + max: true, + min: true, + show: true, + total: false, + values: true, + }, + lines: true, + linewidth: 1, + links: [], + nullPointMode: 'null', + options: { + alertThreshold: true, + }, + percentage: false, + pluginVersion: '8.4.5', + pointradius: 5, + points: false, + renderer: 'flot', + seriesOverrides: [], + spaceLength: 10, + stack: false, + steppedLine: false, + targets: [ + { + expr: 'rate(apache_accesses_total{instance=~"$instance"}[5m])', + format: 'time_series', + intervalFactor: 1, + legendFormat: 'Accesses', + refId: 'A', + step: 240, + }, + ], + thresholds: [], + timeRegions: [], + title: 'Current total apache accesses', + tooltip: { + shared: true, + sort: 0, + value_type: 'individual', + }, + type: 'graph', + xaxis: { + mode: 'time', + show: true, + values: [], + }, + yaxes: [ + { + format: 'short', + logBase: 1, + show: true, + }, + { + format: 'short', + logBase: 1, + show: false, + }, + ], + yaxis: { + align: false, + }, + }, + { + aliasColors: {}, + bars: false, + dashLength: 10, + dashes: false, + datasource: { + uid: '${datasource}', + }, + decimals: 2, + fill: 1, + fillGradient: 0, + gridPos: { + h: 10, + w: 24, + x: 0, + y: 13, + }, + hiddenSeries: false, + id: 2, + legend: { + alignAsTable: true, + avg: true, + current: true, + max: true, + min: true, + rightSide: true, + show: true, + total: false, + values: true, + }, + lines: true, + linewidth: 1, + links: [], + nullPointMode: 'null', + options: { + alertThreshold: true, + }, + percentage: false, + pluginVersion: '8.4.5', + pointradius: 5, + points: false, + renderer: 'flot', + seriesOverrides: [], + spaceLength: 10, + stack: true, + steppedLine: false, + targets: [ + { + expr: 'apache_scoreboard{instance=~"$instance"}', + format: 'time_series', + intervalFactor: 1, + legendFormat: '{{ state }}', + refId: 'A', + step: 240, + }, + ], + thresholds: [], + timeRegions: [], + title: 'Apache scoreboard statuses', + tooltip: { + shared: true, + sort: 0, + value_type: 'individual', + }, + type: 'graph', + xaxis: { + mode: 'time', + show: true, + values: [], + }, + yaxes: [ + { + format: 'short', + logBase: 1, + show: true, + }, + { + format: 'short', + logBase: 1, + show: false, + }, + ], + yaxis: { + align: false, + }, + }, + { + aliasColors: {}, + bars: false, + dashLength: 10, + dashes: false, + datasource: { + uid: '${datasource}', + }, + decimals: 2, + fill: 1, + fillGradient: 0, + gridPos: { + h: 10, + w: 12, + x: 0, + y: 23, + }, + hiddenSeries: false, + id: 7, + legend: { + alignAsTable: true, + avg: true, + current: true, + max: true, + min: true, + show: true, + total: false, + values: true, + }, + lines: true, + linewidth: 1, + links: [], + nullPointMode: 'null', + options: { + alertThreshold: true, + }, + percentage: false, + pluginVersion: '8.4.5', + pointradius: 5, + points: false, + renderer: 'flot', + seriesOverrides: [], + spaceLength: 10, + stack: true, + steppedLine: false, + targets: [ + { + expr: 'apache_workers{instance=~"$instance"}\n', + format: 'time_series', + intervalFactor: 1, + legendFormat: '{{ state }}', + refId: 'A', + step: 240, + }, + ], + thresholds: [], + timeRegions: [], + title: 'Apache worker statuses', + tooltip: { + shared: true, + sort: 0, + value_type: 'individual', + }, + type: 'graph', + xaxis: { + mode: 'time', + show: true, + values: [], + }, + yaxes: [ + { + format: 'short', + logBase: 1, + show: true, + }, + { + format: 'short', + logBase: 1, + show: false, + }, + ], + yaxis: { + align: false, + }, + }, + { + aliasColors: {}, + bars: false, + dashLength: 10, + dashes: false, + datasource: { + uid: '${datasource}', + }, + decimals: 2, + fill: 1, + fillGradient: 0, + gridPos: { + h: 10, + w: 12, + x: 12, + y: 23, + }, + hiddenSeries: false, + id: 4, + legend: { + alignAsTable: true, + avg: true, + current: true, + max: true, + min: true, + show: true, + total: false, + values: true, + }, + lines: true, + linewidth: 1, + links: [], + nullPointMode: 'null', + options: { + alertThreshold: true, + }, + percentage: false, + pluginVersion: '8.4.5', + pointradius: 5, + points: false, + renderer: 'flot', + seriesOverrides: [], + spaceLength: 10, + stack: false, + steppedLine: false, + targets: [ + { + expr: 'apache_cpuload{instance=~"$instance"}', + format: 'time_series', + intervalFactor: 1, + legendFormat: 'Load', + refId: 'A', + step: 240, + }, + ], + thresholds: [], + timeRegions: [], + title: 'Apache CPU load', + tooltip: { + shared: true, + sort: 0, + value_type: 'individual', + }, + type: 'graph', + xaxis: { + mode: 'time', + show: true, + values: [], + }, + yaxes: [ + { + format: 'short', + logBase: 1, + min: '0', + show: true, + }, + { + format: 'short', + logBase: 1, + show: false, + }, + ], + yaxis: { + align: false, + }, + }, + ]), }, }