Hi, I create a script :

Write-Host "<prtg>"
foreach($volume IN gwmi -ComputerName "127.0.0.1" -Class win32_volume)  
{
    if ($volume.DriveType -eq 3) 
    {
    $Driver =  $volume.DriveLetter
     	$freeSpace  = $volume.freespace/1073741824;
        Write-Host "<result>"
    	Write-Host "<channel>$Driver</channel>"
    	Write-Host "<value>$freeSpace</value>"
    	Write-Host "<float>1</float>"
    	Write-Host "<showTable>1</showTable>"
    	Write-Host "<showChart>1</showChart>"
    	Write-Host "<unit>Go</unit>"
    	Write-Host "<mode>Absolute</mode>"
    	Write-Host "<warning>0</warning>"
    	Write-Host "</result>"
		    
	}
}
Write-Host "<prtg>"

So a don't have a result. Can you help me ?


Article Comments

Hi,
may you post the output of the script when running the same from the powershell?
What error message do you get when using the script in a sensor?
Best regards


Oct, 2012 - Permalink

Hi,

In PRTG sensor I have this:

#O132<prtg> <result> <channel>C:</channel> <value>28.4770202636719</value> <float>1</float> <showTable>1</showTable> <showChart>1</showChart> <unit>Go</unit> <mode>Absolute</mode> <warning>0</warning> </result> <result> <channel>D:</channel> <value>160.713157653809</value> <float>1</float> <showTable>1</showTable> <showChart>1</showChart> <unit>Go</unit> <mode>Absolute</mode> <warning>0</warning> </result> <prtg> 

In Powershell ISE, I have :

<prtg>
<result>
<channel>C:</channel>
<value>29.8896903991699</value>
<float>1</float>
<showTable>1</showTable>
<showChart>1</showChart>
<unit>Go</unit>
<mode>Absolute</mode>
<warning>0</warning>
</result>
<result>
<channel>D:</channel>
<value>235.045532226563</value>
<float>1</float>
<showTable>1</showTable>
<showChart>1</showChart>
<unit>Go</unit>
<mode>Absolute</mode>
<warning>0</warning>
</result>
<prtg>

I want a graph with my drivers C and D informations.

Thank you,


Oct, 2012 - Permalink

Hi,
the leading message "#O132" which you are receiving in PRTG indicates you are using the wrong type of sensor. Please copy your script from \EXE to \EXEXML and use a EXE/Script Advanced Sensor instead of a "normal" EXE/Script Sensor.

Then it should work.

Best regards


Oct, 2012 - Permalink

Edit your last line

write-host "<prtg>"

it should be

write-host "</prtg>"


Nov, 2012 - Permalink

Hello. I migrate an installation of PRTG from one server to another and I have two sensors with this error. Indicate to be replaced according to the type of sensor. But if I create a new sensor, I lose all historical having.

How I can make this change without losing historical data?

thanks


Jan, 2013 - Permalink

@BORJA RODRIGUEZ: In this case you will have to pause the old sensors to have access to the historical data and create new ones for further monitoring.
Best regads


Jan, 2013 - Permalink