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

API Location Inheritance

Votes:

0

What would the call be to set location inheritance to on and off?

I have tried the following:

/api/setobjectproperty.htm?id=groupID&name=location_&value=0

/api/setobjectproperty.htm?id=groupID&name=location_&value=1

Do I have the right name? Neither of those will change the setting on the group ID that is given.

api inheritance location

Created on Mar 26, 2018 3:05:19 PM



4 Replies

Accepted Answer

Votes:

1

Location inheritance is controlled via the locationgroup property

$id = 1001

Invoke-WebRequest http://prtg.example.com/editsettings?id=$id&locationgroup=0&username=prtgadmin&passhash=12345678

You can identify the correct name for any property by inspecting the name attribute of its input tag in the underlying HTML

Regards,

lordmilko

Created on Mar 27, 2018 5:00:24 AM



Votes:

0

Sorry for my ignorance but... How do I "inspect the name attribute of its input tag in the underlying HTML"?

Created on Mar 28, 2018 2:52:33 PM



Votes:

0

Thanks lordmilko. I have been using your PowerShell PRTGAPI module. How would I make this change using one of your powershell commands?

Created on Mar 28, 2018 2:59:47 PM



Votes:

1

Get-Device -Id 1234 | Set-ObjectProperty InheritLocation $false

You can view all device and group properties modifiable with PrtgAPI by doing

Get-Help ObjectSettings

To identify the name attribute of HTML input tags, in Chrome press Ctrl+Shift+J, click the selector button (top left button in the window that opens) and select the element on the page you wish to inspect. You can also get an idea as to the raw names of things with PrtgAPI

C:\> Get-Device -Id 1234 | Get-ObjectProperty -Raw

name                                 : dc-1
active                               : 1
ipversion                            : 0
host                                 : 192.168.0.1
hostv6                               :
tags                                 : C_OS_Win
deviceicon                           : c_os_win.png
serviceurl                           : http://192.168.0.1
discoverytype                        : 1
devicetemplate                       : 0
devicetemplate__check                : 0
locationgroup                        : 1
...

As a general rule, the raw name of a property is whatever is output by Get-ObjectProperty -Raw plus an underscore at the end (unless the property is an inheritance property, which typically end in "group"). So the raw property of the name field is "name_", while location inheritance is just "locationgroup"

Regards,

lordmilko

Created on Mar 28, 2018 8:25:58 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.