You are here

Powershell not getting arguments correctly passed to it through NRPE

3 posts / 0 new
Last post
joes
joes's picture
Powershell not getting arguments correctly passed to it through NRPE

Hi,

I have been writing a custom script using powershell all was going well until i needed to pass arguments to the script. I can run the script fine from cmd line replacing $ARG1$ with the actual argument but doing this from the master monitoring server it is just passing  $ through instead of the argument. below is what i have in my opsera.ini file:

check_file_size=cmd /c echo scripts\File_size.ps1 $ARG1$ $ARG2$ $ARG3$ $ARG4$; exit($lastexitcode) | powershell.exe -command -

and from opsview:

-H $HOSTADDRESS$ -c check_file_size -a 'D:\scripts\jm.html 15 20 KB' -t 180

I have checked the opsview agent log and can see the arguments being received:

2014-03-28 11:54:10: debug:NSClient++.cpp:1144: Injecting: check_file_size: D:\scripts\jm.html 15 20 KB, -t, 180

I have had a little hunt around google but most people are are using the exact same config as what I have set. The only other thing i have found is on nsclients website talking about using wrapped scripts for powershell but this does not appear to be an option within the opsview config.

Has anybody else had any problems wih this and know of any solutions?

Regards Joe

iamwiz82
iamwiz82's picture
Re: Powershell not getting arguments correctly passed to it ...

I've run into this same issue.  Any thoughts?

joes
joes's picture
I didn't get much further

I didn't get much further with this unfortunately