Skip to content

Add basic check plugins - #22

Merged
LordHepipud merged 6 commits into
mainfrom
feature/plugins-cpu-service-partition
Nov 16, 2026
Merged

LordHepipud merged 6 commits into
mainfrom
feature/plugins-cpu-service-partition

Conversation

@fthomys

@fthomys fthomys commented Oct 2, 2026

Copy link
Copy Markdown
Member

Adds the CPU, Service, PartitionSpace, Memory, Directory, Uptime and PerfCounter plugins on top of IcingaPlugin, with providers, tools and return codes.

All plugins read every data source once, use no script blocks (JEA, speed) and report failed queries as UNKNOWN with the reason. Counters are declared as literals, so the daemon has them warm from the start.

  • CPU: reads \Processor Information(*) once. The instance name , gives the NUMA node, cores are numbered across nodes. Node total and overall load are the mean of the cores, the Windows _Total instances are ignored because they are sampled at a different time (13.39 vs 13.84 on one node).
  • Service: one Win32_Service query, states and start types as enums. Without -Service all automatic services are checked, a stopped one with exit code 0 counts as OK. -OverrideNotOk only applies to services that are not OK.
  • PartitionSpace: new Get-IcingaDiskInformation provider with volume, partition and physical disk data. Values in bytes against the volume size, so 80%, 400GB and 10%: work. C, C: and C:\ all match.
  • Memory: Available Bytes and Pages/sec in one counter read. The page file size is the configured maximum or the allocated size, the old plugin reported 0 for system managed page files.
  • Directory: new Get-IcingaDirectoryInformation provider. Filters are converted once and the folder is scanned in a single pass, the old plugin ran one Where-Object per filter and a Get-Item per file. C:\Windows\Microsoft.NET: 812 ms to 95 ms on 5.1, 1210 ms to 141 ms on PS7. All filters are combined with AND and SmallestFile is now correct (was always 0).
  • Uptime: reads \System\System Up Time, prints 1d 2h 3m 4s and the last boot time.
  • PerfCounter: one read for all counters. The unit is taken from the counter (%, s for timers, B for bytes). The label is ::ifw_perfcounter::, before it was only the instance and labels collided.
  • Tools: Get-IcingaWindowsInformation (CIM access without throwing), ConvertTo-IcingaSortedArray (natural sort without script blocks), Test-IcingaArrayFilter.

@cla-bot cla-bot Bot added the cla/signed CLA is signed by all contributors of a PR label Oct 2, 2026
@fthomys
fthomys requested a review from LordHepipud October 2, 2026 13:35
@fthomys
fthomys force-pushed the feature/plugins-cpu-service-partition branch 2 times, most recently from 021e7d6 to 388dca3 Compare October 2, 2026 14:41
@LordHepipud
LordHepipud force-pushed the feature/plugins-cpu-service-partition branch from 388dca3 to 53e707a Compare October 23, 2026 15:38
@LordHepipud
LordHepipud force-pushed the feature/plugins-cpu-service-partition branch from 53e707a to 416ed67 Compare November 11, 2026 18:02
fthomys and others added 3 commits November 13, 2026 10:25
…fort methods

- Add Invoke-IcingaCheckScheduledTask plugin, Get-IcingaScheduledTask provider, IcingaScheduledTaskStatus lookup class and unit tests
- Add ScheduledTaskQueryFailed internal exit code (2500) in Set-InternalExitCodes
- Enhance Test-IcingaArrayFilter to accept a single value or an array via -Value
- Refactor all 9 check plugins (CPU, Directory, Memory, PartitionSpace, PerfCounter, Process, ScheduledTask, Service, Uptime) to use IcingaPlugin comfort features (.SetHidden(), .SetNoPerfData(), .SetState(), .SetNotice(), .Translate(), .AddMissingChecks() with string states, and root-level NoPerfData inheritance)
- Update Directory and Uptime unit tests for notice summary exclusions and enforce code styling across all branch files
@LordHepipud
LordHepipud force-pushed the feature/plugins-cpu-service-partition branch from 416ed67 to 1476502 Compare November 13, 2026 09:27
- Reorganize src/Plugins/ into Checks/Public, Lib/Private and Provider/<Topic>/Private (removing top-level src/Provider/) so all plugin components live under one domain folder consistent with src/Core/
- Move New-IcingaPlugin and all Get-Icinga* providers from Public/ to Private/ so only executable Invoke-IcingaCheck* cmdlets are exported into the user session and internal helpers/providers are comment-stripped in the compiled kernel
- Restore Disk (4300-4350), Directory (4400-4450) and Process (4500-4550) provider return-code entries in Set-InternalExitCodes alongside ScheduledTask (4600-4650)
- Move Pester test helpers into BeforeAll in Get-IcingaScheduledTask.Tests.ps1 and Invoke-IcingaCheckScheduledTask.Tests.ps1 for Pester 5 Run-phase scope, and run New-IcingaPlugin.Tests.ps1 calls in module scope
- Update plugin developer guides with the new src/Plugins/ paths and regenerate API reference documentation
@LordHepipud
LordHepipud force-pushed the feature/plugins-cpu-service-partition branch from 4220021 to 8515dd1 Compare November 13, 2026 12:40
- Require macros.ifw_api_command via Resolve-IcingaProtocolCommand, expand shorthand check names to Invoke-IcingaCheck* cmdlets, and restrict external binaries and scripts strictly to Get-ModuleBinaryDirectory() without consulting $env:PATH
- Parse both ifw-api structured arguments and fallback custom variables in ConvertFrom-IcingaProtocolMacros while preserving case-distinct CLI flags, converting booleans and SecureString secrets safely across Windows PowerShell 5.1 and PowerShell 7+, and masking secrets in rendered command lines
- Execute PowerShell checks and external .ps1 scripts in-process via & (relying on worker thread housekeeping for timeouts) and launch native executables/batch scripts via System.Diagnostics.Process with check_timeout enforcement, descendant process-tree termination, and Nagios/Icinga perfdata splitting
- Measure full check resolution and execution duration monotonically in Start-IcingaProtocolWorker, omit empty service fields on Host CheckResult payloads, and fix local timezone drift in Get-IcingaUnixTime using UTC epoch timestamps
- Register internal return codes 4004 and 50020-50025, add IWKB001000-IWKB001003 Knowledgebase articles, protocol developer documentation, branch task artifacts, regenerated API reference docs, and Pester unit test suites
… harden plugins

- Extract reusable dictionary, CommandLineToArgvW quoting, parameter-map/coercion, and in-process PowerShell execution helpers into src/Tools/Private/ alongside focused macro, external-script, binary-process, and process-tree helpers in src/IcingaProtocol/Private/
- Promote New-IcingaPlugin from src/Plugins/Lib/Private/ to src/Plugins/Lib/Public/ as the public plugin SDK entrypoint while keeping Get-Icinga* providers private
- Cache Get-PSCallStack command detection in Private.Icinga.ActiveCheckCommand across child nodes and reset deterministically in Compile(), Invoke-ModulePowerShellCommand, and Start-IcingaProtocolWorker
- Add Core, OverallOnly, and NodeFilter/SocketFilter support in Invoke-IcingaCheckCPU, multi-status IcingaServiceStatus[] evaluation in Invoke-IcingaCheckService, Windows Scheduler 267009/267011 and 32-bit HRESULT hex handling in Invoke-IcingaCheckScheduledTask, and edge-case guards across PartitionSpace, Memory, Uptime, Disk, Directory, and macros
- Harden Start-IcingaPerformanceCounterDaemon timeout response-queue handoff and BOM-less UTF-8 cache persistence, regenerate API and developer documentation, and expand Pester unit test coverage

@LordHepipud LordHepipud left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

@LordHepipud
LordHepipud merged commit 3f7fa6e into main Nov 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla/signed CLA is signed by all contributors of a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants