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

Adding Multiple Disk Drives with PRTG API




I'm writing scripts to add devices (servers, specifically) in PRTG. We monitor CPU,memory, and disk drives as a baseline. I can create a C drive just fine, using an example similar to this. https://kb.paessler.com/en/topic/79033-adding-new-sensors-using-prtg-api

The issue is when I need to add a 'D' or 'F' or any other drive letter than C. Me and the Powershell genius of our department can't figure this out. The parameter set for the snmpdiskfree sensor type will only give you C drives.

This is the most common error we get Add-Sensor : PRTG was unable to complete the request. The server responded with the following error: 'The validation of at least one of the new objects failed because of the following: Disk: Required field, not defined. The object was not created.'.

Here's another one Add-Sensor : PRTG was unable to complete the request. The server responded with the following error: Nothing was selected, no sensors could be created.

Do we have to make a raw set of parameters, like so? This hasn't worked. $raw = @{name_ = "Disk L" sensortype = "snmpdiskfree"; priority = "3"; disk_ = "1"; tags_ = 'snmpdiskfreesensor'; disk__check_ = 'L'; }


api disk-free prtg

Created on Dec 12, 2019 6:16:02 PM

2 Replies

Accepted Answer



Hi jbowser,

This is more so a question about PrtgAPI than a question about PRTG itself. As PrtgAPI is a third party product, questions regarding it should generally be raised as issues on GitHub rather than in the Paessler forums.

Looking at your code, I can see why this is not working. First of all, you have labelled your disk check property as "disk__check_" - I feel fairly confident that this should in fact be "disk__check" without the trailing underscore. Secondly, the value you are specifying to this property is simple "L" - usually the value of a sensor target encodes several properties, separated by pipes.

To construct raw sensor parameters it is important you follow the instructions on doing so very carefully, however generally speaking I would recommend *not* using raw sensor parameters, and rather using dynamic sensor parameters instead, which do all the hard work of specifying parameters and providing sensor targets for you.

You should be able to create an snmpdiskfree sensor easily by using code similar to the following

Get-Device -Id 1001 | New-SensorParameters -RawType snmpdiskfree -Target * | Add-Sensor

Please let me know how you go



Created on Dec 13, 2019 6:50:05 AM



Thanks, the -Target parameter worked!

Created on Dec 13, 2019 12:39:55 PM

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.