lordmilko / PrtgAPI

C#/PowerShell interface for PRTG Network Monitor
MIT License
301 stars 37 forks source link

get-device -id 12312 | get-sensor -tag pingsensor | Get-NotificationTrig ... #308

Closed carsten0407 closed 2 years ago

carsten0407 commented 2 years ago

What's going on?

Hi Lord,

since yesterday we can no longer access the trigger notification via API with a Read/Write user (no admin-user) We updated yesterday from version 22.1.75.1588+ to version 22.3.79.2108+.

This query still works on our other two core servers (version 22.1.75.1588+)

get-device -id 12312 | get-sensor -tag pingsensor | Get NotificationTrig...

Get-NotificationTrigger : Response status code does not indicate success: 403 (Forbidden). At line:1 char:61

thx

Carsten

Due Dilligance

lordmilko commented 2 years ago

PrtgAPI needs to execute an API request against /controls/objectdata.htm?id=810 (which retrieves the web server options) to determine whether your PRTG server is using English or not; if not, it uses a slower code path (that executes many more API calls) in order to be compatible with non-English versions of PRTG

If this was working previously, it would seem that PRTG now restricts access to the web server options to admin users only. I can confirm that retrieving notification triggers still works when requesting as an admin user.

I can potentially look into modifying PrtgAPI to assume the server is not using English (and therefore default to taking the slower code path) when not using an admin user, however in the meantime to work around this you will need to use an admin user

lordmilko commented 2 years ago

Hi @carsten0407,

I have pushed a commit that I believe should resolve this issue. Can you please follow the manual installation instructions and advise whether you're able to retrieve notification triggers as a non-admin user using PrtgAPI 0.9.18-preview.7?

carsten0407 commented 2 years ago

Hi LordMilko,

it works with the new PrtgAPI 0.9.18-preview.7? No error message anymore

Thanx