Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRTG-API does not work anymore since latest PRTG-Server Update #268

Closed
Rottinator opened this issue Feb 15, 2022 · 13 comments
Closed

PRTG-API does not work anymore since latest PRTG-Server Update #268

Rottinator opened this issue Feb 15, 2022 · 13 comments
Labels
bug Issues that have been confirmed to be bugs in PrtgAPI and will be fixed in a future version

Comments

@Rottinator
Copy link

Rottinator commented Feb 15, 2022

Describe the bug

Hello,
we've updated our PRTG version to 22.1.74.1869 from February 1st 2022. Since then write operations via the powershell API does not work anymore. (Changelog: https://www.paessler.com/prtg/history/stable)
PRTG brings only the error message: Could not authenticate to PRTG; the specified username and password were invalid.

I think this may be related to the "Improved Security"-Changset:
image

Steps to reproduce

Sample Code:
`Connect-PrtgServer -Server "http://myserver.de" (New-Credential "someusername" "somepassword");

$device = Get-Device -Id 5555;

$parameters = $device | New-SensorParameters -RawType httpdataadvanced;
`

Results in:
New-SensorParameters : Could not authenticate to PRTG; the specified username and password were invalid.

What is the output of 'Get-PrtgClient -Diagnostic'?

PSVersion      : 5.1.19041.1320
PSEdition      : Desktop
OS             : Microsoft Windows 10 Enterprise
PrtgAPIVersion : 0.9.16
Culture        : de-DE
CLRVersion     : 528372
PrtgVersion    : 22.1.74.1869
PrtgLanguage   : Unknown

Additional context

Read operations like Get-Device or Get-Group still works without problem. Write-Operations like New-SensorParameters or New-Sensor fails

No response

@Rottinator Rottinator added the alleged-bug Bugs raised by people helpfully using the Bug Report template! label Feb 15, 2022
@lordmilko lordmilko added bug Issues that have been confirmed to be bugs in PrtgAPI and will be fixed in a future version and removed alleged-bug Bugs raised by people helpfully using the Bug Report template! labels Feb 15, 2022
@lordmilko
Copy link
Owner

I've managed to replicate this issue; based on my analysis this is only affecting requests pertaining to creating new objects (as these rely on cookies instead to be "authenticated" and don't work when you explicitly specify credentials). I am investigating what exactly I need to do to get these working again

Regards,
lordmilko

@lordmilko
Copy link
Owner

Hi @Rottinator,

I have pushed a new pre-release version of PrtgAPI which should include a fix for this issue

Are you able to try using the manual installation instructions to run the latest pre-release and advise whether the issue is now resolved?

Regards,
lordmilko

@Rottinator
Copy link
Author

Hi @lordmilko

I've downloaded the latest pre-release and the fix worked in all of our constellations.

Thanks for this quick fix!

Regards
Rottinator

@rickyrickuk
Copy link

Hi @lordmilko
I am having a similar issue after updating to the latest PRTG version.
I downloaded the pre-release from the manual link (it still shows 0.9.16 - is that correct?) but after a 'remove-module -Name prtgapi' and then import-module I am still getting the authentication error when trying to create objects.
Could you help please?
Thanks

@Rottinator
Copy link
Author

Hi @rickyrickuk,
thats the wrong one. The correct one is 0.9.17-preview.10, so it looks like you downloaded not the correct one.
I've got the correct one using the following link on the "manual installation instructions", linked from @lordmilko

image

@rickyrickuk
Copy link

rickyrickuk commented Feb 22, 2022

Hi @rickyrickuk, thats the wrong one. The correct one is 0.9.17-preview.10, so it looks like you downloaded not the correct one. I've got the correct one using the following link on the "manual installation instructions", linked from @lordmilko

image

Thanks @Rottinator , that's the link I used, just downloaded again, file is called PRTGAPI.zip and inside the PrtgAPI.psd1 file it says :

