Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update collector not doing anything #1691

Closed
MajorP93 opened this issue Oct 15, 2024 · 5 comments · Fixed by #1692
Closed

Update collector not doing anything #1691

MajorP93 opened this issue Oct 15, 2024 · 5 comments · Fixed by #1692
Labels

Comments

@MajorP93
Copy link

MajorP93 commented Oct 15, 2024

Current Behavior

When enabling the update collector it gets listed in the "Enabled collectors: [...]" log output.
Unfortunately not one single metric prefixed with "windows_updates" gets exposed.
Also: there is no log output related to the "update" collector being generated despite debug log level being enabled.
The update collector seems to not do anything at all.

Expected Behavior

When enabling the "update" collector metrics with prefix "windows_updates" should be exposed and log entries should be generated.

Steps To Reproduce

Enable update collector, query metrics endpoint (e.g. http://127.0.0.1:9182/metrics) and check for "windows_updates" prefixed metrics. Check windows_exporter log output.

Environment

  • windows_exporter Version: v0.29.2
  • Windows Server Version: Windows Server 2022 Datacenter

windows_exporter logs

C:\Program Files\windows_exporter>windows_exporter.exe --collectors.enabled "update" --log.level=debug --log.file=stdout --log.format=json
{"ts":"2024-10-15T10:13:29.826+02:00","level":"debug","caller":"exporter.go(main.run):175","msg":"Logging has Started"}
{"ts":"2024-10-15T10:13:29.849+02:00","level":"info","caller":"exporter.go(main.logCurrentUser):309","msg":"Running as MONITORINGTESTW\\Administrator"}
{"ts":"2024-10-15T10:13:29.849+02:00","level":"info","caller":"exporter.go(main.run):218","msg":"Enabled collectors: update"}
{"ts":"2024-10-15T10:13:29.850+02:00","level":"info","caller":"exporter.go(main.run):241","msg":"Starting windows_exporter","version":"0.29.2","branch":"HEAD","revision":"622813343f930c121c8b1c061d6dd6f02d96015f","goversion":"go1.23.2","builddate":"20241011-14:21:36","maxprocs":4}
{"ts":"2024-10-15T10:13:29.850+02:00","level":"info","caller":"tls_config.go(web.Serve):347","msg":"Listening on","address":"[::]:9182"}
{"ts":"2024-10-15T10:13:29.850+02:00","level":"info","caller":"tls_config.go(web.Serve):350","msg":"TLS is disabled.","http2":false,"address":"[::]:9182"}

After this no additional output / log entry gets generated / printed.

Anything else?

Tried running windows_exporter on 2 different systems. Same issue. Other collectors work without any issues. Tried running windows_exporter both as Administrator and SYSTEM, same issue (issue not related to permissions).

Querying Windows Update via PowerShell works without any issues.

PS C:\Users\Administrator> $Session = New-Object -ComObject "Microsoft.Update.Session"
PS C:\Users\Administrator> $Searcher = $Session.CreateUpdateSearcher()
PS C:\Users\Administrator> $Results = $Searcher.Search("IsInstalled=0 and Type='Software'")
PS C:\Users\Administrator> $Results.Updates.Count
4

@jkroepke
Copy link
Member

jkroepke commented Oct 15, 2024

windows_exporter is using this search terms: IsInstalled=0 and IsHidden=0"

Also I'm missing the debug log message search for updates took which indicates a successful search. It seems like it hands somewhere.

Is collector.updates.online set and if yes, is it set to true or false?

@jkroepke
Copy link
Member

jkroepke commented Oct 15, 2024

I found the issue: The update collector is not availible in the lastest stable release. It's only availible in current main branch.

But you can try a non stable snapshot build from main branch: https://github.com/prometheus-community/windows_exporter/actions/runs/11326759971/artifacts/2052853407

@MajorP93
Copy link
Author

@jkroepke thanks a lot for your quick reply!

windows_exporter is using this search terms: IsInstalled=0 and IsHidden=0"

Also I'm missing the debug log message search for updates took which indicates a successful search. It seems like it hands somewhere.

Is collector.updates.online set and if yes, is it set to true or false?

During my tests collector.updates.online was not set.

I found the issue: The update collector is not availible in the lastest stable release. It's only availible in current main branch.

But you can try a non stable snapshot build from main branch: https://github.com/prometheus-community/windows_exporter/actions/runs/11326759971/artifacts/2052853407

Good to know! Thanks for this information. I will re-test using a snapshot build.

@MajorP93
Copy link
Author

MajorP93 commented Oct 15, 2024

@jkroepke I did more tests and have some findings.

  1. documentation states the collector is named "update" but in reality windows_exporter.exe seems to expect it to be named "updates"

  2. both stable and snapshot builds accept the "update" collector name but in both versions nothing happens when it is enabled.

  3. stable build does not support "updates" collector name and related config parameters:
    C:\Program Files\windows_exporter>windows_exporter_stable.exe --collectors.enabled "updates" --log.level=debug --log.file=stdout --log.format=json --collector.updates.scrape-interval=10s 2024/10/15 12:33:12 ERROR Failed to parse CLI args err="unknown long flag '--collector.updates.scrape-interval'"

  4. snapshot build accepts "updates" collector name which actually seems to work.
    C:\Program Files\windows_exporter>windows_exporter_snapshot.exe --collectors.enabled "updates" --log.level=debug --log.file=stdout --log.format=json --collector.updates.scrape-interval=10s {"ts":"2024-10-15T10:33:37.659Z","level":"debug","caller":"exporter.go(main.run):174","msg":"Logging has Started"} {"ts":"2024-10-15T10:33:37.659Z","level":"debug","caller":"exporter.go(main.setPriorityWindows):337","msg":"setting process priority to normal"} {"ts":"2024-10-15T10:33:37.678Z","level":"info","caller":"updates.go(updates.(*Collector).Build):86","msg":"update collector is in an experimental state! The configuration and metrics may change in future. Please report any issues.","collector":"updates"} {"ts":"2024-10-15T10:33:37.691Z","level":"info","caller":"exporter.go(main.logCurrentUser):311","msg":"Running as MONITORINGTESTW\\Administrator"} {"ts":"2024-10-15T10:33:37.691Z","level":"info","caller":"exporter.go(main.run):212","msg":"Enabled collectors: updates"} {"ts":"2024-10-15T10:33:37.694Z","level":"info","caller":"exporter.go(main.run):235","msg":"Starting windows_exporter","version":"0.29.2-35-gfbce64e","branch":"HEAD","revision":"fbce64eda3ef04f5949a2032b6110aaa83e2242c","goversion":"go1.23.2","builddate":"20241015-08:34:02","maxprocs":4} {"ts":"2024-10-15T10:33:37.697Z","level":"info","caller":"tls_config.go(web.Serve):347","msg":"Listening on","address":"[::]:9182"} {"ts":"2024-10-15T10:33:37.697Z","level":"info","caller":"tls_config.go(web.Serve):350","msg":"TLS is disabled.","http2":false,"address":"[::]:9182"} {"ts":"2024-10-15T10:33:40.235Z","level":"debug","caller":"updates.go(updates.(*Collector).fetchUpdates):261","msg":"search for updates took 2.5361642s","collector":"updates"} {"ts":"2024-10-15T10:33:41.703Z","level":"debug","caller":"prometheus.go(collector.(*Prometheus).execute):277","msg":"collector updates succeeded after 0s, resulting in 5 metrics"}

@jkroepke
Copy link
Member

I will fix that. update should be the correct one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants