diff --git a/apache-tomcat-mixin/alerts/alerts.libsonnet b/apache-tomcat-mixin/alerts.libsonnet similarity index 63% rename from apache-tomcat-mixin/alerts/alerts.libsonnet rename to apache-tomcat-mixin/alerts.libsonnet index 0c8b87487..b7fb7df3b 100644 --- a/apache-tomcat-mixin/alerts/alerts.libsonnet +++ b/apache-tomcat-mixin/alerts.libsonnet @@ -1,5 +1,5 @@ { - prometheusAlerts+:: { + new(this): { groups+: [ { name: 'ApacheTomcatAlerts', @@ -7,8 +7,8 @@ { alert: 'ApacheTomcatAlertsHighCpuUsage', expr: ||| - sum by (%(agg)s) (jvm_process_cpu_load{%(filteringSelector)s}) > %(ApacheTomcatAlertsCriticalCpuUsage)s - ||| % $._config { agg: std.join(',', $._config.groupLabels + $._config.instanceLabels) }, + sum by (%(agg)s) (jvm_process_cpu_load{%(filteringSelector)s}) > %(alertsCriticalCpuUsage)s + ||| % this.config { agg: std.join(',', this.config.groupLabels + this.config.instanceLabels) }, 'for': '5m', labels: { severity: 'critical', @@ -18,15 +18,15 @@ description: ( 'The CPU usage has been at {{ printf "%%.0f" $value }} percent over the last 5 minutes on {{$labels.instance}}, ' + - 'which is above the threshold of %(ApacheTomcatAlertsCriticalCpuUsage)s percent.' - ) % $._config, + 'which is above the threshold of %(alertsCriticalCpuUsage)s percent.' + ) % this.config, }, }, { alert: 'ApacheTomcatAlertsHighMemoryUsage', expr: ||| - sum(jvm_memory_usage_used_bytes{%(filteringSelector)s}) by (%(agg)s) / sum(jvm_physical_memory_bytes{%(filteringSelector)s}) by (%(agg)s) * 100 > %(ApacheTomcatAlertsCriticalMemoryUsage)s - ||| % $._config { agg: std.join(',', $._config.groupLabels + $._config.instanceLabels) }, + sum(jvm_memory_usage_used_bytes{%(filteringSelector)s}) by (%(agg)s) / sum(jvm_physical_memory_bytes{%(filteringSelector)s}) by (%(agg)s) * 100 > %(alertsCriticalMemoryUsage)s + ||| % this.config { agg: std.join(',', this.config.groupLabels + this.config.instanceLabels) }, 'for': '5m', labels: { severity: 'critical', @@ -36,15 +36,15 @@ description: ( 'The memory usage has been at {{ printf "%%.0f" $value }} percent over the last 5 minutes on {{$labels.instance}}, ' + - 'which is above the threshold of %(ApacheTomcatAlertsCriticalMemoryUsage)s percent.' - ) % $._config, + 'which is above the threshold of %(alertsCriticalMemoryUsage)s percent.' + ) % this.config, }, }, { - alert: 'ApacheTomcatAlertsHighRequestErrorPercent', + alert: 'ApacheTomcatAlertsRequestErrors', expr: ||| - sum by (%(agg)s) (increase(tomcat_errorcount_total{%(filteringSelector)s}[5m]) / increase(tomcat_requestcount_total{%(filteringSelector)s}[5m]) * 100) > %(ApacheTomcatAlertsCriticalRequestErrorPercentage)s - ||| % $._config { agg: std.join(',', $._config.groupLabels + $._config.instanceLabels) }, + sum by (%(agg)s) (increase(tomcat_errorcount_total{%(filteringSelector)s}[5m]) / increase(tomcat_requestcount_total{%(filteringSelector)s}[5m]) * 100) > %(alertsCriticalRequestErrorPercentage)s + ||| % this.config { agg: std.join(',', this.config.groupLabels + this.config.instanceLabels) }, 'for': '5m', labels: { severity: 'critical', @@ -54,15 +54,15 @@ description: ( 'The percentage of request errors has been at {{ printf "%%.0f" $value }} percent over the last 5 minutes on {{$labels.instance}}, ' + - 'which is above the threshold of %(ApacheTomcatAlertsCriticalRequestErrorPercentage)s percent.' - ) % $._config, + 'which is above the threshold of %(alertsCriticalRequestErrorPercentage)s percent.' + ) % this.config, }, }, { - alert: 'ApacheTomcatAlertsModeratelyHighProcessingTime', + alert: 'ApacheTomcatAlertsHighProcessingTime', expr: ||| - sum by (%(agg)s) (increase(tomcat_processingtime_total{%(filteringSelector)s}[5m]) / increase(tomcat_requestcount_total{%(filteringSelector)s}[5m])) > %(ApacheTomcatAlertsWarningProcessingTime)s - ||| % $._config { agg: std.join(',', $._config.groupLabels + $._config.instanceLabels) }, + sum by (%(agg)s) (increase(tomcat_processingtime_total{%(filteringSelector)s}[5m]) / increase(tomcat_requestcount_total{%(filteringSelector)s}[5m])) > %(alertsWarningProcessingTime)s + ||| % this.config { agg: std.join(',', this.config.groupLabels + this.config.instanceLabels) }, 'for': '5m', labels: { severity: 'warning', @@ -72,8 +72,8 @@ description: ( 'The processing time has been at {{ printf "%%.0f" $value }}ms over the last 5 minutes on {{$labels.instance}}, ' + - 'which is above the threshold of %(ApacheTomcatAlertsWarningProcessingTime)sms.' - ) % $._config, + 'which is above the threshold of %(alertsWarningProcessingTime)sms.' + ) % this.config, }, }, ], diff --git a/apache-tomcat-mixin/config.libsonnet b/apache-tomcat-mixin/config.libsonnet index 281b888f3..386d42329 100644 --- a/apache-tomcat-mixin/config.libsonnet +++ b/apache-tomcat-mixin/config.libsonnet @@ -1,24 +1,33 @@ { - _config+:: { - dashboardTags: ['apache-tomcat-mixin'], - dashboardPeriod: 'now-1h', - dashboardTimezone: 'default', - dashboardRefresh: '1m', + local this = self, + filteringSelector: 'job="integrations/tomcat"', + groupLabels: ['job', 'cluster'], + logLabels: [], + instanceLabels: ['instance'], - //alert thresholds - ApacheTomcatAlertsCriticalCpuUsage: 80, //% - ApacheTomcatAlertsCriticalMemoryUsage: 80, //% - ApacheTomcatAlertsCriticalRequestErrorPercentage: 5, //% - ApacheTomcatAlertsWarningProcessingTime: 300, //ms + uid: 'apache-tomcat', + dashboardTags: [self.uid + '-mixin'], + dashboardNamePrefix: 'Apache Tomcat', + dashboardPeriod: 'now-1h', + dashboardTimezone: 'default', + dashboardRefresh: '1m', + metricsSource: ['prometheus'], // metrics source for signals - // used in alerts: - filteringSelector: 'job="integrations/tomcat"', - groupLabels: if self.enableMultiCluster then ['job', 'cluster'] else ['job'], - instanceLabels: ['instance'], - enableLokiLogs: true, - enableMultiCluster: false, - multiclusterSelector: 'job=~"$job"', - tomcatSelector: if self.enableMultiCluster then 'job=~"$job", cluster=~"$cluster"' else 'job=~"$job"', + // Logging configuration + enableLokiLogs: true, + extraLogLabels: ['level'], // Required by logs-lib + logsVolumeGroupBy: 'level', + showLogsVolume: true, + + // alert thresholds + alertsCriticalCpuUsage: 80, //% + alertsCriticalMemoryUsage: 80, //% + alertsCriticalRequestErrorPercentage: 5, //% + alertsWarningProcessingTime: 300, //ms + + signals+: { + overview: (import './signals/overview.libsonnet')(this), + hosts: (import './signals/hosts.libsonnet')(this), }, } diff --git a/apache-tomcat-mixin/dashboards.libsonnet b/apache-tomcat-mixin/dashboards.libsonnet new file mode 100644 index 000000000..97337d17b --- /dev/null +++ b/apache-tomcat-mixin/dashboards.libsonnet @@ -0,0 +1,132 @@ +local g = import './g.libsonnet'; +local commonlib = import 'common-lib/common/main.libsonnet'; +local logslib = import 'logs-lib/logs/main.libsonnet'; + +{ + local root = self, + new(this):: + local prefix = this.config.dashboardNamePrefix; + local links = this.grafana.links; + local tags = this.config.dashboardTags; + local uid = g.util.string.slugify(this.config.uid); + local vars = this.grafana.variables; + local annotations = this.grafana.annotations; + local refresh = this.config.dashboardRefresh; + local period = this.config.dashboardPeriod; + local timezone = this.config.dashboardTimezone; + { + 'apache-tomcat-overview.json': + g.dashboard.new(prefix + ' overview') + + g.dashboard.withPanels( + g.util.panel.resolveCollapsedFlagOnRows( + g.util.grid.wrapPanels( + [ + this.grafana.rows.overview, + ], + ), + ), + ) + root.applyCommon( + vars.multiInstance + [ + g.dashboard.variable.query.new( + 'protocol', + query='label_values(tomcat_bytesreceived_total{%(queriesSelector)s}, protocol)' % vars + ) + + g.dashboard.variable.custom.selectionOptions.withMulti(true) + + g.dashboard.variable.query.queryTypes.withLabelValues(label='protocol', metric='tomcat_bytesreceived_total{%(queriesSelector)s}' % vars) + + g.dashboard.variable.query.withDatasourceFromVariable(variable=vars.datasources.prometheus), + + g.dashboard.variable.query.new( + 'port', + query='label_values(tomcat_bytesreceived_total{%(queriesSelector)s}, port)' % vars + ) + + g.dashboard.variable.custom.selectionOptions.withMulti(true) + + g.dashboard.variable.query.queryTypes.withLabelValues(label='port', metric='tomcat_bytesreceived_total{%(queriesSelector)s}' % vars) + + g.dashboard.variable.query.withDatasourceFromVariable(variable=vars.datasources.prometheus), + ], + uid + '_overview', + tags, + links { apacheTomcatOverview:: {} }, + annotations, + timezone, + refresh, + period + ), + + 'apache-tomcat-hosts.json': + g.dashboard.new(prefix + ' hosts') + + g.dashboard.withPanels( + g.util.panel.resolveCollapsedFlagOnRows( + g.util.grid.wrapPanels( + [ + this.grafana.rows.hosts, + this.grafana.rows.hostServlets, + ], + ), + ), + ) + root.applyCommon( + vars.multiInstance + [ + g.dashboard.variable.query.new('host') + + g.dashboard.variable.custom.selectionOptions.withMulti(true) + + g.dashboard.variable.query.queryTypes.withLabelValues(label='host', metric='tomcat_session_sessioncounter_total{%(queriesSelector)s}' % vars) + + g.dashboard.variable.query.withDatasourceFromVariable(variable=vars.datasources.prometheus), + + g.dashboard.variable.query.new('context') + + g.dashboard.variable.custom.selectionOptions.withMulti(true) + + g.dashboard.variable.query.queryTypes.withLabelValues(label='context', metric='tomcat_session_sessioncounter_total{%(queriesSelector)s}' % vars) + + g.dashboard.variable.query.withDatasourceFromVariable(variable=vars.datasources.prometheus), + + g.dashboard.variable.query.new('servlet') + + g.dashboard.variable.custom.selectionOptions.withMulti(true) + + g.dashboard.variable.query.queryTypes.withLabelValues(label='servlet', metric='tomcat_servlet_requestcount_total{%(queriesSelector)s}' % vars) + + g.dashboard.variable.query.withDatasourceFromVariable(variable=vars.datasources.prometheus), + ], + uid + '_hosts', + tags, + links { apacheTomcatHosts:: {} }, + annotations, + timezone, + refresh, + period + ), + } + if this.config.enableLokiLogs then { + 'apache-tomcat-logs.json': + logslib.new( + prefix + ' logs', + datasourceName=this.grafana.variables.datasources.loki.name, + datasourceRegex=this.grafana.variables.datasources.loki.regex, + filterSelector=this.config.filteringSelector, + labels=this.config.groupLabels + this.config.extraLogLabels, + formatParser=null, + showLogsVolume=this.config.showLogsVolume, + ) + { + dashboards+: + { + logs+: + root.applyCommon(super.logs.templating.list, uid=uid + '-logs', tags=tags, links=links { apacheTomcatLogs:: {} }, annotations=annotations, timezone=timezone, refresh=refresh, period=period), + }, + panels+: + { + logs+: + g.panel.logs.options.withEnableLogDetails(true) + + g.panel.logs.options.withShowTime(false) + + g.panel.logs.options.withWrapLogMessage(false), + }, + variables+: { + toArray+: [ + this.grafana.variables.datasources.prometheus { hide: 2 }, + ], + }, + }.dashboards.logs, + }, + + applyCommon(vars, uid, tags, links, annotations, timezone, refresh, period): + g.dashboard.withTags(tags) + + g.dashboard.withUid(uid) + + g.dashboard.withLinks(std.objectValues(links)) + + g.dashboard.withTimezone(timezone) + + g.dashboard.withRefresh(refresh) + + g.dashboard.time.withFrom(period) + + g.dashboard.withVariables(vars) + + g.dashboard.withAnnotations(std.objectValues(annotations)), +} diff --git a/apache-tomcat-mixin/dashboards/apache-tomcat-hosts.libsonnet b/apache-tomcat-mixin/dashboards/apache-tomcat-hosts.libsonnet deleted file mode 100644 index d971f306c..000000000 --- a/apache-tomcat-mixin/dashboards/apache-tomcat-hosts.libsonnet +++ /dev/null @@ -1,512 +0,0 @@ -local g = (import 'grafana-builder/grafana.libsonnet'); -local grafana = (import 'grafonnet/grafana.libsonnet'); -local dashboard = grafana.dashboard; -local template = grafana.template; -local prometheus = grafana.prometheus; - -local dashboardUid = 'apache-tomcat-hosts'; - -local promDatasourceName = 'prometheus_datasource'; - -local getMatcher(cfg) = '%(tomcatSelector)s, instance=~"$instance"' % cfg; - -local promDatasource = { - uid: '${%s}' % promDatasourceName, -}; - -local sessionsPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'sum(increase(tomcat_session_sessioncounter_total{' + matcher + ', host=~"$host", context=~"$context"}[$__interval:] offset -$__interval)) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - total sessions', - interval='1m', - ), - prometheus.target( - 'sum(increase(tomcat_session_rejectedsessions_total{' + matcher + ', host=~"$host", context=~"$context"}[$__interval:] offset -$__interval)) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - rejected', - interval='1m', - ), - prometheus.target( - 'sum(increase(tomcat_session_expiredsessions_total{' + matcher + ', host=~"$host", context=~"$context"}[$__interval:] offset -$__interval)) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - expired', - interval='1m', - ), - prometheus.target( - 'increase(tomcat_session_sessioncounter_total{' + matcher + ', host=~"$host", context=~"$context"}[$__interval:] offset -$__interval)', - datasource=promDatasource, - legendFormat='{{instance}} - {{host}}{{context}} - sessions', - interval='1m', - ), - prometheus.target( - 'increase(tomcat_session_rejectedsessions_total{' + matcher + ', host=~"$host", context=~"$context"}[$__interval:] offset -$__interval)', - datasource=promDatasource, - legendFormat='{{instance}} - {{host}}{{context}} - rejected', - interval='1m', - ), - prometheus.target( - 'increase(tomcat_session_expiredsessions_total{' + matcher + ', host=~"$host", context=~"$context"}[$__interval:] offset -$__interval)', - datasource=promDatasource, - legendFormat='{{instance}} - {{host}}{{context}} - expired', - interval='1m', - ), - ], - type: 'timeseries', - title: 'Sessions', - description: 'The number of different types of sessions created for a Tomcat host', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineStyle: { - fill: 'solid', - }, - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'right', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local sessionProcessingTimePanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'sum(increase(tomcat_session_processingtime_total{' + matcher + ', host=~"$host", context=~"$context"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_session_sessioncounter_total{job=~"$job", instance=~"$instance", host=~"$host", context=~"$context"}[$__interval:] offset -$__interval), 1)) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - total', - interval='1m', - ), - prometheus.target( - 'increase(tomcat_session_processingtime_total{' + matcher + ', host=~"$host", context=~"$context"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_session_sessioncounter_total{job=~"$job", instance=~"$instance", host=~"$host", context=~"$context"}[$__interval:] offset -$__interval), 1)', - datasource=promDatasource, - legendFormat='{{instance}} - {{host}}{{context}}', - interval='1m', - ), - ], - type: 'timeseries', - title: 'Session processing time', - description: 'The average time taken to process recent sessions for a Tomcat host', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'ms', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local servletRow = { - datasource: promDatasource, - targets: [], - type: 'row', - title: 'Servlet', - collapsed: false, -}; - -local servletRequestsPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'sum(rate(tomcat_servlet_requestcount_total{' + matcher + ', module=~"$host$context", servlet=~"$servlet"}[$__rate_interval])) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - total requests', - ), - prometheus.target( - 'sum(rate(tomcat_servlet_errorcount_total{' + matcher + ', module=~"$host$context", servlet=~"$servlet"}[$__rate_interval])) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - total errors', - ), - prometheus.target( - 'rate(tomcat_servlet_requestcount_total{' + matcher + ', module=~"$host$context", servlet=~"$servlet"}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{instance}} - {{module}}{{servlet}} - requests', - ), - prometheus.target( - 'rate(tomcat_servlet_errorcount_total{' + matcher + ', module=~"$host$context", servlet=~"$servlet"}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{instance}} - {{module}}{{servlet}} - errors', - ), - ], - type: 'timeseries', - title: 'Servlet requests', - description: 'The total requests and errors for a Tomcat servlet', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'r/s', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'right', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local servletProcessingTimePanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'sum(increase(tomcat_servlet_processingtime_total{' + matcher + ', module=~"$host$context", servlet=~"$servlet"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_servlet_requestcount_total{' + matcher + ', module=~"$host$context", servlet=~"$servlet"}[$__interval:] offset -$__interval), 1)) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - total', - interval='1m', - ), - prometheus.target( - 'increase(tomcat_servlet_processingtime_total{' + matcher + ', module=~"$host$context", servlet=~"$servlet"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_servlet_requestcount_total{' + matcher + ', module=~"$host$context", servlet=~"$servlet"}[$__interval:] offset -$__interval), 1)', - datasource=promDatasource, - legendFormat='{{instance}} - {{module}}{{servlet}}', - interval='1m', - ), - ], - type: 'timeseries', - title: 'Servlet processing time', - description: 'The average time taken to process recent requests in a Tomcat servlet', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'ms', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -{ - grafanaDashboards+:: { - 'apache-tomcat-hosts.json': - dashboard.new( - 'Apache Tomcat hosts', - time_from='%s' % $._config.dashboardPeriod, - tags=($._config.dashboardTags), - timezone='%s' % $._config.dashboardTimezone, - refresh='%s' % $._config.dashboardRefresh, - description='', - uid=dashboardUid, - ) - - .addLink(grafana.link.dashboards( - asDropdown=false, - title='Other Apache Tomcat dashboards', - includeVars=true, - keepTime=true, - tags=($._config.dashboardTags), - )) - - .addTemplates( - [ - template.datasource( - promDatasourceName, - 'prometheus', - null, - label='Data Source', - refresh='load' - ), - template.new( - 'job', - promDatasource, - 'label_values(tomcat_bytesreceived_total, job)', - label='Job', - refresh=1, - includeAll=false, - multi=false, - allValues='', - sort=0 - ), - template.new( - 'cluster', - promDatasource, - 'label_values(tomcat_bytesreceived_total{%(multiclusterSelector)s}, cluster)' % $._config, - label='Cluster', - refresh=2, - includeAll=true, - multi=true, - allValues='.*', - hide=if $._config.enableMultiCluster then '' else 'variable', - sort=0 - ), - template.new( - 'instance', - promDatasource, - 'label_values(tomcat_bytesreceived_total{%(tomcatSelector)s}, instance)' % $._config, - label='Instance', - refresh=1, - includeAll=false, - multi=false, - allValues='', - sort=0 - ), - template.new( - 'host', - promDatasource, - 'label_values(tomcat_session_sessioncounter_total{%(tomcatSelector)s}, host)' % $._config, - label='Host', - refresh=1, - includeAll=true, - multi=true, - allValues='', - sort=0 - ), - template.new( - 'context', - promDatasource, - 'label_values(tomcat_session_sessioncounter_total{%(tomcatSelector)s, host=~"$host"}, context)' % $._config, - label='Context', - refresh=1, - includeAll=true, - multi=true, - allValues='', - sort=0 - ), - template.new( - 'servlet', - promDatasource, - 'label_values(tomcat_servlet_requestcount_total{%(tomcatSelector)s, module=~"$host$context"}, servlet)' % $._config, - label='Servlet', - refresh=1, - includeAll=true, - multi=true, - allValues='', - sort=0 - ), - ] - ) - .addPanels( - [ - sessionsPanel(getMatcher($._config)) { gridPos: { h: 10, w: 12, x: 0, y: 0 } }, - sessionProcessingTimePanel(getMatcher($._config)) { gridPos: { h: 10, w: 12, x: 12, y: 0 } }, - servletRow { gridPos: { h: 1, w: 24, x: 0, y: 10 } }, - servletRequestsPanel(getMatcher($._config)) { gridPos: { h: 10, w: 12, x: 0, y: 11 } }, - servletProcessingTimePanel(getMatcher($._config)) { gridPos: { h: 10, w: 12, x: 12, y: 11 } }, - ] - ), - }, -} diff --git a/apache-tomcat-mixin/dashboards/apache-tomcat-overview.libsonnet b/apache-tomcat-mixin/dashboards/apache-tomcat-overview.libsonnet deleted file mode 100644 index 856b3a21e..000000000 --- a/apache-tomcat-mixin/dashboards/apache-tomcat-overview.libsonnet +++ /dev/null @@ -1,794 +0,0 @@ -local g = (import 'grafana-builder/grafana.libsonnet'); -local grafana = (import 'grafonnet/grafana.libsonnet'); -local dashboard = grafana.dashboard; -local template = grafana.template; -local prometheus = grafana.prometheus; - -local dashboardUid = 'apache-tomcat-overview'; - -local promDatasourceName = 'prometheus_datasource'; -local lokiDatasourceName = 'loki_datasource'; - -local filenameLogFilter = 'filename=~"/var/log/tomcat.*/catalina.out|/opt/tomcat/logs/catalina.out|/Program Files/Apache Software Foundation/Tomcat .*..*/logs/catalina.out"'; - -local getMatcher(cfg) = '%(tomcatSelector)s, instance=~"$instance"' % cfg; - -local promDatasource = { - uid: '${%s}' % promDatasourceName, -}; - -local lokiDatasource = { - uid: '${%s}' % lokiDatasourceName, -}; - -local memoryUsagePanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'jvm_memory_usage_used_bytes{' + matcher + '}', - datasource=promDatasource, - legendFormat='{{instance}} - {{area}}', - ), - ], - type: 'timeseries', - title: 'Memory usage', - description: 'The memory usage of the JVM of the instance', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineStyle: { - fill: 'solid', - }, - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'bytes', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local cpuUsagePanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'jvm_process_cpu_load{' + matcher + '}', - datasource=promDatasource, - legendFormat='{{instance}}', - ), - ], - type: 'timeseries', - title: 'CPU usage', - description: 'The CPU usage of the JVM process', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'line', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'percentunit', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local trafficSentPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'sum(rate(tomcat_bytessent_total{' + matcher + ', protocol=~"$protocol", port=~"$port"}[$__rate_interval])) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - total', - ), - prometheus.target( - 'rate(tomcat_bytessent_total{' + matcher + ', protocol=~"$protocol", port=~"$port"}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{instance}} - {{protocol}}-{{port}}', - ), - ], - type: 'timeseries', - title: 'Traffic sent', - description: 'The sent traffic for a Tomcat connector', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'Bps', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local trafficReceivedPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'sum(rate(tomcat_bytesreceived_total{' + matcher + ', protocol=~"$protocol", port=~"$port"}[$__rate_interval])) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - total', - ), - prometheus.target( - 'rate(tomcat_bytesreceived_total{' + matcher + ', protocol=~"$protocol", port=~"$port"}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{instance}} - {{protocol}}-{{port}}', - ), - ], - type: 'timeseries', - title: 'Traffic received', - description: 'The received traffic for a Tomcat connector', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'Bps', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local requestsPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'sum(rate(tomcat_requestcount_total{' + matcher + ', protocol=~"$protocol", port=~"$port"}[$__rate_interval])) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - total requests', - ), - prometheus.target( - 'sum(rate(tomcat_errorcount_total{' + matcher + ', protocol=~"$protocol", port=~"$port"}[$__rate_interval])) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - total errors', - ), - prometheus.target( - 'rate(tomcat_requestcount_total{' + matcher + ', protocol=~"$protocol", port=~"$port"}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{instance}} - {{protocol}}-{{port}} - requests', - ), - prometheus.target( - 'rate(tomcat_errorcount_total{' + matcher + ', protocol=~"$protocol", port=~"$port"}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{instance}} - {{protocol}}-{{port}} - errors', - ), - ], - type: 'timeseries', - title: 'Requests', - description: 'The total requests and errors for a Tomcat connector', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'r/s', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local processingTimePanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'sum(increase(tomcat_processingtime_total{' + matcher + ', protocol=~"$protocol", port=~"$port"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_requestcount_total{' + matcher + ', protocol=~"$protocol", port=~"$port"}[$__interval:] offset -$__interval), 1)) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - total', - interval='1m', - ), - prometheus.target( - 'increase(tomcat_processingtime_total{' + matcher + ', protocol=~"$protocol", port=~"$port"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_requestcount_total{' + matcher + ', protocol=~"$protocol", port=~"$port"}[$__interval:] offset -$__interval), 1)', - datasource=promDatasource, - legendFormat='{{instance}} - {{protocol}}-{{port}}', - interval='1m', - ), - ], - type: 'timeseries', - title: 'Processing time', - description: 'The average time taken to process recent requests for a Tomcat connector', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - axisSoftMin: 0, - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'line', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 300, - }, - ], - }, - unit: 'ms', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local threadsPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'sum(tomcat_threadpool_connectioncount{' + matcher + ', protocol=~"$protocol", port=~"$port"}) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - total connections', - ), - prometheus.target( - 'sum(tomcat_threadpool_pollerthreadcount{' + matcher + ', protocol=~"$protocol", port=~"$port"}) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - poller total', - ), - prometheus.target( - 'sum(tomcat_threadpool_keepalivecount{' + matcher + ', protocol=~"$protocol", port=~"$port"}) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - idle total', - ), - prometheus.target( - 'sum(tomcat_threadpool_currentthreadcount{' + matcher + ', protocol=~"$protocol", port=~"$port"}) by (job, instance)', - datasource=promDatasource, - legendFormat='{{instance}} - active total', - ), - prometheus.target( - 'tomcat_threadpool_connectioncount{' + matcher + ', protocol=~"$protocol", port=~"$port"}', - datasource=promDatasource, - legendFormat='{{instance}} - {{protocol}}-{{port}} - connections', - ), - prometheus.target( - 'tomcat_threadpool_pollerthreadcount{' + matcher + ', protocol=~"$protocol", port=~"$port"}', - datasource=promDatasource, - legendFormat='{{instance}} - {{protocol}}-{{port}} - poller', - ), - prometheus.target( - 'tomcat_threadpool_keepalivecount{' + matcher + ', protocol=~"$protocol", port=~"$port"}', - datasource=promDatasource, - legendFormat='{{instance}} - {{protocol}}-{{port}} - idle', - ), - prometheus.target( - 'tomcat_threadpool_currentthreadcount{' + matcher + ', protocol=~"$protocol", port=~"$port"}', - datasource=promDatasource, - legendFormat='{{instance}} - {{protocol}}-{{port}} - active', - ), - ], - type: 'timeseries', - title: 'Threads', - description: 'The number of various threads being used by a Tomcat connector', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'right', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local logsPanel(matcher) = { - datasource: lokiDatasource, - targets: [ - { - datasource: lokiDatasource, - editorMode: 'code', - expr: '{' + matcher + '} |= `` | (' + filenameLogFilter + ' or log_type="catalina.out")', - queryType: 'range', - refId: 'A', - }, - ], - type: 'logs', - title: 'Logs', - description: 'Recent logs from the Catalina.out logs file\n', - options: { - dedupStrategy: 'none', - enableLogDetails: true, - prettifyLogMessage: false, - showCommonLabels: false, - showLabels: false, - showTime: false, - sortOrder: 'Descending', - wrapLogMessage: false, - }, -}; - -{ - grafanaDashboards+:: { - 'apache-tomcat-overview.json': - dashboard.new( - 'Apache Tomcat overview', - time_from='%s' % $._config.dashboardPeriod, - tags=($._config.dashboardTags), - timezone='%s' % $._config.dashboardTimezone, - refresh='%s' % $._config.dashboardRefresh, - description='', - uid=dashboardUid, - ) - - .addLink(grafana.link.dashboards( - asDropdown=false, - title='Other Apache Tomcat dashboards', - includeVars=true, - keepTime=true, - tags=($._config.dashboardTags), - )) - - .addTemplates( - std.flattenArrays([ - [ - template.datasource( - promDatasourceName, - 'prometheus', - null, - label='Data Source', - refresh='load' - ), - ], - if $._config.enableLokiLogs then [ - template.datasource( - lokiDatasourceName, - 'loki', - null, - label='Loki Datasource', - refresh='load' - ), - ] else [], - [ - template.new( - 'job', - promDatasource, - 'label_values(tomcat_bytesreceived_total, job)', - label='Job', - refresh=1, - includeAll=false, - multi=false, - allValues='', - sort=0 - ), - template.new( - 'cluster', - promDatasource, - 'label_values(tomcat_bytesreceived_total{%(multiclusterSelector)s}, cluster)' % $._config, - label='Cluster', - refresh=2, - includeAll=true, - multi=true, - allValues='.*', - hide=if $._config.enableMultiCluster then '' else 'variable', - sort=0 - ), - template.new( - 'instance', - promDatasource, - 'label_values(tomcat_bytesreceived_total{%(tomcatSelector)s}, instance)' % $._config, - label='Instance', - refresh=2, - includeAll=true, - multi=true, - allValues='.+', - sort=1 - ), - template.new( - 'protocol', - promDatasource, - 'label_values(tomcat_bytesreceived_total{%(tomcatSelector)s}, protocol)' % $._config, - label='Protocol', - refresh=1, - includeAll=true, - multi=true, - allValues='.+', - sort=0 - ), - template.new( - 'port', - promDatasource, - 'label_values(tomcat_bytesreceived_total{%(tomcatSelector)s}, port)' % $._config, - label='Port', - refresh=1, - includeAll=true, - multi=true, - allValues='.+', - sort=0 - ), - ], - ]) - ) - .addPanels( - std.flattenArrays([ - [ - memoryUsagePanel(getMatcher($._config)) { gridPos: { h: 6, w: 12, x: 0, y: 0 } }, - cpuUsagePanel(getMatcher($._config)) { gridPos: { h: 6, w: 12, x: 12, y: 0 } }, - trafficSentPanel(getMatcher($._config)) { gridPos: { h: 6, w: 12, x: 0, y: 6 } }, - trafficReceivedPanel(getMatcher($._config)) { gridPos: { h: 6, w: 12, x: 12, y: 6 } }, - requestsPanel(getMatcher($._config)) { gridPos: { h: 6, w: 12, x: 0, y: 12 } }, - processingTimePanel(getMatcher($._config)) { gridPos: { h: 6, w: 12, x: 12, y: 12 } }, - threadsPanel(getMatcher($._config)) { gridPos: { h: 6, w: 24, x: 0, y: 18 } }, - ], - if $._config.enableLokiLogs then [ - logsPanel(getMatcher($._config)) { gridPos: { h: 6, w: 24, x: 0, y: 24 } }, - ] else [], - [ - ], - ]) - ), - - }, -} diff --git a/apache-tomcat-mixin/dashboards/dashboards.libsonnet b/apache-tomcat-mixin/dashboards/dashboards.libsonnet deleted file mode 100644 index dda76b478..000000000 --- a/apache-tomcat-mixin/dashboards/dashboards.libsonnet +++ /dev/null @@ -1,2 +0,0 @@ -(import 'apache-tomcat-overview.libsonnet') + -(import 'apache-tomcat-hosts.libsonnet') diff --git a/apache-tomcat-mixin/dashboards_out/apache-tomcat-hosts.json b/apache-tomcat-mixin/dashboards_out/apache-tomcat-hosts.json index 293ad5315..81e60b1e0 100644 --- a/apache-tomcat-mixin/dashboards_out/apache-tomcat-hosts.json +++ b/apache-tomcat-mixin/dashboards_out/apache-tomcat-hosts.json @@ -1,170 +1,156 @@ { - "__inputs": [ ], - "__requires": [ ], "annotations": { "list": [ ] }, - "description": "", "editable": false, - "gnetId": null, - "graphTooltip": 0, - "hideControls": false, "id": null, "links": [ { - "asDropdown": false, - "icon": "external link", + "keepTime": true, + "title": "Apache Tomcat logs", + "type": "link", + "url": "/d/apachetomcat-logs" + }, + { + "keepTime": true, + "title": "Apache Tomcat overview", + "type": "link", + "url": "/d/apachetomcat_overview" + }, + { + "asDropdown": true, "includeVars": true, "keepTime": true, "tags": [ "apache-tomcat-mixin" ], - "targetBlank": false, - "title": "Other Apache Tomcat dashboards", - "type": "dashboards", - "url": "" + "title": "All dashboards", + "type": "dashboards" } ], "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 0, + "x": 0, + "y": 0 + }, + "id": 1, + "panels": [ ], + "title": "Hosts", + "type": "row" + }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "description": "The number of different types of sessions created for a Tomcat host", + "description": "The number of different types of sessions created for a Tomcat host.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] + "fillOpacity": 30, + "gradientMode": "opacity", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" } - }, - "overrides": [ ] + } }, "gridPos": { - "h": 10, + "h": 8, "w": 12, "x": 0, - "y": 0 + "y": 1 }, "id": 2, "options": { "legend": { + "asTable": true, "calcs": [ ], "displayMode": "list", - "placement": "right", - "showLegend": true + "placement": "right" }, "tooltip": { - "mode": "single", - "sort": "none" + "mode": "multi", + "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(increase(tomcat_session_sessioncounter_total{job=~\"$job\", instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval)) by (job, instance)", + "expr": "sum(increase(tomcat_session_sessioncounter_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval)) by (job, instance)", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{instance}} - total sessions" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - total sessions", + "refId": "Total sessions" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(increase(tomcat_session_rejectedsessions_total{job=~\"$job\", instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval)) by (job, instance)", + "expr": "sum(increase(tomcat_session_rejectedsessions_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval)) by (job, instance)", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{instance}} - rejected" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - rejected sessions", + "refId": "Rejected sessions" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(increase(tomcat_session_expiredsessions_total{job=~\"$job\", instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval)) by (job, instance)", + "expr": "sum(increase(tomcat_session_expiredsessions_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval)) by (job, instance)", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{instance}} - expired" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - expired sessions", + "refId": "Expired sessions" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "increase(tomcat_session_sessioncounter_total{job=~\"$job\", instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval)", + "expr": "increase(tomcat_session_sessioncounter_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval)", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{host}}{{context}} - sessions" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{host}}{{context}} - sessions", + "refId": "Session rate" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "increase(tomcat_session_rejectedsessions_total{job=~\"$job\", instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval)", + "expr": "increase(tomcat_session_rejectedsessions_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval)", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{host}}{{context}} - rejected" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{host}}{{context}} - rejected", + "refId": "Rejected rate" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "increase(tomcat_session_expiredsessions_total{job=~\"$job\", instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval)", + "expr": "increase(tomcat_session_expiredsessions_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval)", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{host}}{{context}} - expired" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{host}}{{context}} - expired", + "refId": "Expired rate" } ], "title": "Sessions", @@ -172,101 +158,66 @@ }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "description": "The average time taken to process recent sessions for a Tomcat host", + "description": "The average time taken to process recent sessions for a Tomcat host.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] + "fillOpacity": 30, + "gradientMode": "opacity", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" }, "unit": "ms" - }, - "overrides": [ ] + } }, "gridPos": { - "h": 10, + "h": 8, "w": 12, "x": 12, - "y": 0 + "y": 1 }, "id": 3, "options": { "legend": { + "asTable": true, "calcs": [ ], "displayMode": "list", - "placement": "bottom", - "showLegend": true + "placement": "right" }, "tooltip": { - "mode": "single", - "sort": "none" + "mode": "multi", + "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(increase(tomcat_session_processingtime_total{job=~\"$job\", instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_session_sessioncounter_total{job=~\"$job\", instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval), 1)) by (job, instance)", + "expr": "sum(increase(tomcat_session_processingtime_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_session_sessioncounter_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval), 1)) by (job, instance)", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{instance}} - total" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - total", + "refId": "Total session processing time" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "increase(tomcat_session_processingtime_total{job=~\"$job\", instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_session_sessioncounter_total{job=~\"$job\", instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval), 1)", + "expr": "increase(tomcat_session_processingtime_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_session_sessioncounter_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", host=~\"$host\", context=~\"$context\"}[$__interval:] offset -$__interval), 1)", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{host}}{{context}}" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{host}}{{context}}", + "refId": "Session processing time" } ], "title": "Session processing time", @@ -274,426 +225,283 @@ }, { "collapsed": false, - "datasource": { - "uid": "${prometheus_datasource}" - }, "gridPos": { "h": 1, - "w": 24, + "w": 0, "x": 0, - "y": 10 + "y": 9 }, "id": 4, - "targets": [ ], + "panels": [ ], "title": "Servlet", "type": "row" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "description": "The total requests and errors for a Tomcat servlet", + "description": "The total requests and errors for a Tomcat servlet.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } + "fillOpacity": 30, + "gradientMode": "opacity", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "r/s" - }, - "overrides": [ ] + "unit": "reqps" + } }, "gridPos": { - "h": 10, + "h": 8, "w": 12, "x": 0, - "y": 11 + "y": 10 }, "id": 5, "options": { "legend": { + "asTable": true, "calcs": [ ], "displayMode": "list", - "placement": "right", - "showLegend": true + "placement": "right" }, "tooltip": { - "mode": "single", - "sort": "none" + "mode": "multi", + "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(rate(tomcat_servlet_requestcount_total{job=~\"$job\", instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__rate_interval])) by (job, instance)", + "expr": "sum(rate(tomcat_servlet_requestcount_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__rate_interval])) by (job, instance)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - total requests" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - total requests", + "refId": "Total servlet requests" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(rate(tomcat_servlet_errorcount_total{job=~\"$job\", instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__rate_interval])) by (job, instance)", + "expr": "sum(rate(tomcat_servlet_errorcount_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__rate_interval])) by (job, instance)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - total errors" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - total errors", + "refId": "Total servlet errors" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(tomcat_servlet_requestcount_total{job=~\"$job\", instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__rate_interval])", + "expr": "rate(tomcat_servlet_requestcount_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__rate_interval])", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{module}}{{servlet}} - requests" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{module}}{{servlet}} - requests", + "refId": "Servlet request rate" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(tomcat_servlet_errorcount_total{job=~\"$job\", instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__rate_interval])", + "expr": "rate(tomcat_servlet_errorcount_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__rate_interval])", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{module}}{{servlet}} - errors" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{module}}{{servlet}} - errors", + "refId": "Servlet error rate" } ], - "title": "Servlet requests", + "title": "Servlet", "type": "timeseries" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "description": "The average time taken to process recent requests in a Tomcat servlet", + "description": "The average time taken to process recent servlet requests for a Tomcat host.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] + "fillOpacity": 30, + "gradientMode": "opacity", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" }, "unit": "ms" - }, - "overrides": [ ] + } }, "gridPos": { - "h": 10, + "h": 8, "w": 12, "x": 12, - "y": 11 + "y": 10 }, "id": 6, "options": { "legend": { + "asTable": true, "calcs": [ ], "displayMode": "list", - "placement": "bottom", - "showLegend": true + "placement": "right" }, "tooltip": { - "mode": "single", - "sort": "none" + "mode": "multi", + "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(increase(tomcat_servlet_processingtime_total{job=~\"$job\", instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_servlet_requestcount_total{job=~\"$job\", instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__interval:] offset -$__interval), 1)) by (job, instance)", + "expr": "sum(increase(tomcat_servlet_processingtime_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_servlet_requestcount_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__interval:] offset -$__interval), 1)) by (job, instance)", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{instance}} - total" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - total", + "refId": "Total servlet processing time" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "increase(tomcat_servlet_processingtime_total{job=~\"$job\", instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_servlet_requestcount_total{job=~\"$job\", instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__interval:] offset -$__interval), 1)", + "expr": "increase(tomcat_servlet_processingtime_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_servlet_requestcount_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", module=~\"$host$context\", servlet=~\"$servlet\"}[$__interval:] offset -$__interval), 1)", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{module}}{{servlet}}" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{module}}{{servlet}}", + "refId": "Servlet processing time" } ], "title": "Servlet processing time", "type": "timeseries" } ], - "refresh": "1m", - "rows": [ ], - "schemaVersion": 14, - "style": "dark", + "refresh": "30s", + "schemaVersion": 39, "tags": [ "apache-tomcat-mixin" ], "templating": { "list": [ { - "current": { }, - "hide": 0, - "label": "Data Source", + "label": "Prometheus data source", "name": "prometheus_datasource", - "options": [ ], "query": "prometheus", - "refresh": 1, - "regex": "", + "regex": "(?!grafanacloud-usage|grafanacloud-ml-metrics).+", "type": "datasource" }, { - "allValue": "", - "current": { }, + "allValue": ".+", "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "hide": 0, - "includeAll": false, + "includeAll": true, "label": "Job", - "multi": false, + "multi": true, "name": "job", - "options": [ ], - "query": "label_values(tomcat_bytesreceived_total, job)", - "refresh": 1, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "query": "label_values(tomcat_session_sessioncounter_total{job=\"integrations/tomcat\"}, job)", + "refresh": 2, + "sort": 1, + "type": "query" }, { "allValue": ".*", - "current": { }, "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "hide": 2, "includeAll": true, "label": "Cluster", "multi": true, "name": "cluster", - "options": [ ], - "query": "label_values(tomcat_bytesreceived_total{job=~\"$job\"}, cluster)", + "query": "label_values(tomcat_session_sessioncounter_total{job=\"integrations/tomcat\",job=~\"$job\"}, cluster)", "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "sort": 1, + "type": "query" }, { - "allValue": "", - "current": { }, + "allValue": ".+", "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "hide": 0, - "includeAll": false, + "includeAll": true, "label": "Instance", - "multi": false, + "multi": true, "name": "instance", - "options": [ ], - "query": "label_values(tomcat_bytesreceived_total{job=~\"$job\"}, instance)", - "refresh": 1, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "query": "label_values(tomcat_session_sessioncounter_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\"}, instance)", + "refresh": 2, + "sort": 1, + "type": "query" + }, + { + "hide": 2, + "label": "Loki data source", + "name": "loki_datasource", + "query": "loki", + "regex": "(?!grafanacloud.+usage-insights|grafanacloud.+alert-state-history).+", + "type": "datasource" }, { - "allValue": "", - "current": { }, "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "hide": 0, - "includeAll": true, - "label": "Host", "multi": true, "name": "host", - "options": [ ], - "query": "label_values(tomcat_session_sessioncounter_total{job=~\"$job\"}, host)", - "refresh": 1, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "query": "label_values(tomcat_session_sessioncounter_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}, host)", + "refresh": 2, + "type": "query" }, { - "allValue": "", - "current": { }, "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "hide": 0, - "includeAll": true, - "label": "Context", "multi": true, "name": "context", - "options": [ ], - "query": "label_values(tomcat_session_sessioncounter_total{job=~\"$job\", host=~\"$host\"}, context)", - "refresh": 1, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "query": "label_values(tomcat_session_sessioncounter_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}, context)", + "refresh": 2, + "type": "query" }, { - "allValue": "", - "current": { }, "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "hide": 0, - "includeAll": true, - "label": "Servlet", "multi": true, "name": "servlet", - "options": [ ], - "query": "label_values(tomcat_servlet_requestcount_total{job=~\"$job\", module=~\"$host$context\"}, servlet)", - "refresh": 1, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "query": "label_values(tomcat_servlet_requestcount_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}, servlet)", + "refresh": 2, + "type": "query" } ] }, "time": { - "from": "now-1h", + "from": "now-30m", "to": "now" }, - "timepicker": { - "refresh_intervals": [ - "5s", - "10s", - "30s", - "1m", - "5m", - "15m", - "30m", - "1h", - "2h", - "1d" - ], - "time_options": [ - "5m", - "15m", - "1h", - "6h", - "12h", - "24h", - "2d", - "7d", - "30d" - ] - }, "timezone": "default", "title": "Apache Tomcat hosts", - "uid": "apache-tomcat-hosts", - "version": 0 + "uid": "apachetomcat_hosts" } \ No newline at end of file diff --git a/apache-tomcat-mixin/dashboards_out/apache-tomcat-logs.json b/apache-tomcat-mixin/dashboards_out/apache-tomcat-logs.json new file mode 100644 index 000000000..9a997be9b --- /dev/null +++ b/apache-tomcat-mixin/dashboards_out/apache-tomcat-logs.json @@ -0,0 +1,321 @@ +{ + "annotations": { + "list": [ ] + }, + "editable": false, + "id": null, + "links": [ + { + "keepTime": true, + "title": "Apache Tomcat hosts", + "type": "link", + "url": "/d/apachetomcat_hosts" + }, + { + "keepTime": true, + "title": "Apache Tomcat overview", + "type": "link", + "url": "/d/apachetomcat_overview" + }, + { + "asDropdown": true, + "includeVars": true, + "keepTime": true, + "tags": [ + "apache-tomcat-mixin" + ], + "title": "All dashboards", + "type": "dashboards" + } + ], + "panels": [ + { + "datasource": { + "type": "loki", + "uid": "${loki_datasource}" + }, + "description": "Logs volume grouped by \"level\" label.", + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "bars", + "fillOpacity": 50, + "stacking": { + "mode": "normal" + } + }, + "unit": "none" + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "(E|e)merg|(F|f)atal|(A|a)lert|(C|c)rit.*" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "purple", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "(E|e)(rr.*|RR.*)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "(W|w)(arn.*|ARN.*|rn|RN)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "orange", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "(N|n)(otice|ote)|(I|i)(nf.*|NF.*)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "dbg.*|DBG.*|(D|d)(EBUG|ebug)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "(T|t)(race|RACE)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "light-blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "logs" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "text", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 1, + "maxDataPoints": 100, + "options": { + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "pluginVersion": "v11.0.0", + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "${loki_datasource}" + }, + "expr": "sum by (level) (count_over_time({job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",level=~\"$level\"}\n|~ \"$regex_search\"\n\n[$__auto]))\n", + "legendFormat": "{{ level }}" + } + ], + "title": "Logs volume", + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "Value", + "renamePattern": "logs" + } + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "datasource", + "uid": "-- Mixed --" + }, + "gridPos": { + "h": 18, + "w": 24, + "x": 0, + "y": 18 + }, + "id": 2, + "options": { + "dedupStrategy": "exact", + "enableLogDetails": true, + "prettifyLogMessage": true, + "showTime": false, + "wrapLogMessage": false + }, + "pluginVersion": "v11.0.0", + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "${loki_datasource}" + }, + "expr": "{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",level=~\"$level\"} \n|~ \"$regex_search\"\n\n\n" + } + ], + "title": "Logs", + "type": "logs" + } + ], + "refresh": "30s", + "schemaVersion": 39, + "tags": [ + "apache-tomcat-mixin" + ], + "templating": { + "list": [ + { + "label": "Loki data source", + "name": "loki_datasource", + "query": "loki", + "regex": "(?!grafanacloud.+usage-insights|grafanacloud.+alert-state-history).+", + "type": "datasource" + }, + { + "allValue": ".*", + "datasource": { + "type": "loki", + "uid": "${loki_datasource}" + }, + "includeAll": true, + "label": "Job", + "multi": true, + "name": "job", + "query": "label_values({job=\"integrations/tomcat\"}, job)", + "refresh": 2, + "sort": 1, + "type": "query" + }, + { + "allValue": ".*", + "datasource": { + "type": "loki", + "uid": "${loki_datasource}" + }, + "includeAll": true, + "label": "Cluster", + "multi": true, + "name": "cluster", + "query": "label_values({job=\"integrations/tomcat\",job=~\"$job\"}, cluster)", + "refresh": 2, + "sort": 1, + "type": "query" + }, + { + "allValue": ".*", + "datasource": { + "type": "loki", + "uid": "${loki_datasource}" + }, + "includeAll": true, + "label": "Level", + "multi": true, + "name": "level", + "query": "label_values({job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\"}, level)", + "refresh": 2, + "sort": 1, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "", + "value": "" + }, + "label": "Regex search", + "name": "regex_search", + "options": [ + { + "selected": true, + "text": "", + "value": "" + } + ], + "query": "", + "type": "textbox" + }, + { + "hide": 2, + "label": "Prometheus data source", + "name": "prometheus_datasource", + "query": "prometheus", + "regex": "(?!grafanacloud-usage|grafanacloud-ml-metrics).+", + "type": "datasource" + } + ] + }, + "time": { + "from": "now-30m", + "to": "now" + }, + "timezone": "default", + "title": "Apache Tomcat logs", + "uid": "apachetomcat-logs" + } \ No newline at end of file diff --git a/apache-tomcat-mixin/dashboards_out/apache-tomcat-overview.json b/apache-tomcat-mixin/dashboards_out/apache-tomcat-overview.json index 59c472ca6..d65c23fd7 100644 --- a/apache-tomcat-mixin/dashboards_out/apache-tomcat-overview.json +++ b/apache-tomcat-mixin/dashboards_out/apache-tomcat-overview.json @@ -1,120 +1,777 @@ { - "__inputs": [ ], - "__requires": [ ], "annotations": { "list": [ ] }, - "description": "", "editable": false, - "gnetId": null, - "graphTooltip": 0, - "hideControls": false, "id": null, "links": [ { - "asDropdown": false, - "icon": "external link", + "keepTime": true, + "title": "Apache Tomcat hosts", + "type": "link", + "url": "/d/apachetomcat_hosts" + }, + { + "keepTime": true, + "title": "Apache Tomcat logs", + "type": "link", + "url": "/d/apachetomcat-logs" + }, + { + "asDropdown": true, "includeVars": true, "keepTime": true, "tags": [ "apache-tomcat-mixin" ], - "targetBlank": false, - "title": "Other Apache Tomcat dashboards", - "type": "dashboards", - "url": "" + "title": "All dashboards", + "type": "dashboards" } ], "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 0, + "x": 0, + "y": 0 + }, + "id": 1, + "panels": [ ], + "title": "Overview", + "type": "row" + }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "description": "The memory usage of the JVM of the instance", + "description": "The number of Apache Tomcat clusters.", "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" + "fixedColor": "text", + "mode": "fixed" }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false + "unit": "none" + } + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 0, + "y": 1 + }, + "id": 2, + "options": { + "colorMode": "fixed", + "graphMode": "none", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ] + } + }, + "pluginVersion": "v11.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "expr": "count(count by (cluster) (jvm_memory_usage_used_bytes{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}))", + "format": "time_series", + "instant": false, + "legendFormat": "{{instance}}: Clusters", + "refId": "Number of clusters" + } + ], + "title": "Number of clusters", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "description": "The number of Apache Tomcat nodes.", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "text", + "mode": "fixed" + }, + "unit": "none" + } + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 4, + "y": 1 + }, + "id": 3, + "options": { + "colorMode": "fixed", + "graphMode": "none", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ] + } + }, + "pluginVersion": "v11.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "expr": "count(count by (instance) (jvm_memory_usage_used_bytes{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}))", + "format": "time_series", + "instant": false, + "legendFormat": "{{instance}}: Nodes", + "refId": "Number of nodes" + } + ], + "title": "Number of nodes", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "description": "The CPU usage of the JVM of the instance.", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "text", + "mode": "continuous-BlYlRd" + }, + "decimals": 1, + "max": 100, + "min": 0, + "unit": "percent" + } + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 8, + "y": 1 + }, + "id": 4, + "options": { + "colorMode": "value", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ] + } + }, + "pluginVersion": "v11.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "expr": "jvm_process_cpu_load{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"} * 100", + "format": "time_series", + "instant": false, + "legendFormat": "{{ instance }}", + "refId": "CPU usage" + } + ], + "title": "CPU usage", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "description": "The memory utilization of the JVM of the instance.", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "text", + "mode": "continuous-BlYlRd" + }, + "decimals": 1, + "max": 100, + "min": 0, + "unit": "percent" + } + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 12, + "y": 1 + }, + "id": 5, + "options": { + "colorMode": "value", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ] + } + }, + "pluginVersion": "v11.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "expr": "sum(jvm_memory_usage_used_bytes{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}) by (job, instance) / clamp_min(jvm_physical_memory_bytes{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}, 1) * 100", + "format": "time_series", + "instant": false, + "legendFormat": "{{instance}}: Memory utilization", + "refId": "Memory utilization" + } + ], + "title": "Memory utilization", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "description": "The network sent for an Apache Tomcat instance.", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "text", + "mode": "fixed" + }, + "unit": "Bps" + } + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 16, + "y": 1 + }, + "id": 6, + "options": { + "colorMode": "fixed", + "graphMode": "none", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ] + } + }, + "pluginVersion": "v11.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "expr": "rate(tomcat_bytessent_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])", + "format": "time_series", + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{protocol}} - {{port}}", + "refId": "Traffic sent rate" + } + ], + "title": "Network sent", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "description": "The network received for an Apache Tomcat instance.", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "text", + "mode": "fixed" + }, + "unit": "Bps" + } + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 20, + "y": 1 + }, + "id": 7, + "options": { + "colorMode": "fixed", + "graphMode": "none", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ] + } + }, + "pluginVersion": "v11.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "expr": "rate(tomcat_bytesreceived_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])", + "format": "time_series", + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{protocol}} - {{port}}", + "refId": "Traffic received rate" + } + ], + "title": "Network received", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "description": "Overview of Apache Tomcat instances with key metrics.", + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Instance" }, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" + "properties": [ + { + "id": "custom.filterable", + "value": true + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Cluster" }, - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" + "properties": [ + { + "id": "custom.displayMode", + "value": "basic" + }, + { + "id": "custom.filterable", + "value": true + }, + { + "id": "custom.noValue", + "value": "NA" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "CPU usage" }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" + "properties": [ + { + "id": "custom.displayMode", + "value": "basic" + }, + { + "id": "color", + "value": { + "mode": "continuous-BlYlRd" + } + }, + { + "id": "custom.fillOpacity", + "value": 30 + }, + { + "id": "custom.gradientMode", + "value": "scheme" + }, + { + "id": "custom.lineInterpolation", + "value": "smooth" + }, + { + "id": "custom.lineWidth", + "value": 2 + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "decimals", + "value": 1 + }, + { + "id": "max", + "value": 100 + }, + { + "id": "min", + "value": 0 + }, + { + "id": "unit", + "value": "percent" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Traffic sent rate" }, - "thresholdsStyle": { - "mode": "off" - } + "properties": [ + { + "id": "custom.displayMode", + "value": "basic" + }, + { + "id": "custom.fillOpacity", + "value": 30 + }, + { + "id": "custom.gradientMode", + "value": "opacity" + }, + { + "id": "custom.lineInterpolation", + "value": "smooth" + }, + { + "id": "custom.lineWidth", + "value": 2 + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "decimals", + "value": 1 + }, + { + "id": "noValue", + "value": "No traffic" + }, + { + "id": "unit", + "value": "bps" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Traffic received rate" + }, + "properties": [ + { + "id": "custom.displayMode", + "value": "basic" + }, + { + "id": "custom.fillOpacity", + "value": 30 + }, + { + "id": "custom.gradientMode", + "value": "opacity" + }, + { + "id": "custom.lineInterpolation", + "value": "smooth" + }, + { + "id": "custom.lineWidth", + "value": 2 + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "decimals", + "value": 1 + }, + { + "id": "noValue", + "value": "No traffic" + }, + { + "id": "unit", + "value": "bps" + } + ] }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ + { + "matcher": { + "id": "byName", + "options": "Memory utilization" + }, + "properties": [ + { + "id": "custom.displayMode", + "value": "basic" + }, + { + "id": "color", + "value": { + "mode": "continuous-BlYlRd" + } + }, { - "color": "green", - "value": null + "id": "custom.fillOpacity", + "value": 30 }, { - "color": "red", - "value": 80 + "id": "custom.gradientMode", + "value": "scheme" + }, + { + "id": "custom.lineInterpolation", + "value": "smooth" + }, + { + "id": "custom.lineWidth", + "value": 2 + }, + { + "id": "custom.showPoints", + "value": "never" + }, + { + "id": "decimals", + "value": 1 + }, + { + "id": "max", + "value": 100 + }, + { + "id": "min", + "value": 0 + }, + { + "id": "unit", + "value": "percent" } ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 9 + }, + "id": 8, + "options": { + "enablePagination": true + }, + "pluginVersion": "v11.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "expr": "jvm_process_cpu_load{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"} * 100", + "format": "table", + "instant": true, + "legendFormat": "{{ instance }}", + "refId": "cpu_usage" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "expr": "sum(jvm_memory_usage_used_bytes{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}) by (job, instance) / clamp_min(jvm_physical_memory_bytes{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}, 1) * 100", + "format": "table", + "instant": true, + "legendFormat": "{{instance}}: Memory utilization", + "refId": "memory_utilization" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" }, + "expr": "rate(tomcat_bytessent_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])", + "format": "table", + "instant": true, + "interval": "2m", + "legendFormat": "{{ instance }} - {{protocol}} - {{port}}", + "refId": "traffic_sent_rate" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "expr": "rate(tomcat_bytesreceived_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])", + "format": "table", + "instant": true, + "interval": "2m", + "legendFormat": "{{ instance }} - {{protocol}} - {{port}}", + "refId": "traffic_received_rate" + } + ], + "title": "Instances", + "transformations": [ + { + "id": "joinByField", + "options": { + "byField": "instance", + "mode": "outer" + } + }, + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "instance", + "job 1", + "cluster", + "Value #cpu_usage", + "Value #memory_utilization", + "Value #traffic_sent_rate", + "Value #traffic_received_rate" + ] + } + } + }, + { + "id": "organize", + "options": { + "includeByName": { + "Value #cpu_usage": { }, + "Value #memory_utilization": { }, + "Value #traffic_received_rate": { }, + "Value #traffic_sent_rate": { }, + "cluster": { }, + "instance": { }, + "job 1": { } + }, + "indexByName": { + "Value #cpu_usage": 3, + "Value #memory_utilization": 4, + "Value #traffic_received_rate": 6, + "Value #traffic_sent_rate": 5, + "cluster": 2, + "instance": 0, + "job 1": 1 + }, + "renameByName": { + "Value #cpu_usage": "CPU usage", + "Value #memory_utilization": "Memory utilization", + "Value #traffic_received_rate": "Traffic received rate", + "Value #traffic_sent_rate": "Traffic sent rate", + "cluster": "Cluster", + "instance": "Instance", + "job 1": "Job" + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "description": "The memory usage of the JVM of the instance.", + "fieldConfig": { + "defaults": { + "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" + }, + "min": 0, "unit": "bytes" }, - "overrides": [ ] + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": ".*(T|t)otal.*" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "light-orange", + "mode": "fixed" + } + }, + { + "id": "custom.fillOpacity", + "value": 0 + }, + { + "id": "custom.lineStyle", + "value": { + "dash": [ + 10, + 10 + ], + "fill": "dash" + } + } + ] + } + ] }, "gridPos": { - "h": 6, + "h": 8, "w": 12, "x": 0, - "y": 0 + "y": 17 }, - "id": 2, + "id": 9, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "displayMode": "list" }, "tooltip": { - "mode": "single", - "sort": "none" + "mode": "multi", + "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "jvm_memory_usage_used_bytes{job=~\"$job\", instance=~\"$instance\"}", + "expr": "jvm_memory_usage_used_bytes{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{area}}" + "instant": false, + "legendFormat": "{{ instance }} - {{area}}", + "refId": "Memory usage" } ], "title": "Memory usage", @@ -122,90 +779,57 @@ }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "description": "The CPU usage of the JVM process", + "description": "The CPU usage of the JVM process.", "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" + "mode": "continuous-BlYlRd" }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "line" - } + "fillOpacity": 30, + "gradientMode": "scheme", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [ ] + "decimals": 1, + "max": 100, + "min": 0, + "unit": "percent" + } }, "gridPos": { - "h": 6, + "h": 8, "w": 12, "x": 12, - "y": 0 + "y": 17 }, - "id": 3, + "id": 10, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "displayMode": "list" }, "tooltip": { - "mode": "single", - "sort": "none" + "mode": "multi", + "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "jvm_process_cpu_load{job=~\"$job\", instance=~\"$instance\"}", + "expr": "jvm_process_cpu_load{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"} * 100", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}}" + "instant": false, + "legendFormat": "{{ instance }}", + "refId": "CPU usage" } ], "title": "CPU usage", @@ -213,99 +837,68 @@ }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "description": "The sent traffic for a Tomcat connector", + "description": "The traffic sent for a Tomcat connector.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] + "fillOpacity": 30, + "gradientMode": "opacity", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" }, - "unit": "Bps" - }, - "overrides": [ ] + "decimals": 1, + "noValue": "No traffic", + "unit": "bps" + } }, "gridPos": { - "h": 6, + "h": 8, "w": 12, "x": 0, - "y": 6 + "y": 25 }, - "id": 4, + "id": 11, "options": { "legend": { + "asTable": true, "calcs": [ ], "displayMode": "list", - "placement": "bottom", - "showLegend": true + "placement": "right" }, "tooltip": { - "mode": "single", - "sort": "none" + "mode": "multi", + "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(rate(tomcat_bytessent_total{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])) by (job, instance)", + "expr": "sum(rate(tomcat_bytessent_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])) by (job, instance)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - total" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - total", + "refId": "Traffic sent total" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(tomcat_bytessent_total{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])", + "expr": "rate(tomcat_bytessent_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{protocol}}-{{port}}" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{protocol}} - {{port}}", + "refId": "Traffic sent rate" } ], "title": "Traffic sent", @@ -313,99 +906,68 @@ }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "description": "The received traffic for a Tomcat connector", + "description": "The traffic received for a Tomcat connector.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] + "fillOpacity": 30, + "gradientMode": "opacity", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" }, - "unit": "Bps" - }, - "overrides": [ ] + "decimals": 1, + "noValue": "No traffic", + "unit": "bps" + } }, "gridPos": { - "h": 6, + "h": 8, "w": 12, "x": 12, - "y": 6 + "y": 25 }, - "id": 5, + "id": 12, "options": { "legend": { + "asTable": true, "calcs": [ ], "displayMode": "list", - "placement": "bottom", - "showLegend": true + "placement": "right" }, "tooltip": { - "mode": "single", - "sort": "none" + "mode": "multi", + "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(rate(tomcat_bytesreceived_total{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])) by (job, instance)", + "expr": "sum(rate(tomcat_bytesreceived_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])) by (job, instance)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - total" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - total", + "refId": "Traffic received total" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(tomcat_bytesreceived_total{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])", + "expr": "rate(tomcat_bytesreceived_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{protocol}}-{{port}}" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{protocol}} - {{port}}", + "refId": "Traffic received rate" } ], "title": "Traffic received", @@ -413,117 +975,90 @@ }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "description": "The total requests and errors for a Tomcat connector", + "description": "The total requests and errors for a Tomcat connector.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] + "fillOpacity": 30, + "gradientMode": "opacity", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" }, "unit": "r/s" - }, - "overrides": [ ] + } }, "gridPos": { - "h": 6, + "h": 8, "w": 12, "x": 0, - "y": 12 + "y": 33 }, - "id": 6, + "id": 13, "options": { "legend": { + "asTable": true, "calcs": [ ], "displayMode": "list", - "placement": "bottom", - "showLegend": true + "placement": "right" }, "tooltip": { - "mode": "single", - "sort": "none" + "mode": "multi", + "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(rate(tomcat_requestcount_total{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])) by (job, instance)", + "expr": "sum(rate(tomcat_requestcount_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])) by (job, instance)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - total requests" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - total requests", + "refId": "Requests total" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(rate(tomcat_errorcount_total{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])) by (job, instance)", + "expr": "rate(tomcat_requestcount_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - total errors" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{protocol}} - {{port}} - requests", + "refId": "Requests rate" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(tomcat_requestcount_total{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])", + "expr": "sum(rate(tomcat_errorcount_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])) by (job, instance)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{protocol}}-{{port}} - requests" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - total errors", + "refId": "Requests errors" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(tomcat_errorcount_total{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])", + "expr": "rate(tomcat_errorcount_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__rate_interval])", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{protocol}}-{{port}} - errors" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{protocol}} - {{port}} - errors", + "refId": "Requests errors rate" } ], "title": "Requests", @@ -531,102 +1066,66 @@ }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "description": "The average time taken to process recent requests for a Tomcat connector", + "description": "The average time taken to process recent requests for a Tomcat connector.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "axisSoftMin": 0, - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "line" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 300 - } - ] + "fillOpacity": 30, + "gradientMode": "opacity", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" }, "unit": "ms" - }, - "overrides": [ ] + } }, "gridPos": { - "h": 6, + "h": 8, "w": 12, "x": 12, - "y": 12 + "y": 33 }, - "id": 7, + "id": 14, "options": { "legend": { + "asTable": true, "calcs": [ ], "displayMode": "list", - "placement": "bottom", - "showLegend": true + "placement": "right" }, "tooltip": { - "mode": "single", - "sort": "none" + "mode": "multi", + "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(increase(tomcat_processingtime_total{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_requestcount_total{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__interval:] offset -$__interval), 1)) by (job, instance)", + "expr": "sum(increase(tomcat_processingtime_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_requestcount_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__interval:] offset -$__interval), 1)) by (job, instance)", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{instance}} - total" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - total", + "refId": "Processing time total" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "increase(tomcat_processingtime_total{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_requestcount_total{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__interval:] offset -$__interval), 1)", + "expr": "increase(tomcat_processingtime_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_requestcount_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}[$__interval:] offset -$__interval), 1)", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{protocol}}-{{port}}" + "instant": false, + "interval": "2m", + "legendFormat": "{{ instance }} - {{protocol}} - {{port}}", + "refId": "Processing time rate" } ], "title": "Processing time", @@ -634,368 +1133,231 @@ }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "description": "The number of various threads being used by a Tomcat connector", + "description": "The number of various threads used by a Tomcat connector.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] + "fillOpacity": 30, + "gradientMode": "opacity", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" } - }, - "overrides": [ ] + } }, "gridPos": { - "h": 6, + "h": 8, "w": 24, "x": 0, - "y": 18 + "y": 41 }, - "id": 8, + "id": 15, "options": { "legend": { + "asTable": true, "calcs": [ ], "displayMode": "list", - "placement": "right", - "showLegend": true + "placement": "right" }, "tooltip": { - "mode": "single", - "sort": "none" + "mode": "multi", + "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(tomcat_threadpool_connectioncount{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}) by (job, instance)", + "expr": "sum(tomcat_threadpool_connectioncount{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}) by (job, instance)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - total connections" + "instant": false, + "legendFormat": "{{ instance }} - total connections", + "refId": "Total connection threads" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(tomcat_threadpool_pollerthreadcount{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}) by (job, instance)", + "expr": "sum(tomcat_threadpool_pollerthreadcount{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}) by (job, instance)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - poller total" + "instant": false, + "legendFormat": "{{ instance }} - poller total", + "refId": "Total poller threads" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(tomcat_threadpool_keepalivecount{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}) by (job, instance)", + "expr": "sum(tomcat_threadpool_keepalivecount{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}) by (job, instance)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - idle total" + "instant": false, + "legendFormat": "{{ instance }} - idle total", + "refId": "Total idle threads" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "sum(tomcat_threadpool_currentthreadcount{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}) by (job, instance)", + "expr": "sum(tomcat_threadpool_currentthreadcount{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}) by (job, instance)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - active total" + "instant": false, + "legendFormat": "{{ instance }} - active total", + "refId": "Total active threads" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "tomcat_threadpool_connectioncount{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}", + "expr": "tomcat_threadpool_connectioncount{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{protocol}}-{{port}} - connections" + "instant": false, + "legendFormat": "{{ instance }} - {{protocol}} - {{port}} - connections", + "refId": "Connection threads" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "tomcat_threadpool_pollerthreadcount{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}", + "expr": "tomcat_threadpool_pollerthreadcount{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{protocol}}-{{port}} - poller" + "instant": false, + "legendFormat": "{{ instance }} - {{protocol}} - {{port}} - poller", + "refId": "Poller threads" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "tomcat_threadpool_keepalivecount{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}", + "expr": "tomcat_threadpool_keepalivecount{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{protocol}}-{{port}} - idle" + "instant": false, + "legendFormat": "{{ instance }} - {{protocol}} - {{port}} - idle", + "refId": "Idle threads" }, { "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "tomcat_threadpool_currentthreadcount{job=~\"$job\", instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}", + "expr": "tomcat_threadpool_currentthreadcount{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\", protocol=~\"$protocol\", port=~\"$port\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - {{protocol}}-{{port}} - active" + "instant": false, + "legendFormat": "{{ instance }} - {{protocol}} - {{port}} - active", + "refId": "Active threads" } ], "title": "Threads", "type": "timeseries" - }, - { - "datasource": { - "uid": "${loki_datasource}" - }, - "description": "Recent logs from the Catalina.out logs file\n", - "gridPos": { - "h": 6, - "w": 24, - "x": 0, - "y": 24 - }, - "id": 9, - "options": { - "dedupStrategy": "none", - "enableLogDetails": true, - "prettifyLogMessage": false, - "showCommonLabels": false, - "showLabels": false, - "showTime": false, - "sortOrder": "Descending", - "wrapLogMessage": false - }, - "targets": [ - { - "datasource": { - "uid": "${loki_datasource}" - }, - "editorMode": "code", - "expr": "{job=~\"$job\", instance=~\"$instance\"} |= `` | (filename=~\"/var/log/tomcat.*/catalina.out|/opt/tomcat/logs/catalina.out|/Program Files/Apache Software Foundation/Tomcat .*..*/logs/catalina.out\" or log_type=\"catalina.out\")", - "queryType": "range", - "refId": "A" - } - ], - "title": "Logs", - "type": "logs" } ], - "refresh": "1m", - "rows": [ ], - "schemaVersion": 14, - "style": "dark", + "refresh": "30s", + "schemaVersion": 39, "tags": [ "apache-tomcat-mixin" ], "templating": { "list": [ { - "current": { }, - "hide": 0, - "label": "Data Source", + "label": "Prometheus data source", "name": "prometheus_datasource", - "options": [ ], "query": "prometheus", - "refresh": 1, - "regex": "", - "type": "datasource" - }, - { - "current": { }, - "hide": 0, - "label": "Loki Datasource", - "name": "loki_datasource", - "options": [ ], - "query": "loki", - "refresh": 1, - "regex": "", + "regex": "(?!grafanacloud-usage|grafanacloud-ml-metrics).+", "type": "datasource" }, { - "allValue": "", - "current": { }, + "allValue": ".+", "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "hide": 0, - "includeAll": false, + "includeAll": true, "label": "Job", - "multi": false, + "multi": true, "name": "job", - "options": [ ], - "query": "label_values(tomcat_bytesreceived_total, job)", - "refresh": 1, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "query": "label_values(tomcat_session_sessioncounter_total{job=\"integrations/tomcat\"}, job)", + "refresh": 2, + "sort": 1, + "type": "query" }, { "allValue": ".*", - "current": { }, "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "hide": 2, "includeAll": true, "label": "Cluster", "multi": true, "name": "cluster", - "options": [ ], - "query": "label_values(tomcat_bytesreceived_total{job=~\"$job\"}, cluster)", + "query": "label_values(tomcat_session_sessioncounter_total{job=\"integrations/tomcat\",job=~\"$job\"}, cluster)", "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "sort": 1, + "type": "query" }, { "allValue": ".+", - "current": { }, "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "hide": 0, "includeAll": true, "label": "Instance", "multi": true, "name": "instance", - "options": [ ], - "query": "label_values(tomcat_bytesreceived_total{job=~\"$job\"}, instance)", + "query": "label_values(tomcat_session_sessioncounter_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\"}, instance)", "refresh": 2, - "regex": "", "sort": 1, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "type": "query" + }, + { + "hide": 2, + "label": "Loki data source", + "name": "loki_datasource", + "query": "loki", + "regex": "(?!grafanacloud.+usage-insights|grafanacloud.+alert-state-history).+", + "type": "datasource" }, { - "allValue": ".+", - "current": { }, "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "hide": 0, - "includeAll": true, - "label": "Protocol", "multi": true, "name": "protocol", - "options": [ ], - "query": "label_values(tomcat_bytesreceived_total{job=~\"$job\"}, protocol)", - "refresh": 1, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "query": "label_values(tomcat_bytesreceived_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}, protocol)", + "refresh": 2, + "type": "query" }, { - "allValue": ".+", - "current": { }, "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "hide": 0, - "includeAll": true, - "label": "Port", "multi": true, "name": "port", - "options": [ ], - "query": "label_values(tomcat_bytesreceived_total{job=~\"$job\"}, port)", - "refresh": 1, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "query": "label_values(tomcat_bytesreceived_total{job=\"integrations/tomcat\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}, port)", + "refresh": 2, + "type": "query" } ] }, "time": { - "from": "now-1h", + "from": "now-30m", "to": "now" }, - "timepicker": { - "refresh_intervals": [ - "5s", - "10s", - "30s", - "1m", - "5m", - "15m", - "30m", - "1h", - "2h", - "1d" - ], - "time_options": [ - "5m", - "15m", - "1h", - "6h", - "12h", - "24h", - "2d", - "7d", - "30d" - ] - }, "timezone": "default", "title": "Apache Tomcat overview", - "uid": "apache-tomcat-overview", - "version": 0 + "uid": "apachetomcat_overview" } \ No newline at end of file diff --git a/apache-tomcat-mixin/g.libsonnet b/apache-tomcat-mixin/g.libsonnet new file mode 100644 index 000000000..e6a2060ee --- /dev/null +++ b/apache-tomcat-mixin/g.libsonnet @@ -0,0 +1 @@ +import 'github.com/grafana/grafonnet/gen/grafonnet-v11.4.0/main.libsonnet' diff --git a/apache-tomcat-mixin/jsonnetfile.json b/apache-tomcat-mixin/jsonnetfile.json index 65cebf84b..a5c199b4f 100644 --- a/apache-tomcat-mixin/jsonnetfile.json +++ b/apache-tomcat-mixin/jsonnetfile.json @@ -9,6 +9,33 @@ } }, "version": "master" + }, + { + "source": { + "git": { + "remote": "https://github.com/grafana/jsonnet-libs.git", + "subdir": "common-lib" + } + }, + "version": "master" + }, + { + "source": { + "git": { + "remote": "https://github.com/grafana/jsonnet-libs.git", + "subdir": "grafana-cloud-integration-utils" + } + }, + "version": "master" + }, + { + "source": { + "git": { + "remote": "https://github.com/grafana/jsonnet-libs.git", + "subdir": "logs-lib" + } + }, + "version": "master" } ], "legacyImports": true diff --git a/apache-tomcat-mixin/links.libsonnet b/apache-tomcat-mixin/links.libsonnet new file mode 100644 index 000000000..fda9229b4 --- /dev/null +++ b/apache-tomcat-mixin/links.libsonnet @@ -0,0 +1,24 @@ +local g = import './g.libsonnet'; + +{ + local link = g.dashboard.link, + + new(this): + { + apacheTomcatOverview: link.link.new(this.config.dashboardNamePrefix + ' overview', '/d/' + this.grafana.dashboards['apache-tomcat-overview.json'].uid) + + link.link.options.withKeepTime(true), + + apacheTomcatHosts: link.link.new(this.config.dashboardNamePrefix + ' hosts', '/d/' + this.grafana.dashboards['apache-tomcat-hosts.json'].uid) + + link.link.options.withKeepTime(true), + + otherDashboards: link.dashboards.new('All dashboards', this.config.dashboardTags) + + link.dashboards.options.withIncludeVars(true) + + link.dashboards.options.withKeepTime(true) + + link.dashboards.options.withAsDropdown(true), + + + } + if this.config.enableLokiLogs then { + apacheTomcatLogs: link.link.new(this.config.dashboardNamePrefix + ' logs', '/d/' + this.grafana.dashboards['apache-tomcat-logs.json'].uid) + + link.link.options.withKeepTime(true), + }, +} diff --git a/apache-tomcat-mixin/main.libsonnet b/apache-tomcat-mixin/main.libsonnet new file mode 100644 index 000000000..83dcab972 --- /dev/null +++ b/apache-tomcat-mixin/main.libsonnet @@ -0,0 +1,48 @@ +local alerts = import './alerts.libsonnet'; +local config = import './config.libsonnet'; +local dashboards = import './dashboards.libsonnet'; +local links = import './links.libsonnet'; +local panels = import './panels.libsonnet'; +local rows = import './rows.libsonnet'; +local commonlib = import 'common-lib/common/main.libsonnet'; + +{ + withConfigMixin(config): { + config+: config, + }, + + new(): { + local this = self, + config: config, + signals: + { + [sig]: commonlib.signals.unmarshallJsonMulti( + this.config.signals[sig], + type=this.config.metricsSource + ) + for sig in std.objectFields(this.config.signals) + }, + + + grafana: { + variables: commonlib.variables.new( + filteringSelector=this.config.filteringSelector, + groupLabels=this.config.groupLabels, + instanceLabels=this.config.instanceLabels, + varMetric='tomcat_session_sessioncounter_total', + customAllValue='.+', + enableLokiLogs=this.config.enableLokiLogs, + ), + annotations: {}, + links: links.new(this), + panels: panels.new(this), + dashboards: dashboards.new(this), + rows: rows.new(this), + }, + + prometheus: { + alerts: alerts.new(this), + recordingRules: {}, + }, + }, +} diff --git a/apache-tomcat-mixin/mixin.libsonnet b/apache-tomcat-mixin/mixin.libsonnet index 4d987cf31..8444f3c60 100644 --- a/apache-tomcat-mixin/mixin.libsonnet +++ b/apache-tomcat-mixin/mixin.libsonnet @@ -1,3 +1,30 @@ -(import 'dashboards/dashboards.libsonnet') + -(import 'alerts/alerts.libsonnet') + -(import 'config.libsonnet') +local tomcatLib = import './main.libsonnet'; +local config = (import './config.libsonnet'); +local util = import 'grafana-cloud-integration-utils/util.libsonnet'; + +local mixin = + tomcatLib.new() + + tomcatLib.withConfigMixin({ + filteringSelector: config.filteringSelector, + uid: config.uid, + enableLokiLogs: config.enableLokiLogs, + }); + +local labels_patch = { + cluster+: { + allValue: '.*', + }, +}; + +{ + grafanaDashboards+:: { + local tags = config.dashboardTags, + [fname]: + local dashboard = util.decorate_dashboard(mixin.grafana.dashboards[fname], tags=tags); + dashboard + util.patch_variables(dashboard, labels_patch) + + for fname in std.objectFields(mixin.grafana.dashboards) + }, + prometheusAlerts+:: mixin.prometheus.alerts, + prometheusRules+:: mixin.prometheus.recordingRules, +} diff --git a/apache-tomcat-mixin/panels.libsonnet b/apache-tomcat-mixin/panels.libsonnet new file mode 100644 index 000000000..c0099e703 --- /dev/null +++ b/apache-tomcat-mixin/panels.libsonnet @@ -0,0 +1,318 @@ +local g = import './g.libsonnet'; +local commonlib = import 'common-lib/common/main.libsonnet'; + +{ + new(this):: + { + local signals = this.signals, + + // Overview Panels + + overviewNumberOfClustersPanel: + commonlib.panels.generic.stat.info.new( + 'Number of clusters', + targets=[signals.overview.numberOfClusters.asTarget()] + ) + + g.panel.stat.standardOptions.withUnit('none') + + g.panel.stat.panelOptions.withDescription('The number of Apache Tomcat clusters.'), + + overviewNumberOfNodesPanel: + commonlib.panels.generic.stat.info.new( + 'Number of nodes', + targets=[signals.overview.numberOfNodes.asTarget()] + ) + + g.panel.stat.standardOptions.withUnit('none') + + g.panel.stat.panelOptions.withDescription('The number of Apache Tomcat nodes.'), + + overviewCPUUsageStatPanel: + commonlib.panels.cpu.stat.usage.new( + 'CPU usage', + targets=[signals.overview.cpuUsage.asTarget()] + ) + + g.panel.stat.panelOptions.withDescription('The CPU usage of the JVM of the instance.'), + + overviewMemoryUtilizationStatPanel: + commonlib.panels.memory.stat.usage.new( + 'Memory utilization', + targets=[signals.overview.memoryUtilization.asTarget()] + ) + + g.panel.stat.panelOptions.withDescription('The memory utilization of the JVM of the instance.'), + + overviewNetworkSentStatPanel: + commonlib.panels.generic.stat.info.new( + 'Network sent', + targets=[signals.overview.trafficSentRate.asTarget() { interval: '2m' }] + ) + + g.panel.stat.standardOptions.withUnit('Bps') + + g.panel.stat.panelOptions.withDescription('The network sent for an Apache Tomcat instance.'), + + overviewNetworkReceivedStatPanel: + commonlib.panels.generic.stat.info.new( + 'Network received', + targets=[signals.overview.trafficReceivedRate.asTarget() { interval: '2m' }] + ) + + g.panel.stat.standardOptions.withUnit('Bps') + + g.panel.stat.panelOptions.withDescription('The network received for an Apache Tomcat instance.'), + + overviewInstancesTablePanel: + commonlib.panels.generic.table.base.new( + 'Instances', + targets=[ + signals.overview.cpuUsage.asTableTarget() + + g.query.prometheus.withInstant(true) + + g.query.prometheus.withRefId('cpu_usage'), + signals.overview.memoryUtilization.asTableTarget() + + g.query.prometheus.withInstant(true) + + g.query.prometheus.withRefId('memory_utilization'), + signals.overview.trafficSentRate.asTableTarget() { interval: '2m' } + + g.query.prometheus.withInstant(true) + + g.query.prometheus.withRefId('traffic_sent_rate'), + signals.overview.trafficReceivedRate.asTableTarget() { interval: '2m' } + + g.query.prometheus.withInstant(true) + + g.query.prometheus.withRefId('traffic_received_rate'), + ], + ) + { + options+: { + enablePagination: true, + }, + } + + g.panel.table.panelOptions.withDescription('Overview of Apache Tomcat instances with key metrics.') + + g.panel.table.queryOptions.withTransformationsMixin([ + { + id: 'joinByField', + options: { + byField: 'instance', + mode: 'outer', + }, + }, + { + id: 'filterFieldsByName', + options: { + include: { + names: [ + 'instance', + 'job 1', + 'cluster', + 'Value #cpu_usage', + 'Value #memory_utilization', + 'Value #traffic_sent_rate', + 'Value #traffic_received_rate', + ], + }, + }, + }, + { + id: 'organize', + options: { + includeByName: { + instance: {}, + 'job 1': {}, + cluster: {}, + 'Value #cpu_usage': {}, + 'Value #memory_utilization': {}, + 'Value #traffic_sent_rate': {}, + 'Value #traffic_received_rate': {}, + }, + indexByName: { + instance: 0, + 'job 1': 1, + cluster: 2, + 'Value #cpu_usage': 3, + 'Value #memory_utilization': 4, + 'Value #traffic_sent_rate': 5, + 'Value #traffic_received_rate': 6, + }, + renameByName: { + instance: 'Instance', + 'job 1': 'Job', + cluster: 'Cluster', + 'Value #cpu_usage': 'CPU usage', + 'Value #memory_utilization': 'Memory utilization', + 'Value #traffic_sent_rate': 'Traffic sent rate', + 'Value #traffic_received_rate': 'Traffic received rate', + }, + }, + }, + ]) + + g.panel.table.standardOptions.withOverridesMixin([ + g.panel.table.fieldOverride.byName.new('Instance') + + g.panel.table.fieldOverride.byName.withProperty('custom.filterable', true), + + + g.panel.table.fieldOverride.byName.new('Cluster') + + g.panel.table.fieldOverride.byName.withProperty('custom.displayMode', 'basic') + + g.panel.table.fieldOverride.byName.withProperty('custom.filterable', true) + + g.panel.table.fieldOverride.byName.withProperty('custom.noValue', 'NA'), + + g.panel.table.fieldOverride.byName.new('CPU usage') + + g.panel.table.fieldOverride.byName.withProperty('custom.displayMode', 'basic') + + g.panel.table.fieldOverride.byName.withPropertiesFromOptions( + commonlib.panels.cpu.timeSeries.utilization.stylize() + ), + + g.panel.table.fieldOverride.byName.new('Traffic sent rate') + + g.panel.table.fieldOverride.byName.withProperty('custom.displayMode', 'basic') + + g.panel.table.fieldOverride.byName.withPropertiesFromOptions( + commonlib.panels.network.timeSeries.traffic.stylize() + ), + + g.panel.table.fieldOverride.byName.new('Traffic received rate') + + g.panel.table.fieldOverride.byName.withProperty('custom.displayMode', 'basic') + + g.panel.table.fieldOverride.byName.withPropertiesFromOptions( + commonlib.panels.network.timeSeries.traffic.stylize() + ), + + g.panel.table.fieldOverride.byName.new('Memory utilization') + + g.panel.table.fieldOverride.byName.withProperty('custom.displayMode', 'basic') + + g.panel.table.fieldOverride.byName.withPropertiesFromOptions( + commonlib.panels.memory.timeSeries.usagePercent.stylize() + ), + ]), + + overviewMemoryUsagePanel: + commonlib.panels.memory.timeSeries.usageBytes.new( + 'Memory usage', + targets=[signals.overview.memoryUsage.asTarget()] + ) + + g.panel.timeSeries.panelOptions.withDescription('The memory usage of the JVM of the instance.'), + + overviewCPUUsagePanel: + commonlib.panels.cpu.timeSeries.utilization.new( + 'CPU usage', + targets=[signals.overview.cpuUsage.asTarget()] + ) + + g.panel.timeSeries.panelOptions.withDescription('The CPU usage of the JVM process.'), + + overviewTrafficSentPanel: + commonlib.panels.network.timeSeries.traffic.new( + 'Traffic sent', + targets=[ + signals.overview.trafficSentTotal.asTarget() { interval: '2m' }, + signals.overview.trafficSentRate.asTarget() { interval: '2m' }, + ] + ) + + g.panel.timeSeries.panelOptions.withDescription('The traffic sent for a Tomcat connector.') + + g.panel.timeSeries.options.legend.withAsTable(true) + + g.panel.timeSeries.options.legend.withPlacement('right'), + + overviewTrafficReceivedPanel: + commonlib.panels.network.timeSeries.traffic.new( + 'Traffic received', + targets=[ + signals.overview.trafficReceivedTotal.asTarget() { interval: '2m' }, + signals.overview.trafficReceivedRate.asTarget() { interval: '2m' }, + ] + ) + + g.panel.timeSeries.panelOptions.withDescription('The traffic received for a Tomcat connector.') + + g.panel.timeSeries.options.legend.withAsTable(true) + + g.panel.timeSeries.options.legend.withPlacement('right'), + + overviewRequestsPanel: + commonlib.panels.requests.timeSeries.base.new( + 'Requests', + targets=[ + signals.overview.requestsTotal.asTarget() { interval: '2m' }, + signals.overview.requestsRate.asTarget() { interval: '2m' }, + signals.overview.requestsErrors.asTarget() { interval: '2m' }, + signals.overview.requestsErrorsRate.asTarget() { interval: '2m' }, + ] + ) + + g.panel.timeSeries.standardOptions.withUnit('r/s') + + g.panel.timeSeries.panelOptions.withDescription('The total requests and errors for a Tomcat connector.') + + g.panel.timeSeries.options.legend.withAsTable(true) + + g.panel.timeSeries.options.legend.withPlacement('right'), + + overviewProcessingTimePanel: + commonlib.panels.generic.timeSeries.base.new( + 'Processing time', + targets=[ + signals.overview.processingTimeTotal.asTarget() { interval: '2m' }, + signals.overview.processingTimeRate.asTarget() { interval: '2m' }, + ] + ) + + g.panel.timeSeries.options.legend.withAsTable(true) + + g.panel.timeSeries.options.legend.withPlacement('right') + + g.panel.timeSeries.panelOptions.withDescription('The average time taken to process recent requests for a Tomcat connector.') + + g.panel.timeSeries.standardOptions.withUnit('ms'), + + + overviewThreadsPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Threads', + targets=[ + signals.overview.totalConnectionThreads.asTarget(), + signals.overview.totalPollerThreads.asTarget(), + signals.overview.totalIdleThreads.asTarget(), + signals.overview.totalActiveThreads.asTarget(), + signals.overview.connectionThreads.asTarget(), + signals.overview.pollerThreads.asTarget(), + signals.overview.idleThreads.asTarget(), + signals.overview.activeThreads.asTarget(), + ] + ) + + g.panel.timeSeries.panelOptions.withDescription('The number of various threads used by a Tomcat connector.') + + g.panel.timeSeries.options.legend.withAsTable(true) + + g.panel.timeSeries.options.legend.withPlacement('right'), + + // Hosts Panels + + hostsSessionsPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Sessions', + targets=[ + signals.hosts.totalSessions.asTarget() { interval: '2m' }, + signals.hosts.rejectedSessions.asTarget() { interval: '2m' }, + signals.hosts.expiredSessions.asTarget() { interval: '2m' }, + signals.hosts.sessionRate.asTarget() { interval: '2m' }, + signals.hosts.rejectedSessionRate.asTarget() { interval: '2m' }, + signals.hosts.expiredSessionRate.asTarget() { interval: '2m' }, + ] + ) + + g.panel.timeSeries.panelOptions.withDescription('The number of different types of sessions created for a Tomcat host.') + + g.panel.timeSeries.options.legend.withAsTable(true) + + g.panel.timeSeries.options.legend.withPlacement('right'), + + hostsSessionProcessingTimePanel: + commonlib.panels.generic.timeSeries.base.new( + 'Session processing time', + targets=[ + signals.hosts.totalSessionProcessingTime.asTarget() { interval: '2m' }, + signals.hosts.sessionProcessingTime.asTarget() { interval: '2m' }, + ] + ) + + g.panel.timeSeries.panelOptions.withDescription('The average time taken to process recent sessions for a Tomcat host.') + + g.panel.timeSeries.standardOptions.withUnit('ms') + + g.panel.timeSeries.options.legend.withAsTable(true) + + g.panel.timeSeries.options.legend.withPlacement('right'), + + hostsServletPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Servlet', + targets=[ + signals.hosts.totalServletRequests.asTarget() { interval: '2m' }, + signals.hosts.totalServletErrors.asTarget() { interval: '2m' }, + signals.hosts.servletRequestRate.asTarget() { interval: '2m' }, + signals.hosts.servletErrorRate.asTarget() { interval: '2m' }, + ] + ) + + g.panel.timeSeries.panelOptions.withDescription('The total requests and errors for a Tomcat servlet.') + + g.panel.timeSeries.standardOptions.withUnit('reqps') + + g.panel.timeSeries.options.legend.withAsTable(true) + + g.panel.timeSeries.options.legend.withPlacement('right'), + + hostsServletProcessingTimePanel: + commonlib.panels.generic.timeSeries.base.new( + 'Servlet processing time', + targets=[ + signals.hosts.totalServletProcessingTime.asTarget() { interval: '2m' }, + signals.hosts.servletProcessingTime.asTarget() { interval: '2m' }, + ] + ) + + g.panel.timeSeries.panelOptions.withDescription('The average time taken to process recent servlet requests for a Tomcat host.') + + g.panel.timeSeries.standardOptions.withUnit('ms') + + g.panel.timeSeries.options.legend.withAsTable(true) + + g.panel.timeSeries.options.legend.withPlacement('right'), + + }, +} diff --git a/apache-tomcat-mixin/prometheus_rules_out/prometheus_alerts.yaml b/apache-tomcat-mixin/prometheus_rules_out/prometheus_alerts.yaml index a42d882c8..c9baf70f5 100644 --- a/apache-tomcat-mixin/prometheus_rules_out/prometheus_alerts.yaml +++ b/apache-tomcat-mixin/prometheus_rules_out/prometheus_alerts.yaml @@ -6,7 +6,7 @@ groups: description: The CPU usage has been at {{ printf "%.0f" $value }} percent over the last 5 minutes on {{$labels.instance}}, which is above the threshold of 80 percent. summary: The instance has a CPU usage higher than the configured threshold. expr: | - sum by (job,instance) (jvm_process_cpu_load{job="integrations/tomcat"}) > 80 + sum by (job,cluster,instance) (jvm_process_cpu_load{job="integrations/tomcat"}) > 80 for: 5m labels: severity: critical @@ -15,25 +15,25 @@ groups: description: The memory usage has been at {{ printf "%.0f" $value }} percent over the last 5 minutes on {{$labels.instance}}, which is above the threshold of 80 percent. summary: The instance has a higher memory usage than the configured threshold. expr: | - sum(jvm_memory_usage_used_bytes{job="integrations/tomcat"}) by (job,instance) / sum(jvm_physical_memory_bytes{job="integrations/tomcat"}) by (job,instance) * 100 > 80 + sum(jvm_memory_usage_used_bytes{job="integrations/tomcat"}) by (job,cluster,instance) / sum(jvm_physical_memory_bytes{job="integrations/tomcat"}) by (job,cluster,instance) * 100 > 80 for: 5m labels: severity: critical - - alert: ApacheTomcatAlertsHighRequestErrorPercent + - alert: ApacheTomcatAlertsRequestErrors annotations: description: The percentage of request errors has been at {{ printf "%.0f" $value }} percent over the last 5 minutes on {{$labels.instance}}, which is above the threshold of 5 percent. summary: There are a high number of request errors. expr: | - sum by (job,instance) (increase(tomcat_errorcount_total{job="integrations/tomcat"}[5m]) / increase(tomcat_requestcount_total{job="integrations/tomcat"}[5m]) * 100) > 5 + sum by (job,cluster,instance) (increase(tomcat_errorcount_total{job="integrations/tomcat"}[5m]) / increase(tomcat_requestcount_total{job="integrations/tomcat"}[5m]) * 100) > 5 for: 5m labels: severity: critical - - alert: ApacheTomcatAlertsModeratelyHighProcessingTime + - alert: ApacheTomcatAlertsHighProcessingTime annotations: description: The processing time has been at {{ printf "%.0f" $value }}ms over the last 5 minutes on {{$labels.instance}}, which is above the threshold of 300ms. summary: The processing time has been moderately high. expr: | - sum by (job,instance) (increase(tomcat_processingtime_total{job="integrations/tomcat"}[5m]) / increase(tomcat_requestcount_total{job="integrations/tomcat"}[5m])) > 300 + sum by (job,cluster,instance) (increase(tomcat_processingtime_total{job="integrations/tomcat"}[5m]) / increase(tomcat_requestcount_total{job="integrations/tomcat"}[5m])) > 300 for: 5m labels: severity: warning diff --git a/apache-tomcat-mixin/rows.libsonnet b/apache-tomcat-mixin/rows.libsonnet new file mode 100644 index 000000000..d8224fbd4 --- /dev/null +++ b/apache-tomcat-mixin/rows.libsonnet @@ -0,0 +1,44 @@ +local g = import './g.libsonnet'; + + +{ + new(this): + { + local panels = this.grafana.panels, + + // overview rows + overview: g.panel.row.new('Overview') + + g.panel.row.withCollapsed(value=false) + + g.panel.row.withPanels([ + panels.overviewNumberOfClustersPanel { gridPos+: { w: 4, h: 6 } }, + panels.overviewNumberOfNodesPanel { gridPos+: { w: 4, h: 6 } }, + panels.overviewCPUUsageStatPanel { gridPos+: { w: 4, h: 6 } }, + panels.overviewMemoryUtilizationStatPanel { gridPos+: { w: 4, h: 6 } }, + panels.overviewNetworkSentStatPanel { gridPos+: { w: 4, h: 6 } }, + panels.overviewNetworkReceivedStatPanel { gridPos+: { w: 4, h: 6 } }, + panels.overviewInstancesTablePanel { gridPos+: { w: 24 } }, + panels.overviewMemoryUsagePanel { gridPos+: { w: 12 } }, + panels.overviewCPUUsagePanel { gridPos+: { w: 12 } }, + panels.overviewTrafficSentPanel { gridPos+: { w: 12 } }, + panels.overviewTrafficReceivedPanel { gridPos+: { w: 12 } }, + panels.overviewRequestsPanel { gridPos+: { w: 12 } }, + panels.overviewProcessingTimePanel { gridPos+: { w: 12 } }, + panels.overviewThreadsPanel { gridPos+: { w: 24 } }, + ]), + + // hosts rows + hosts: g.panel.row.new('Hosts') + + g.panel.row.withCollapsed(value=false) + + g.panel.row.withPanels([ + panels.hostsSessionsPanel { gridPos+: { w: 12 } }, + panels.hostsSessionProcessingTimePanel { gridPos+: { w: 12 } }, + ]), + + hostServlets: g.panel.row.new('Servlet') + + g.panel.row.withCollapsed(value=false) + + g.panel.row.withPanels([ + panels.hostsServletPanel { gridPos+: { w: 12 } }, + panels.hostsServletProcessingTimePanel { gridPos+: { w: 12 } }, + ]), + }, +} diff --git a/apache-tomcat-mixin/signals/hosts.libsonnet b/apache-tomcat-mixin/signals/hosts.libsonnet new file mode 100644 index 000000000..5991b8acf --- /dev/null +++ b/apache-tomcat-mixin/signals/hosts.libsonnet @@ -0,0 +1,214 @@ +function(this) { + local legendCustomTemplate = '{{ instance }}', + filteringSelector: this.filteringSelector, + groupLabels: this.groupLabels, + instanceLabels: this.instanceLabels, + enableLokiLogs: this.enableLokiLogs, + aggLevel: 'none', + aggFunction: 'sum', + alertsInterval: '2m', + discoveryMetric: { + prometheus: 'tomcat_session_sessioncounter_total', + }, + signals: { + totalSessions: { + name: 'Total sessions', + nameShort: 'Total sessions', + type: 'raw', + description: 'The total number of sessions.', + unit: 'none', + sources: { + prometheus: { + expr: 'sum(increase(tomcat_session_sessioncounter_total{%(queriesSelector)s, host=~"$host", context=~"$context"}[$__interval:] offset -$__interval)) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - total sessions', + }, + }, + }, + + rejectedSessions: { + name: 'Rejected sessions', + nameShort: 'Rejected sessions', + type: 'raw', + description: 'The number of rejected sessions.', + unit: 'none', + sources: { + prometheus: { + expr: 'sum(increase(tomcat_session_rejectedsessions_total{%(queriesSelector)s, host=~"$host", context=~"$context"}[$__interval:] offset -$__interval)) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - rejected sessions', + }, + }, + }, + + expiredSessions: { + name: 'Expired sessions', + nameShort: 'Expired sessions', + type: 'raw', + description: 'The number of expired sessions.', + unit: 'none', + sources: { + prometheus: { + expr: 'sum(increase(tomcat_session_expiredsessions_total{%(queriesSelector)s, host=~"$host", context=~"$context"}[$__interval:] offset -$__interval)) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - expired sessions', + }, + }, + }, + + sessionRate: { + name: 'Session rate', + nameShort: 'Session rate', + type: 'counter', + description: 'The rate of sessions.', + unit: 'none', + sources: { + prometheus: { + expr: 'tomcat_session_sessioncounter_total{%(queriesSelector)s, host=~"$host", context=~"$context"}', + rangeFunction: 'increase', + legendCustomTemplate: legendCustomTemplate + ' - {{host}}{{context}} - sessions', + }, + }, + }, + + rejectedSessionRate: { + name: 'Rejected rate', + nameShort: 'Rejected rate', + type: 'counter', + description: 'The rate of rejected sessions.', + unit: 'none', + sources: { + prometheus: { + expr: 'tomcat_session_rejectedsessions_total{%(queriesSelector)s, host=~"$host", context=~"$context"}', + rangeFunction: 'increase', + legendCustomTemplate: legendCustomTemplate + ' - {{host}}{{context}} - rejected', + }, + }, + }, + + expiredSessionRate: { + name: 'Expired rate', + nameShort: 'Expired rate', + type: 'counter', + description: 'The rate of expired sessions.', + unit: 'none', + sources: { + prometheus: { + expr: 'tomcat_session_expiredsessions_total{%(queriesSelector)s, host=~"$host", context=~"$context"}', + rangeFunction: 'increase', + legendCustomTemplate: legendCustomTemplate + ' - {{host}}{{context}} - expired', + }, + }, + }, + + totalSessionProcessingTime: { + name: 'Total session processing time', + nameShort: 'Total session processing time', + type: 'raw', + description: 'The total time spent processing sessions.', + unit: 'ms', + sources: { + prometheus: { + expr: 'sum(increase(tomcat_session_processingtime_total{%(queriesSelector)s, host=~"$host", context=~"$context"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_session_sessioncounter_total{%(queriesSelector)s, host=~"$host", context=~"$context"}[$__interval:] offset -$__interval), 1)) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - total', + }, + }, + }, + + sessionProcessingTime: { + name: 'Session processing time', + nameShort: 'Session processing time', + type: 'raw', + description: 'The time spent processing sessions.', + unit: 'ms', + sources: { + prometheus: { + expr: 'increase(tomcat_session_processingtime_total{%(queriesSelector)s, host=~"$host", context=~"$context"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_session_sessioncounter_total{%(queriesSelector)s, host=~"$host", context=~"$context"}[$__interval:] offset -$__interval), 1)', + legendCustomTemplate: legendCustomTemplate + ' - {{host}}{{context}}', + }, + }, + }, + + totalServletRequests: { + name: 'Total servlet requests', + nameShort: 'Total servlet requests', + type: 'raw', + description: 'The total number of servlet requests.', + unit: 'r/s', + sources: { + prometheus: { + expr: 'sum(rate(tomcat_servlet_requestcount_total{%(queriesSelector)s, module=~"$host$context", servlet=~"$servlet"}[$__rate_interval])) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - total requests', + }, + }, + }, + + + totalServletErrors: { + name: 'Total servlet errors', + nameShort: 'Total servlet errors', + type: 'raw', + description: 'The total number of servlet errors.', + unit: 'r/s', + sources: { + prometheus: { + expr: 'sum(rate(tomcat_servlet_errorcount_total{%(queriesSelector)s, module=~"$host$context", servlet=~"$servlet"}[$__rate_interval])) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - total errors', + }, + }, + }, + + servletRequestRate: { + name: 'Servlet request rate', + nameShort: 'Servlet request rate', + type: 'counter', + description: 'The rate of servlet requests.', + unit: 'r/s', + sources: { + prometheus: { + expr: 'tomcat_servlet_requestcount_total{%(queriesSelector)s, module=~"$host$context", servlet=~"$servlet"}', + legendCustomTemplate: legendCustomTemplate + ' - {{module}}{{servlet}} - requests', + }, + }, + }, + + servletErrorRate: { + name: 'Servlet error rate', + nameShort: 'Servlet error rate', + type: 'counter', + description: 'The rate of servlet errors.', + unit: 'r/s', + sources: { + prometheus: { + expr: 'tomcat_servlet_errorcount_total{%(queriesSelector)s, module=~"$host$context", servlet=~"$servlet"}', + legendCustomTemplate: legendCustomTemplate + ' - {{module}}{{servlet}} - errors', + }, + }, + }, + + totalServletProcessingTime: { + name: 'Total servlet processing time', + nameShort: 'Total servlet processing time', + type: 'raw', + description: 'The total time spent processing servlet requests.', + unit: 'ms', + sources: { + prometheus: { + expr: 'sum(increase(tomcat_servlet_processingtime_total{%(queriesSelector)s, module=~"$host$context", servlet=~"$servlet"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_servlet_requestcount_total{%(queriesSelector)s, module=~"$host$context", servlet=~"$servlet"}[$__interval:] offset -$__interval), 1)) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - total', + }, + }, + }, + + servletProcessingTime: { + name: 'Servlet processing time', + nameShort: 'Servlet processing time', + type: 'raw', + description: 'The time spent processing servlet requests.', + unit: 'ms', + sources: { + prometheus: { + expr: 'increase(tomcat_servlet_processingtime_total{%(queriesSelector)s, module=~"$host$context", servlet=~"$servlet"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_servlet_requestcount_total{%(queriesSelector)s, module=~"$host$context", servlet=~"$servlet"}[$__interval:] offset -$__interval), 1)', + legendCustomTemplate: legendCustomTemplate + ' - {{module}}{{servlet}}', + }, + }, + }, + }, +} diff --git a/apache-tomcat-mixin/signals/overview.libsonnet b/apache-tomcat-mixin/signals/overview.libsonnet new file mode 100644 index 000000000..6db1d3667 --- /dev/null +++ b/apache-tomcat-mixin/signals/overview.libsonnet @@ -0,0 +1,334 @@ +function(this) { + local legendCustomTemplate = '{{ instance }}', + filteringSelector: this.filteringSelector, + groupLabels: this.groupLabels, + instanceLabels: this.instanceLabels, + enableLokiLogs: this.enableLokiLogs, + aggLevel: 'none', + aggFunction: 'avg', + discoveryMetric: { + prometheus: 'tomcat_session_sessioncounter_total', + }, + + signals: { + numberOfClusters: { + name: 'Number of clusters', + nameShort: 'Clusters', + type: 'raw', + description: 'The number of Apache Tomcat clusters.', + unit: 'none', + sources: { + prometheus: { + expr: 'count(count by (cluster) (jvm_memory_usage_used_bytes{%(queriesSelector)s}))', + }, + }, + }, + + numberOfNodes: { + name: 'Number of nodes', + nameShort: 'Nodes', + type: 'raw', + description: 'The number of Apache Tomcat nodes.', + unit: 'none', + sources: { + prometheus: { + expr: 'count(count by (instance) (jvm_memory_usage_used_bytes{%(queriesSelector)s}))', + }, + }, + }, + + memoryUtilization: { + name: 'Memory utilization', + nameShort: 'Memory utilization', + type: 'raw', + description: 'The total memory utilization of the JVM of the instance.', + unit: 'percent', + sources: { + prometheus: { + expr: 'sum(jvm_memory_usage_used_bytes{%(queriesSelector)s}) by (job, instance) / clamp_min(jvm_physical_memory_bytes{%(queriesSelector)s}, 1) * 100', + }, + }, + }, + + memoryUsage: { + name: 'Memory usage', + nameShort: 'Memory usage', + type: 'gauge', + description: 'The memory usage of the JVM of the instance.', + unit: 'bytes', + sources: { + prometheus: { + expr: 'jvm_memory_usage_used_bytes{%(queriesSelector)s}', + legendCustomTemplate: legendCustomTemplate + ' - {{area}}', + }, + }, + }, + + cpuUsage: { + name: 'CPU usage', + nameShort: 'CPU usage', + type: 'gauge', + description: 'The CPU usage of the JVM of the instance.', + unit: 'percent', + sources: { + prometheus: { + expr: 'jvm_process_cpu_load{%(queriesSelector)s} * 100', + legendCustomTemplate: legendCustomTemplate, + }, + }, + }, + + trafficSentTotal: { + name: 'Traffic sent total', + nameShort: 'Traffic sent total', + type: 'raw', + description: 'The total traffic sent by the instance.', + unit: 'Bps', + sources: { + prometheus: { + expr: 'sum(rate(tomcat_bytessent_total{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}[$__rate_interval])) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - total', + }, + }, + }, + + trafficSentRate: { + name: 'Traffic sent rate', + nameShort: 'Traffic sent rate', + type: 'counter', + description: 'The rate of traffic sent by the instance.', + unit: 'Bps', + sources: { + prometheus: { + expr: 'tomcat_bytessent_total{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}', + legendCustomTemplate: legendCustomTemplate + ' - {{protocol}} - {{port}}', + }, + }, + }, + + trafficReceivedTotal: { + name: 'Traffic received total', + nameShort: 'Traffic received total', + type: 'raw', + description: 'The total traffic received by the instance.', + unit: 'Bps', + sources: { + prometheus: { + expr: 'sum(rate(tomcat_bytesreceived_total{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}[$__rate_interval])) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - total', + }, + }, + }, + + trafficReceivedRate: { + name: 'Traffic received rate', + nameShort: 'Traffic received rate', + type: 'counter', + description: 'The rate of traffic received by the instance.', + unit: 'Bps', + sources: { + prometheus: { + expr: 'tomcat_bytesreceived_total{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}', + legendCustomTemplate: legendCustomTemplate + ' - {{protocol}} - {{port}}', + }, + }, + }, + + + requestsTotal: { + name: 'Requests total', + nameShort: 'Requests total', + type: 'raw', + description: 'The total number of requests by the instance.', + unit: 'r/s', + sources: { + prometheus: { + expr: 'sum(rate(tomcat_requestcount_total{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}[$__rate_interval])) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - total requests', + }, + }, + }, + + requestsErrors: { + name: 'Requests errors', + nameShort: 'Requests errors', + type: 'raw', + description: 'The total number of requests errors by the instance.', + unit: 'r/s', + sources: { + prometheus: { + expr: 'sum(rate(tomcat_errorcount_total{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}[$__rate_interval])) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - total errors', + }, + }, + }, + + requestsRate: { + name: 'Requests rate', + nameShort: 'Requests rate', + type: 'counter', + description: 'The rate of requests by the instance.', + unit: 'r/s', + sources: { + prometheus: { + expr: 'tomcat_requestcount_total{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}', + legendCustomTemplate: legendCustomTemplate + ' - {{protocol}} - {{port}} - requests', + }, + }, + }, + + requestsErrorsRate: { + name: 'Requests errors rate', + nameShort: 'Requests errors rate', + type: 'counter', + description: 'The rate of requests errors by the instance.', + unit: 'r/s', + sources: { + prometheus: { + expr: 'tomcat_errorcount_total{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}', + legendCustomTemplate: legendCustomTemplate + ' - {{protocol}} - {{port}} - errors', + }, + }, + }, + + processingTimeTotal: { + name: 'Processing time total', + nameShort: 'Processing time total', + type: 'raw', + description: 'The total processing time by the tomcat connector.', + unit: 'ms', + sources: { + prometheus: { + expr: 'sum(increase(tomcat_processingtime_total{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_requestcount_total{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}[$__interval:] offset -$__interval), 1)) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - total', + }, + }, + }, + + processingTimeRate: { + name: 'Processing time rate', + nameShort: 'Processing time rate', + type: 'raw', + description: 'The rate of processing time by the instance.', + unit: 'ms', + sources: { + prometheus: { + expr: 'increase(tomcat_processingtime_total{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}[$__interval:] offset -$__interval) / clamp_min(increase(tomcat_requestcount_total{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}[$__interval:] offset -$__interval), 1)', + legendCustomTemplate: legendCustomTemplate + ' - {{protocol}} - {{port}}', + }, + }, + }, + + totalConnectionThreads: { + name: 'Total connection threads', + nameShort: 'Total connection threads', + type: 'raw', + description: 'The total number of connection threads by the tomcat connector.', + unit: 'short', + sources: { + prometheus: { + expr: 'sum(tomcat_threadpool_connectioncount{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - total connections', + }, + }, + }, + + totalPollerThreads: { + name: 'Total poller threads', + nameShort: 'Total poller threads', + type: 'raw', + description: 'The total number of poller threads by the tomcat connector.', + unit: 'short', + sources: { + prometheus: { + expr: 'sum(tomcat_threadpool_pollerthreadcount{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - poller total', + }, + }, + }, + + totalIdleThreads: { + name: 'Total idle threads', + nameShort: 'Total idle threads', + type: 'raw', + description: 'The total number of idle threads by the tomcat connector.', + unit: 'short', + sources: { + prometheus: { + expr: 'sum(tomcat_threadpool_keepalivecount{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - idle total', + }, + }, + }, + + totalActiveThreads: { + name: 'Total active threads', + nameShort: 'Total active threads', + type: 'raw', + description: 'The total number of active threads by the tomcat connector.', + unit: 'short', + sources: { + prometheus: { + expr: 'sum(tomcat_threadpool_currentthreadcount{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}) by (job, instance)', + legendCustomTemplate: legendCustomTemplate + ' - active total', + }, + }, + }, + + connectionThreads: { + name: 'Connection threads', + nameShort: 'Connection threads', + type: 'gauge', + description: 'The number of connection threads by the tomcat connector.', + unit: 'short', + sources: { + prometheus: { + expr: 'tomcat_threadpool_connectioncount{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}', + legendCustomTemplate: legendCustomTemplate + ' - {{protocol}} - {{port}} - connections', + }, + }, + }, + + pollerThreads: { + name: 'Poller threads', + nameShort: 'Poller threads', + type: 'gauge', + description: 'The number of poller threads by the tomcat connector.', + unit: 'short', + sources: { + prometheus: { + expr: 'tomcat_threadpool_pollerthreadcount{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}', + legendCustomTemplate: legendCustomTemplate + ' - {{protocol}} - {{port}} - poller', + }, + }, + }, + + idleThreads: { + name: 'Idle threads', + nameShort: 'Idle threads', + type: 'gauge', + description: 'The number of idle threads by the tomcat connector.', + unit: 'short', + sources: { + prometheus: { + expr: 'tomcat_threadpool_keepalivecount{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}', + legendCustomTemplate: legendCustomTemplate + ' - {{protocol}} - {{port}} - idle', + }, + }, + }, + + activeThreads: { + name: 'Active threads', + nameShort: 'Active threads', + type: 'gauge', + description: 'The number of active threads by the tomcat connector.', + unit: 'short', + sources: { + prometheus: { + expr: 'tomcat_threadpool_currentthreadcount{%(queriesSelector)s, protocol=~"$protocol", port=~"$port"}', + legendCustomTemplate: legendCustomTemplate + ' - {{protocol}} - {{port}} - active', + }, + }, + }, + }, +}