New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Adding Multiple Disk Drives with PRTG API

Votes:

0

Your Vote:

Up

Down

Hi,

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'; }

Thanks

api disk-free prtg

Created on Dec 12, 2019 6:16:02 PM by  jbowser (0) 1



2 Replies

Accepted Answer

Votes:

0

Your Vote:

Up

Down

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

Regards,

lordmilko

Created on Dec 13, 2019 6:50:05 AM by  lordmilko (1,592) 2 1



Votes:

0

Your Vote:

Up

Down

Thanks, the -Target parameter worked!

Created on Dec 13, 2019 12:39:55 PM by  jbowser (0) 1



Please log in or register to enter your reply.


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.