Skip to content

Error 2051 and 1553 - executing via REST API #563

@Skeletitor

Description

@Skeletitor

I get the following two errors every time when a MSSQL Check ist executed via REST API

EventID 2051:

Failed to execute API call

An API call could not be processed due to an internal exception.

Object dumps if available:
Cannot process argument transformation on parameter 'SqlPassword'. Cannot create object of type "System.Security.SecureString". "Length" is a ReadOnly property.

EventID 1553:

Failed to query Icinga check over internal REST-Api check handler

A service check could not be executed by using the internal REST-Api check handler. The check either ran into a timeout or could not be processed. Maybe the check was not registered to be allowed for being executed. Further details can be found below.

Object dumps if available:
The remote server returned an error: (500) Internal Server Error.
Invoke-IcingaCheckMSSQLHealth

Name Value


SqlPassword System.Security.SecureString
SqlUsername monitoring
Verbosity 3

SQL COmmands are whitelisted

PS C:\Windows\system32> Show-IcingaRESTApiCommands
API Endpoint "apichecks"
################

Whitelisted: Invoke-IcingaCheck*, Invoke-IcingaCheckMSSQL*, Invoke-IcingaCheckMSSQLHealth

Blacklisted: None
Icinga service conf:

apply Service "MSSQL Health" {
  import "generic-service"
  check_command = "Invoke-IcingaCheckMSSQLHealth"
  max_check_attempts = 3
  check_interval = 5m
  retry_interval = 5m
  enable_flapping = true
  command_endpoint = host_name

  if (host.vars.IcingaCheckMSSQLHealth_Int32_Verbosity) {
    vars.IcingaCheckMSSQLHealth_Int32_Verbosity = host.vars.IcingaCheckMSSQLHealth_Int32_Verbosity
  } else {
    vars.IcingaCheckMSSQLHealth_Int32_Verbosity = 3
  }
  if (host.vars.IcingaCheckMSSQLHealth_String_SqlUsername) {
    vars.IcingaCheckMSSQLHealth_String_SqlUsername = host.vars.IcingaCheckMSSQLHealth_String_SqlUsername
  } else {

    vars.IcingaCheckMSSQLHealth_String_SqlUsername = "USER"
  }
  if (host.vars.IcingaCheckMSSQLHealth_Securestring_SqlPassword) {
    vars.IcingaCheckMSSQLHealth_Securestring_SqlPassword = host.vars.IcingaCheckMSSQLHealth_Securestring_SqlPassword
  } else {

    vars.IcingaCheckMSSQLHealth_Securestring_SqlPassword = "PASSWD"
  }

  assign where host.vars.powershell_framework == true && host.vars.mon_mssql1 == true
}

How is ist possible to debug this? Or is there a missconfiguation? Manual executing works without these errors and without using REST API.
image

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