Skip to content

Own check fail if name does not start with invoke-icinga #359

@moreamazingnick

Description

@moreamazingnick

as mentioned in https://community.icinga.com/t/own-checks-downt-work-since-i-installed-new-agent-on-windows/7845/8
own checks fail if the name does not start with invoke-icinga.

Expected Behavior

check should execute

Current Behavior

own checks fail if name differs from invoke-icinga*
manual checks failed with newer powershell framework (this worked before)

Possible Solution

if ($CheckCommand.ToLower() -Like 'invoke-icingacheck*') {

use a more generic way

or


replace return with $this.__CheckCommand = "Generic_Icinga_Check";

Steps to Reproduce (for bugs)

  1. write own check Invoke-MyIcingaCheckXYZ
  2. use-icinga
  3. Invoke-MyIcingaCheckXYZ
    or:
  4. $check= New-IcingaCheck -Name "Check" -Value 1
  5. $check.CritIfLowerThan(2)
  6. New-IcingaCheckresult -Check $check-Compile
    fails because there is no checkcommand

Error:
Ausnahme beim Aufrufen von "Compile" mit 0 Argument(en): "Es ist nicht möglich, einen Index auf ein NULL-Array anzuwenden."
In C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20871 Zeichen:16
return $IcingaCheckResult.Compile();
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : ScriptMethodRuntimeException

Context

It should be possible to execute a check manually without inside a psm1 file
It should be possible to execute a checkcommand with a different name

Your Environment

Windows 10
Powershell 5
framework 1.5.2 -1.6

Best regard
Nicolas

Metadata

Metadata

Assignees

Labels

BugThere is an issue present

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions