Send or output performance data from Powershell script?

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.
Locked
riahc3
Posts: 58
Joined: Thu Apr 05, 2018 9:36 am

Send or output performance data from Powershell script?

Post 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
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Send or output performance data from Powershell script?

Post 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).
Former Nagios employee
https://www.mcapra.com/
riahc3
Posts: 58
Joined: Thu Apr 05, 2018 9:36 am

Re: Send or output performance data from Powershell script?

Post 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.
riahc3
Posts: 58
Joined: Thu Apr 05, 2018 9:36 am

Re: Send or output performance data from Powershell script?

Post by riahc3 »

Putting each label with single quotes AND putting a ; , gives even worst results:

Performance Data: 'spaceusagepercentage'=63;0;0;0;0
riahc3
Posts: 58
Joined: Thu Apr 05, 2018 9:36 am

Re: Send or output performance data from Powershell script?

Post by riahc3 »

One variable is being picked up as performance data
Locked