Question

UNKNOWN: Command error: Exchange NRPE plugin check DATABASES

  • 21 September 2022
  • 7 replies
  • 258 views

Badge +1

Hi,

I have added two Exchange servers with the NRPE plugin.

For some reason the Databases’ check returns the error below:

UNKNOWN: Command error:

I actually use the same plugin/check on other Exchange servers without any issues.

There are no details on the error even if I run it from the poller itself

Any idea on this?

Thanks


7 replies

Userlevel 5
Badge +13

hello, 

Can you run the plugin locally on the exchange server? you should have a “centreon_plugins.exe” somewhere in your nsclient folder (usually “C:\Program Files\centreon-nsclient\NSClient++\scripts\centreon” if you did the setup of nsclient provided by centreon)

(also you may need to update this executable with the latest/current version, it is regurlaly updated with the github repository of the centreon plugins)

 

normally this command is running like on the linux poller so “centreon_plugins.exe --plugin=$ARG1$ --mode=$ARG2$ …..”

your check should look like “.\centreon_plugins.exe --plugin=apps::microsoft::exchange::local::plugin --mode=databases …...”, 

replace “...” by your check options (look at what your check is running from the poller, beware the centreon plugin is a wrapper for the linux command line, so there should be some quotes you have to remove

 

the point is : is the plugin.exe running correctly on the server, is it present on the server, can it work without issue (it unpacks a lot of perl file in c:\windows\temp, some antivirus don’t like that)

 

it should also help to run the check with  --debug and --verbose that return more information on the local windows than trough the check_nrpe on the poller

 

hope that helps you to identify where the problem lies

Badge +1

Thanks for the tips!

I will give it a shot and let you know

Badge +1

So I just ran into it and I have more details on

UNKNOWN: Command error: #< CLIXML - <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><S S="Error">You cannot call a method on a null-valued expression._x000D__x000A_</S><S S="Error">At line:110 char:5_x000D__x000A_</S><S S="Error">+     $item.size = $DB.DatabaseSize.ToBytes().ToString()_x000D__x000A_</S><S S="Error">+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~_x000D__x000A_</S><S S="Error">    + CategoryInfo          : InvalidOperation: (:) [], ParentContainsErrorRecordException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : InvokeMethodOnNull_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>

So I will look into it 

I don’t know if this is because the database is in a DAG

Badge +5

So I just ran into it and I have more details on

UNKNOWN: Command error: #< CLIXML - <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><S S="Error">You cannot call a method on a null-valued expression._x000D__x000A_</S><S S="Error">At line:110 char:5_x000D__x000A_</S><S S="Error">+     $item.size = $DB.DatabaseSize.ToBytes().ToString()_x000D__x000A_</S><S S="Error">+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~_x000D__x000A_</S><S S="Error">    + CategoryInfo          : InvalidOperation: (:) [], ParentContainsErrorRecordException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : InvokeMethodOnNull_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>

So I will look into it 

I don’t know if this is because the database is in a DAG

Hey gael.regina,

did you ever find a solution. I seem to have run into the same issue.

Badge

Try running the NRPE command manually from the command line on the Exchange servers. This can help you identify if the issue is specific to the NRPE execution or if it's related to the Nagios server.

/path/to/nrpe -H localhost -c command_name

Replace "/path/to/nrpe" with the actual path to the NRPE executable and "command_name" with the specific command you are trying to execute doing crm data enrichment.

If the NRPE command runs successfully manually but still returns an "UNKNOWN: Command error" when executed from Nagios, check the plugin's output. The plugin might be encountering an issue when running in the Nagios environment. Capture the plugin output to understand what's causing the problem.

Userlevel 5
Badge +13

hi,

this was during my christmas break and I totally missed the answers above, sorry for the late reply

what I can see from the output, the underlying powershell script that the centreon plugin is  running has a problem with this 

$item.size = $DB.DatabaseSize.ToBytes().ToString()

saying there is a null value somewhere, probably the $DB variable, or the DatabaseSize property

 

let’s unwind from the source (in perl encapsulating some powershell) : https://github.com/centreon/centreon-plugins/blob/e856a05984916e70dafceefd4bc9663b650882d9/src/centreon/common/powershell/exchange/databases.pm#L78

this is basically what the script does, it gets the database in list, and then get the information it needs to process them later, here I took the relevant part, remove any filtering and just print the output

$MountedDB = Get-MailboxDatabase -Status
Foreach ($DB in $MountedDB) {
write-host "**debug item.database = $($DB.Name)"
write-host "**debug item.server = $($DB.Server.Name)"
write-host "**debug item.mounted = $($DB.Mounted)"
write-host "**debug item.size = $($DB.DatabaseSize.ToBytes().ToString())"
write-host "**debug item.asize = $($DB.AvailableNewMailboxSpace.ToBytes().ToString())"
}

 

on the only exchange 2016 server I still manage (all my clients have gone on o365) this is not working, because I think microsoft changed something on the way “databasesize” works :

$DB.DatabaseSize will return a string, not a magic value where you can get the bytes/MB/GB automatically with the “.ToBytes()” or “.ToGB()” 

 

but the message is different on your case, it’s a null value error, not a “method not found” error.

 

could you try to run the snippet above in the powershell for exchange , 

it should print 5 line for each Database, I got only 1 Db, so it printed the name, the servername, the mounted  status, then 2 error for the 2 size

can you check if you get a similar error 

 

and also this line

$MountedDB[0].DatabaseSize | GM

look for all the “typename”

in my case, it says only system.string on the “databasesize” properties.

Userlevel 5
Badge +13

and I found a windows 2019/exch2019 still running somewhere

 

the last command I gave above returns correctly the information of size and TypeName of the property is not string

 

and I have no errors running the debug snippet 

no “null value” or no method missing.

so what is your OS version and Exchange version ? 

Reply