{"id":21470125,"url":"https://github.com/sensu-plugins/sensu-plugins-windows","last_synced_at":"2025-07-15T07:31:02.288Z","repository":{"id":27165638,"uuid":"30635135","full_name":"sensu-plugins/sensu-plugins-windows","owner":"sensu-plugins","description":"Sensu Windows Plugins","archived":false,"fork":false,"pushed_at":"2021-05-27T00:55:18.000Z","size":256,"stargazers_count":22,"open_issues_count":11,"forks_count":49,"subscribers_count":14,"default_branch":"master","last_synced_at":"2023-03-12T09:25:55.074Z","etag":null,"topics":["metrics","monitoring","sensu-plugins","windows"],"latest_commit_sha":null,"homepage":"http://sensu-plugins.io","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sensu-plugins.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-11T07:03:32.000Z","updated_at":"2023-03-07T13:46:31.000Z","dependencies_parsed_at":"2022-07-18T03:16:54.883Z","dependency_job_id":null,"html_url":"https://github.com/sensu-plugins/sensu-plugins-windows","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensu-plugins%2Fsensu-plugins-windows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensu-plugins%2Fsensu-plugins-windows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensu-plugins%2Fsensu-plugins-windows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sensu-plugins%2Fsensu-plugins-windows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sensu-plugins","download_url":"https://codeload.github.com/sensu-plugins/sensu-plugins-windows/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226024782,"owners_count":17561710,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["metrics","monitoring","sensu-plugins","windows"],"created_at":"2024-11-23T09:23:37.781Z","updated_at":"2024-11-23T09:23:38.980Z","avatar_url":"https://github.com/sensu-plugins.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Sensu-Plugins-Windows\n\n[![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-windows.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-windows)\n[![Gem Version](https://badge.fury.io/rb/sensu-plugins-windows.svg)](http://badge.fury.io/rb/sensu-plugins-windows)\n[![Appveyor status](https://ci.appveyor.com/api/projects/status/j6cg9tmxs6ivscrd/branch/master?svg=true)](https://ci.appveyor.com/project/majormoses/sensu-plugins-windows/branch/master)\n[![Community Slack](https://slack.sensu.io/badge.svg)](https://slack.sensu.io/badge)\n\n## Functionality\n\nThese files provide basic Checks and Metrics for a Windows system.\n\n## Files\n\n### Ruby\n\n * bin/check-windows-cpu-load.rb\n * bin/check-windows-disk.rb\n * bin/check-windows-process.rb\n * bin/check-windows-processor-queue-length.rb\n * bin/check-windows-ram.rb\n * bin/check-windows-service.rb\n * bin/metric-windows-cpu-load.rb\n * bin/metric-windows-disk-usage.rb\n * bin/metric-windows-network.rb\n * bin/metric-windows-processor-queue-length.rb\n * bin/metric-windows-ram-usage.rb\n * bin/metric-windows-uptime.rb\n * bin/powershell_helper.rb\n\n### Powershell\n\n * bin/check-windows-cpu-load.ps1\n * bin/check-windows-disk.ps1\n * bin/check-windows-disk-writeable.ps1\n * bin/check-windows-pagefile.ps1\n * bin/check-windows-process.ps1\n * bin/check-windows-processor-queue-length.ps1\n * bin/check-windows-ram.ps1\n * bin/check-windows-service.ps1\n * bin/metric-windows-cpu-load.ps1\n * bin/metric-windows-disk-usage.ps1\n * bin/metric-windows-network.ps1\n * bin/metric-windows-processor-queue-length.ps1\n * bin/metric-windows-ram-usage.ps1\n * bin/metric-windows-uptime.ps1\n * bin/check-windows-directory.ps1\n * bin/check-windows-event-log.ps1\n * bin/check-windows-log.ps1\n\n\n## Usage\n\n##### Example 1:\n\nExecute Powershell functions using the helper (No copy needed), see example below:\n\n```json\n  {\n    \"checks\": {\n      \"cpu_percent\": {\n        \"command\": \"c:\\\\opt\\\\sensu\\\\embedded\\\\bin\\\\ruby C:\\\\opt\\\\sensu\\\\embedded\\\\bin\\\\powershell_helper.rb check-windows-ram.ps1 90 95\",\n        \"interval\": 30,\n        \"type\": \"check\",\n        \"handler\": \"win_metrics\",\n        \"subscribers\": [\"win_metrics\"]\n      }\n    }\n  }\n```\n\n##### Example 2:\n\n- Copy either the Ruby or Powershell files on a Sensu Client, typically under C:\\etc\\sensu\\plugins.\n\n- You should also include the full escaped path to the ruby interpreter in the check's command configuration, see example below:\n\n```json\n  {\n    \"checks\": {\n      \"cpu_percent\": {\n        \"command\": \"c:\\\\opt\\\\sensu\\\\embedded\\\\bin\\\\ruby C:\\\\opt\\\\sensu\\\\etc\\\\plugins\\\\metric-windows-cpu-load.rb\",\n        \"interval\": 30,\n        \"type\": \"metric\",\n        \"handler\": \"win_metrics\",\n        \"subscribers\": [\"win_metrics\"]\n      }\n    }\n  }\n```\n\nYou should also include the full escaped path to the ruby interpreter in the check's command configuration, see example below:\n\n```json\n{\n  \"checks\": {\n    \"cpu_percent\": {\n      \"command\": \"c:\\\\opt\\\\sensu\\\\embedded\\\\bin\\\\ruby C:\\\\opt\\\\sensu\\\\etc\\\\plugins\\\\metric-windows-cpu-load.rb\",\n      \"interval\": 30,\n      \"type\": \"metric\",\n      \"handler\": \"win_metrics\",\n      \"subscribers\": [\"win_metrics\"]\n    }\n  }\n}\n```\n\n## Dependencies\n * Powershell checks require Powershell version 3.0 or higher.\n\n## Troubleshooting\n* Failures to pull counter data with messages like below, might be due to corrupt performance counters. See [Here](https://support.microsoft.com/en-us/help/2554336/how-to-manually-rebuild-performance-counters-for-windows-server-2008-6) for more information.  Short answer on fix is `lodctr /R` in an Admin elevated command prompt\n\n`Check failed to run: undefined method length' for nil:NilClass, \"c:/opt/sensu/plugins/check-windows-ram.rb:45:inacquire_ram_usage'\", \"c:/opt/sensu/plugins/check-windows-ram.rb:54:in run'\", \"c:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.`\n\n## Testing\n\n### Installation and Updates\n\nWindows Platform testing is moving to Pester as Powershell is the native language for the OS.\n\nAll tests should be written using Pester 4 syntax. For the differences please read [this](https://github.com/pester/Pester/wiki/Migrating-from-Pester-3-to-Pester-4)\n\nIn Windows 10 v1809 and higher, you first need to cleanup the default Pester module and only then you can proceed with the installation of higher version of Pester module.\n\n```powershell\n$module = \"C:\\Program Files\\WindowsPowerShell\\Modules\\Pester\"\ntakeown /F $module /A /R\nicacls $module /reset\nicacls $module /grant Administrators:'F' /inheritance:d /T\nRemove-Item -Path $Module -Recurse -Force -Confirm:$false\n\nInstall-Module -Name Pester -Force\n```\n\nFor any subsequent update it is enough to run:\n\n```powershell\nUpdate-Module -Name Pester\n```\n\n### Running Tests\n\nFrom the root directory run\n\n```powershell\nInvoke-Pester\n```\n\n## Installation\n\n[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensu-plugins%2Fsensu-plugins-windows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsensu-plugins%2Fsensu-plugins-windows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensu-plugins%2Fsensu-plugins-windows/lists"}