What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags

View all Tags

Compare file size vs hard disk space.



I need to create a sensor that compares if the free disk space is twice the size of a file. I have tried using WMI but I can only see either the disk space or the file size, and I don't know how to perform a mathematical operation for this purpose. I have also tried using a custom EXE/Script sensor with the following code:

On Error Resume Next

Set objFSO = CreateObject("Scripting.FileSystemObject")

'Obtener la información del archivo Arballon_d.mdf
Set objFile = objFSO.GetFile("F:\SQL2K14\Arballon_D.mdf")
dblFileSize = objFile.Size / 1073741824 'Convertir bytes a gigabytes

'Obtener la información del disco F:
Set objDrive = objFSO.GetDrive("F:")
dblFreeSpace = objDrive.FreeSpace / 1073741824 'Convertir bytes a gigabytes

'Comparar el espacio libre con el tamaño del archivo
If dblFreeSpace >= (dblFileSize * 2.5) Then
    WScript.Echo "1"
    WScript.Echo "0" 
End If

"Where the value 1 would be correct and the value 0 would be an error." - but I get an error because the predefined channels are Downtime and Execution Time, and I cannot customize them since version 17.

prtg script vbs wmi

Created on Mar 30, 2023 4:31:13 PM

Last change on Mar 31, 2023 1:04:53 PM by  Felix Wiesneth [Paessler Support]

2 Replies



ya pude solucionarlo
I was able to fix it

Created on Apr 1, 2023 11:53:29 AM

Last change on Apr 3, 2023 7:31:25 AM by  Felix Wiesneth [Paessler Support]



Thank you for the information, you can also share the solution in case other users run into the same issue.

Created on Apr 5, 2023 12:39:41 AM by  Jonathan Mena [Paessler Technical Support]

Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.