Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions microsoft-iis-mixin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ The Microsoft IIS mixin contains the following dashboards:

and the following alerts:

- MicrosoftIISHighNumberOfRejectedAsyncIORequests
- MicrosoftIISHighNumberOf5xxRequestErrors
- MicrosoftIISLowSuccessRateForWebsocketConnections
- MicrosoftIISThreadpoolUtilizationNearingMax
- MicrosoftIISHighNumberOfWorkerProcessFailures
- MicrosoftIISRejectedAsyncIORequests
- MicrosoftIIS5xxRequestErrors
- MicrosoftIISSuccessRateForWebsocket
- MicrosoftIISThreadpoolUtilization
- MicrosoftIISWorkerProcessFailures

Default thresholds can be configured in `config,libsonnet`

Expand Down Expand Up @@ -57,11 +57,11 @@ The Microsoft IIS applications dashboard provides details on worker requests, we
![Screenshot3 of the applications dashboard](https://storage.googleapis.com/grafanalabs-integration-assets/iis/screenshots/application-3.png)
## Alerts overview

MicrosoftIISHighNumberOfRejectedAsyncIORequests: There are a high number of rejected async I/O requests for a site.
MicrosoftIISHighNumberOf5xxRequestErrors: There are a high number of 5xx request errors for an application.
MicrosoftIISLowSuccessRateForWebsocketConnections: There is a low success rate for websocket connections for an application.
MicrosoftIISThreadpoolUtilizationNearingMax: The thread pool utilization is nearing max capacity.
MicrosoftIISHighNumberOfWorkerProcessFailures: There are a high number of worker process failures for an application.
- `MicrosoftIISRejectedAsyncIORequests`: There are a high number of rejected async I/O requests for a site.
- `MicrosoftIIS5xxRequestErrors`: There are a high number of 5xx request errors for an application.
- `MicrosoftIISSuccessRateForWebsocket`: There is a low success rate for websocket connections for an application.
- `MicrosoftIISThreadpoolUtilization`: The thread pool utilization is nearing max capacity.
- `MicrosoftIISWorkerProcessFailures`: There are a high number of worker process failures for an application.

## Install Tools

Expand Down
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do all or some of the alerts need to use the {%(filteringSelector)s}? It's not present in any of them.

Original file line number Diff line number Diff line change
@@ -1,87 +1,87 @@
{
prometheusAlerts+:: {
groups+: [
new(this): {
groups: [
{
name: 'microsoft-iis',
name: 'MicrosoftIISAlerts',
rules: [
{
alert: 'MicrosoftIISHighNumberOfRejectedAsyncIORequests',
alert: 'MicrosoftIISRejectedAsyncIORequests',
expr: |||
increase(windows_iis_rejected_async_io_requests_total[5m]) > %(alertsWarningHighRejectedAsyncIORequests)s
||| % $._config,
||| % this.config,
'for': '5m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'There are a high number of rejected async I/O requests for a site.',
description: |||
The number of rejected async IO requests is {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} - {{ $labels.site }} which is above the threshold of %(alertsWarningHighRejectedAsyncIORequests)s.
||| % $._config,
description:
('The number of rejected async IO requests is {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} - {{ $labels.site }}, ' +
'which is above the threshold of %(alertsWarningHighRejectedAsyncIORequests)s.') % this.config,
},
},
{
alert: 'MicrosoftIISHighNumberOf5xxRequestErrors',
alert: 'MicrosoftIIS5xxRequestErrors',
expr: |||
sum without (pid, status_code)(increase(windows_iis_worker_request_errors_total{status_code=~"5.*"}[5m])) > %(alertsCriticalHigh5xxRequests)s
||| % $._config,
sum without (pid, status_code)(increase(windows_iis_worker_request_errors_total{status_code=~"5.."}[5m])) > %(alertsCriticalHigh5xxRequests)s
||| % this.config,
'for': '5m',
labels: {
severity: 'critical',
},
annotations: {
summary: 'There are a high number of 5xx request errors for an application.',
description: |||
The number of 5xx request errors is {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} - {{ $labels.app }} which is above the threshold of %(alertsCriticalHigh5xxRequests)s.
||| % $._config,
description:
('The number of 5xx request errors is {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} - {{ $labels.app }}, ' +
'which is above the threshold of %(alertsCriticalHigh5xxRequests)s.') % this.config,
},
},
{
alert: 'MicrosoftIISLowSuccessRateForWebsocketConnections',
alert: 'MicrosoftIISSuccessRateForWebsocket',
expr: |||
sum without (pid) (increase(windows_iis_worker_websocket_connection_accepted_total[5m]) / clamp_min(increase(windows_iis_worker_websocket_connection_attempts_total[5m]),1)) * 100 > %(alertsCriticalLowWebsocketConnectionSuccessRate)s
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you didn't change this line but I think it has a bug:

  • The code is calculating success percentage as: (accepted conns total / all conns attempts total) * 100
  • Then we check if the success % is above a low success threshold
  • I think the comparison operator needs to be flipped: < instead of >

I keep finding these bugs in the existing code and I am going to add this as an example to https://github.com/grafana/cloud-onboarding/issues/9972.

||| % $._config,
||| % this.config,
'for': '5m',
labels: {
severity: 'critical',
},
annotations: {
summary: 'There is a low success rate for websocket connections for an application.',
description: |||
The success rate for websocket connections is {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} - {{ $labels.app }} which is above the threshold of %(alertsCriticalLowWebsocketConnectionSuccessRate)s.
||| % $._config,
description:
('The success rate for websocket connections is {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} - {{ $labels.app }}, ' +
'which is above the threshold of %(alertsCriticalLowWebsocketConnectionSuccessRate)s.') % this.config,
},
},
{
alert: 'MicrosoftIISThreadpoolUtilizationNearingMax',
alert: 'MicrosoftIISThreadpoolUtilization',
expr: |||
sum without (pid, state)(windows_iis_worker_threads / windows_iis_worker_max_threads) * 100 > %(alertsCriticalHighThreadPoolUtilization)s
||| % $._config,
||| % this.config,
'for': '5m',
labels: {
severity: 'critical',
},
annotations: {
summary: 'The thread pool utilization is nearing max capacity.',
description: |||
The threadpool utilization is at {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} - {{ $labels.app }} which is above the threshold of %(alertsCriticalHighThreadPoolUtilization)s.
||| % $._config,
description:
('The threadpool utilization is at {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} - {{ $labels.app }}, ' +
'which is above the threshold of %(alertsCriticalHighThreadPoolUtilization)s.') % this.config,
},
},
{
alert: 'MicrosoftIISHighNumberOfWorkerProcessFailures',
alert: 'MicrosoftIISWorkerProcessFailures',
expr: |||
increase(windows_iis_total_worker_process_failures[5m]) > %(alertsWarningHighWorkerProcessFailures)s
||| % $._config,
||| % this.config,
'for': '5m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'There are a high number of worker process failures for an application.',
description: |||
The number of worker process failures is at {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} - {{ $labels.app }} which is above the threshold of %(alertsWarningHighWorkerProcessFailures)s.
||| % $._config,
description:
('The number of worker process failures is at {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} - {{ $labels.app }}, ' +
'which is above the threshold of %(alertsWarningHighWorkerProcessFailures)s.') % this.config,
},
},
],
Expand Down
46 changes: 34 additions & 12 deletions microsoft-iis-mixin/config.libsonnet
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
{
_config+:: {
dashboardTags: ['microsoft-iis-mixin'],
dashboardPeriod: 'now-1h',
dashboardTimezone: 'default',
dashboardRefresh: '1m',
local this = self,

// alerts thresholds
alertsWarningHighRejectedAsyncIORequests: 20,
alertsCriticalHigh5xxRequests: 5,
alertsCriticalLowWebsocketConnectionSuccessRate: 80,
alertsCriticalHighThreadPoolUtilization: 90,
alertsWarningHighWorkerProcessFailures: 10,
filteringSelector: 'job="integrations/iis"',
groupLabels: ['job'],
instanceLabels: ['instance'],
logLabels: ['job', 'instance'],

enableLokiLogs: true,

// Dashboard settings
dashboardTags: [this.uid + '-mixin'],
uid: 'microsoft-iis',
dashboardNamePrefix: 'Microsoft IIS',
dashboardPeriod: 'now-30m',
dashboardTimezone: 'default',
dashboardRefresh: '1m',

// Logs configuration
enableLokiLogs: true,
extraLogLabels: ['level'], // Required by logs-lib
logsVolumeGroupBy: 'level',
showLogsVolume: true,

// Alert thresholds
alertsWarningHighRejectedAsyncIORequests: 20, // count
alertsCriticalHigh5xxRequests: 5, // %
alertsCriticalLowWebsocketConnectionSuccessRate: 80, // %
alertsCriticalHighThreadPoolUtilization: 90, // %
alertsWarningHighWorkerProcessFailures: 10, // count

// Metrics source
metricsSource: 'prometheus',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an array instead?

Suggested change
metricsSource: 'prometheus',
metricsSource: ['prometheus'],


// Signal definitions grouped by dashboard
signals+: {
overview: (import './signals/overview.libsonnet')(this),
applications: (import './signals/applications.libsonnet')(this),
},
}
132 changes: 132 additions & 0 deletions microsoft-iis-mixin/dashboards.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
local g = import './g.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;

{
// Microsoft IIS overview dashboard
'microsoft-iis-overview.json':
g.dashboard.new(prefix + ' overview')
+ g.dashboard.withDescription('Dashboard providing an overview of Microsoft IIS performance.')
+ g.dashboard.withPanels(
g.util.panel.resolveCollapsedFlagOnRows(
g.util.grid.wrapPanels(
[
this.grafana.rows.overviewRequests,
this.grafana.rows.overviewAsyncIO,
this.grafana.rows.overviewTraffic,
this.grafana.rows.overviewConnections,
]
)
)
)
+ root.applyCommon(
vars.multiInstance + [
g.dashboard.variable.query.new('site')
+ g.dashboard.variable.query.withDatasourceFromVariable(vars.datasources.prometheus)
+ g.dashboard.variable.query.queryTypes.withLabelValues('site', 'windows_iis_requests_total{job=~"$job", instance=~"$instance"}')
+ g.dashboard.variable.query.generalOptions.withLabel('Site')
+ g.dashboard.variable.query.selectionOptions.withMulti(true)
+ g.dashboard.variable.query.selectionOptions.withIncludeAll(true, '.+')
+ g.dashboard.variable.query.refresh.onTime(),
],
uid + '_overview',
tags,
links { microsoftIISOverview+:: {} },
annotations,
timezone,
refresh,
period
),

// Microsoft IIS applications dashboard
'microsoft-iis-applications.json':
g.dashboard.new(prefix + ' applications')
+ g.dashboard.withDescription('Dashboard providing detailed application performance metrics for Microsoft IIS.')
+ g.dashboard.withPanels(
g.util.panel.resolveCollapsedFlagOnRows(
g.util.grid.wrapPanels(
[
this.grafana.rows.applicationsRequests,
this.grafana.rows.applicationsWebsocket,
this.grafana.rows.applicationsWorkerProcesses,
this.grafana.rows.applicationsCache,
]
)
)
)
+ root.applyCommon(
vars.multiInstance + [
g.dashboard.variable.query.new('application')
+ g.dashboard.variable.query.withDatasourceFromVariable(vars.datasources.prometheus)
+ g.dashboard.variable.query.queryTypes.withLabelValues('app', 'windows_iis_current_application_pool_state{job=~"$job", instance=~"$instance"}')
+ g.dashboard.variable.query.generalOptions.withLabel('Application')
+ g.dashboard.variable.query.selectionOptions.withMulti(true)
+ g.dashboard.variable.query.selectionOptions.withIncludeAll(true, '.+')
+ g.dashboard.variable.query.refresh.onLoad()
+ g.dashboard.variable.query.refresh.onTime(),
],
uid + '_applications',
tags,
links { microsoftIISApplications+:: {} },
annotations,
timezone,
refresh,
period
),
}
+
if this.config.enableLokiLogs then
{
'microsoft-iis-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 { microsoftIISLogs+:: {} }, 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,
} else {},

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)),
}
2 changes: 0 additions & 2 deletions microsoft-iis-mixin/dashboards/dashboards.libsonnet

This file was deleted.

Loading
Loading