Version number of this module.

ModuleVersion = '0.9.16'

Checking my version 👍

_**PS D:\PRTG-Scripts> get-module -Name prtgapi

PS D:\PRTG-Scripts> import-module "D:\PRTG-Scripts\PRTG-0.9.17PRE\prtgapi.psd1"

PS D:\PRTG-Scripts> get-module -name prtgapi

ModuleType Version Name ExportedCommands


Binary 0.9.16 prtgapi {Add-Device, Add-Group, Add-NotificationTrigger, Add-Sensor...}**_

Strange !

Richard

@lordmilko Could you advise what I am doing wrong please? :-)

@SwissJay
Copy link

Hi @rickyrickuk, thats the wrong one. The correct one is 0.9.17-preview.10, so it looks like you downloaded not the correct one. I've got the correct one using the following link on the "manual installation instructions", linked from @lordmilko
image

Thanks @Rottinator , that's the link I used, just downloaded again, file is called PRTGAPI.zip and inside the PrtgAPI.psd1 file it says :

Version number of this module.

ModuleVersion = '0.9.16'

Checking my version 👍

_**PS D:\PRTG-Scripts> get-module -Name prtgapi

PS D:\PRTG-Scripts> import-module "D:\PRTG-Scripts\PRTG-0.9.17PRE\prtgapi.psd1"

PS D:\PRTG-Scripts> get-module -name prtgapi

ModuleType Version Name ExportedCommands

Binary 0.9.16 prtgapi {Add-Device, Add-Group, Add-NotificationTrigger, Add-Sensor...}**_

Strange !

Richard

@lordmilko Could you advise what I am doing wrong please? :-)

You're not doing anything wrong, that version number just didn't get updated. But check the version on fullclr\PrtgAPI.PowerShell.dll, you'll see it shows a file version of 0.9.16.0 but a product version of 0.9.17-preview10...

@lordmilko
Copy link
Owner

Get-PrtgClient -Diagnostic will also show you the version is 0.9.17-preview10

@rickyrickuk
Copy link

Thanks @lordmilko and @SwissJay

I checked the files that I am doing an import module on and the fullclr\PrtgAPI.PowerShell.dll one does show 0.9.17-preview10 but Get-PrtgClient -Diagnostic shows 0.9.16 still :

PS D:\PRTG-Scripts> get-prtgclient -Diagnostic

PSVersion : 5.1.14393.4583
PSEdition : Desktop
OS : Microsoft Windows Server 2016 Standard
PrtgAPIVersion : 0.9.16
Culture : en-GB
CLRVersion : .NET Framework 4.8 (528049)
PrtgVersion : 22.1.74.1869
PrtgLanguage : english.lng

A remove-module prtgapi followed by import-module "D:\PRTG-Scripts\PRTG-0.9.17PRE\prtgapi.psd1" should work shouldnt' it? Or do I need to restart any services or reboot?

@lordmilko
Copy link
Owner

Hi @rickyrickuk,

If you close all instances of PowerShell, then do Remove-Module PrtgAPI, or better yet go into C:\Program Files\WindowsPowerShell\Modules and delete the PrtgAPI folder that will ensure you are not accidentally importing the wrong version somehow

@rickyrickuk
Copy link

Hi @rickyrickuk,

If you close all instances of PowerShell, then do Remove-Module PrtgAPI, or better yet go into C:\Program Files\WindowsPowerShell\Modules and delete the PrtgAPI folder that will ensure you are not accidentally importing the wrong version somehow

Thanks @lordmilko, another instance of ps was running by another user !
All sorted now and auth errors gone too, cheers :-)

@lordmilko
Copy link
Owner

Please be advised PrtgAPI 0.9.17 has now been released

@codepend
Copy link

Thanks @lordmilko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that have been confirmed to be bugs in PrtgAPI and will be fixed in a future version
Projects
None yet
Development

No branches or pull requests

5 participants