Send or output performance data from Powershell script?

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

Send or output performance data from Powershell script?

Postby riahc3 » Mon May 31, 2021 5:28 am

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

Re: Send or output performance data from Powershell script?

Postby mcapra » Wed Jun 02, 2021 12:16 pm

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

Re: Send or output performance data from Powershell script?

Postby riahc3 » Thu Jun 17, 2021 5:05 am

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: 38
Joined: Thu Apr 05, 2018 9:36 am

Re: Send or output performance data from Powershell script?

Postby riahc3 » Thu Jun 17, 2021 5:15 am

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

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

Re: Send or output performance data from Powershell script?

Postby riahc3 » Thu Jun 17, 2021 5:17 am

One variable is being picked up as performance data
riahc3
 
Posts: 38
Joined: Thu Apr 05, 2018 9:36 am


Return to Community Support

Who is online

Users browsing this forum: Google [Bot], rob2791 and 37 guests