Skip to content

IIS Collector Panic Caused by Certain Characters in Application Names #2472

Description

@CheapCait

Current Behavior

My organization is running Grafana Alloy, which bundles windows_exporter, on Windows Server 2019 and using the iis collector to get metrics on our various application pools. However, the collector panics and does not return application pool metrics due to the behavior of the 'deduplicateIISNames' with our Application Pool names, some of which contain spaces or # characters. This behavior is present with all versions of windows_exporter after 0.30 which we have tested which are v0.31.3, v0.31.1, v0.30.8, v0.30.7. It is not present in earlier versions of the collector which do not use 'deduplicateIISNames'.

Can the code here: https://github.com/prometheus-community/windows_exporter/blob/master/internal/collector/iis/iis_app_pool_was.go please be updated to account for these types of application pool names so we can update to the latest version of windows_exporter?

Expected Behavior

The iis collector should account for spaces and the # character appearing in Application Pool names, slice them correctly, and return metrics instead of panicking.

Steps To Reproduce

1. Run Windows Server 2019 with IIS
2. Name an application pool with a space or # character in the name
3. Install and try to run any version later than 0.30 of the windows_exporter with the iis collector installed and attempt to collect application pool metrics.

Environment

  • windows_exporter Version: v0.31.3, v0.31.1, v0.30.8, v0.30.7
  • Windows Server Version: 2019

windows_exporter logs

level=warn msg="collector iis failed after 287.9955ms, resulting in 815 metrics" component_path=/ component_id=prometheus.exporter.windows.integrations_windows_exporter err="panic in collector iis: runtime error: slice bounds out of range [3:1:]. stack: goroutine 204536 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:26 +0x5e\ngithub.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector.func1.1()\n\t/go/pkg/mod/github.com/prometheus-community/windows_exporter@v0.31.3/pkg/collector/collect.go:132 +0x5d\npanic({0x10336340?, 0x11168ce6c840?})\n\t/usr/local/go/src/runtime/panic.go:860 +0x13a\nslices.Delete[...](...)\n\t/usr/local/go/src/slices/slices.go:223\ngithub.com/prometheus-community/windows_exporter/internal/collector/iis.deduplicateIISNames[...]({0x11168ae56008, 0x18, 0x25})\n\t/go/pkg/mod/github.com/prometheus-community/windows_exporter@v0.31.3/internal/collector/iis/iis.go:313 +0x4d2\ngithub.com/prometheus-community/windows_exporter/internal/collector/iis.(*Collector).collectHttpServiceRequestQueues(0x11168a416908, 0x11168cfd61c0)\n\t/go/pkg/mod/github.com/prometheus-community/windows_exporter@v0.31.3/internal/collector/iis/iis_http_service_request_queues.go:96 +0x78\ngithub.com/prometheus-community/windows_exporter/internal/collector/iis.(*Collector).Collect(0x11168a416908, 0x11168cfd61c0)\n\t/go/pkg/mod/github.com/prometheus-community/windows_exporter@v0.31.3/internal/collector/iis/iis.go:267 +0x185\ngithub.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector.func1()\n\t/go/pkg/mod/github.com/prometheus-community/windows_exporter@v0.31.3/pkg/collector/collect.go:139 +0x70\ncreated by github.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector in goroutine 204552\n\t/go/pkg/mod/github.com/prometheus-community/windows_exporter@v0.31.3/pkg/collector/collect.go:128 +0x1a8\n"

Anything else?

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions