Page 1 of 1

Send or output performance data from Powershell script?

Posted: Mon May 31, 2021 5:28 am
by riahc3
Hello

I have a Powershell script that I use to monitor some things BUT I want to get performance data out of it.

The output is currently:

Write-host "OK: $uncpath is $spaceusagepercentage% full ($freespace GB free out of $totalspace GB)|spaceusagepercentage=$spaceusagepercentage spacefreepercentage=$spacefreepercentage freespace=$freespace usedspace=$usedspace totalspace=$totalspace"
exit $ok


What exactly is wrong and why isnt it outputing the correct performance data? I see it as blank.

Thanks

Re: Send or output performance data from Powershell script?

Posted: Wed Jun 02, 2021 12:16 pm
by mcapra
riahc3 wrote:I see it as blank.
What is "it"? The Powershell script's output when executed from the Windows host? The results received by check_nt or check_nrpe interacting with the Powershell script? Your Nagios graphs? The performance RRDs?

Here's the specification for performance data in Nagios plugins:
https://nagios-plugins.org/doc/guidelines.html#AEN200

I notice none of your labels are wrapped in single-quotes ' -- that might be the problem if Nagios isn't correctly recognizing the data. You should also delimit your measures with a semi-colon ; -- you just have spaces here. You also should provide a UOM in this case, since it sounds like you're recording percentages rather than integers (but that won't necessarily break anything if you don't).

Re: Send or output performance data from Powershell script?

Posted: Thu Jun 17, 2021 5:05 am
by riahc3
mcapra wrote: What is "it"?
The performance data.

If I run the Powershell script by itself, I see the output correctly and the numbers.

When I go to Nagios XI and try to see the graph of the performance data , I dont see anything.

Yet if I go to the "Advance" tab I see:

Performance Data: 'spaceusagepercentage'=63 'spacefreepercentage'=37 'freespace'=447 'usedspace'=781 'totalspace'=1228

So it is being read and data is being recieved.

But the Performance Graph is completely empty.

Re: Send or output performance data from Powershell script?

Posted: Thu Jun 17, 2021 5:15 am
by riahc3
Putting each label with single quotes AND putting a ; , gives even worst results:

Performance Data: 'spaceusagepercentage'=63;0;0;0;0

Re: Send or output performance data from Powershell script?

Posted: Thu Jun 17, 2021 5:17 am
by riahc3
One variable is being picked up as performance data