check_veeam_repo.ps1 Returns Parameter Errors

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Post Reply
rj-admin2
Posts: 3
Joined: Thu Apr 11, 2024 1:16 am

check_veeam_repo.ps1 Returns Parameter Errors

Post by rj-admin2 »

Hi All,

New here and just trying to find my feet. So, I am trying to use Nagios XI to monitor used space on our Veeam backup repositories. I downloaded the Powershell script: "check_veeam_repo.ps1" from Nagios Exchange. I'm trying to run it remotely on the Veeam server using NCPA (this is already working as I monitor CPU, Memory Disk etc). However when I add the service for VEAAM Repositories, I get the following error:

C:\Program Files (x86)\Nagios\NCPA\plugins\check_veeam_repo.ps1 : Cannot process command because of one or more
missing mandatory parameters: warningPercent criticalPercent.
+ CategoryInfo : InvalidArgument: (:) [check_veeam_repo.ps1], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingMandatoryParameter,check_veeam_repo.ps1

The command looks like:

Check command: check_xi_ncpa
Command view: $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
$ARG1$: -t 'NCPA Password' -P 5693 -M 'plugins/check_veeam_repo.ps1' -w '85' -c '90'

Like I've already said, I know the NCPA setup is correct as it's already in use, and this service definition is a copy/clone of another one that is working correctly.

I'm kind of stumped. Can anyone help?

TIA.
bbahn
Posts: 113
Joined: Thu Jan 12, 2023 5:42 pm

Re: check_veeam_repo.ps1 Returns Parameter Errors

Post by bbahn »

Hello @rj-admin2,

Have you checked whether it works in NCPA? Try visiting https://[your_ncpa_ip_address]:5693/api/ and test your plugin in the interface to narrow down where the failure is coming from.
April: Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
rj-admin2
Posts: 3
Joined: Thu Apr 11, 2024 1:16 am

Re: check_veeam_repo.ps1 Returns Parameter Errors

Post by rj-admin2 »

Many thanks for the suggestion.

Having run through this and rejigged the expected parameters, I'm now presented with the following output:

"returncode": 3,
"stdout": "Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.\nAt C:\\Program Files (x86)\\Nagios\\NCPA\\plugins\\check_veeam_repo.ps1:33 char:1\n+ Add-PSSnapin VeeamPSSnapin\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~\n + CategoryInfo : InvalidArgument: (VeeamPSSnapin:String) [Add-PSSnapin], PSArgumentException\n + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand\n \nUNKNOWN - Missing VeeamPSSnaping"

As far as I know, the PS "extensions" for Veeam are installed already, by default. So really not sure what is going on here?

TIA.
bbahn
Posts: 113
Joined: Thu Jan 12, 2023 5:42 pm

Re: check_veeam_repo.ps1 Returns Parameter Errors

Post by bbahn »

@rj-admin2,

Even if the extensions are installed, if they aren't registered properly, they may not work. Try running

Code: Select all

Get-PSSnapin -Registered
and see if the Veeam snap-in is listed.

If not, the Veeam snap-in is not registered nad you will need to manually register it. You can typically find the PowerShell snap-in file (a .psd1 or .dll file) in the Veeam installation directory. Once located, you can register it using the Install-Util command or via the Add-PSSnapin command if you find the specific .dll.

If that doesn't work, you may need to reinstall Veeam, try again and/or contact Veeam support.
April: Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
rj-admin2
Posts: 3
Joined: Thu Apr 11, 2024 1:16 am

Re: check_veeam_repo.ps1 Returns Parameter Errors

Post by rj-admin2 »

Many thanks for this.

I was playing about yesterday and upgraded NCPA to v3.0.2. I can now run the script locally within PS. So, I have to assume everything I need is installed and working. Although the "Get-PSSnapin -Registered" command still shows nothing.

When I run the script from the NCPA gui/api browser page, I get:

"returncode": -1,
"stdout": "Error: Plugin command (powershell -ExecutionPolicy Bypass -File C:\\Program Files\\Nagios\\NCPA\\plugins\\check_veeam_repo - orig.ps1 '-w=90 -c=95') timed out. (59 sec)",
"cmd": "powershell -ExecutionPolicy Bypass -File C:\\Program Files\\Nagios\\NCPA\\plugins\\check_veeam_repo - orig.ps1 '-w=90 -c=95'"

TIA.
bbahn
Posts: 113
Joined: Thu Jan 12, 2023 5:42 pm

Re: check_veeam_repo.ps1 Returns Parameter Errors

Post by bbahn »

It looks like you're running into a timeout. If you update your [plugin directives] plugin_timeout in C:\Program Files\Nagios\NCPA\etc\ncpa.cfg to something higher than 59 seconds, that may fix the problem.
April: Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
Post Reply