Hi:
I wrote a Powershell script to check AD Connect Sync results and the script works fine on the server. I want the script to return multiple lines but I can only get it to return one. My output is here:
write-host "There were errors in the last export"
$objects |out-string | % {write-host $_ }
So, if working it would return the first line and then a small table below it. I can't for the life of me get it to return the table, only that first line. What am I missing here?
Thanks!
NCPA Powershell Output
Re: NCPA Powershell Output
The nagios documentation if you read it says plugins should produce a single line of output. If running the plugin from the shell produces the output you desire, but running it from ncpa via the nagios server doesn't it seems that ncpa is enforcing the nagios requirements.
BTW nrpe will happily produce multi-line output which is displayed in the nxi gui. That doesn't mean that ncpa is misbehaving.
BTW nrpe will happily produce multi-line output which is displayed in the nxi gui. That doesn't mean that ncpa is misbehaving.
Re: NCPA Powershell Output
Hey,
It sounds like there's an issue with how `$objects` is being handled. Try this modified version of your script:
This should output each element of `$objects` on a new line. If it still doesn’t work, the problem might be with how `$objects` is being populated. Keep us updated!
It sounds like there's an issue with how `$objects` is being handled. Try this modified version of your script:
Code: Select all
write-host "There were errors in the last export"
$objects | ForEach-Object {write-host $_}