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
Send or output performance data from Powershell script?
-
- Posts: 73
- Joined: Thu Apr 05, 2018 9:36 am
-
- Posts: 3739
- Joined: Thu May 05, 2016 3:54 pm
Re: Send or output performance data from Powershell script?
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?riahc3 wrote:I see it as blank.
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/
https://www.mcapra.com/
-
- Posts: 73
- Joined: Thu Apr 05, 2018 9:36 am
Re: Send or output performance data from Powershell script?
The performance data.mcapra wrote: What is "it"?
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.
-
- Posts: 73
- Joined: Thu Apr 05, 2018 9:36 am
Re: Send or output performance data from Powershell script?
Putting each label with single quotes AND putting a ; , gives even worst results:
Performance Data: 'spaceusagepercentage'=63;0;0;0;0
Performance Data: 'spaceusagepercentage'=63;0;0;0;0
-
- Posts: 73
- Joined: Thu Apr 05, 2018 9:36 am
Re: Send or output performance data from Powershell script?
One variable is being picked up as performance data