lordmilko / PrtgAPI

C#/PowerShell interface for PRTG Network Monitor
MIT License
305 stars 38 forks source link

Get-Probe not returning all probes #180

Closed johanneslatzel closed 4 years ago

johanneslatzel commented 4 years ago

Describe the bug Clearly and concisely describe what you were trying to do, what happened and what you were expecting to happen

In an environment where a core server is also a probe server it seems that Get-Probe will not list the core server as a probe server. When I call Get-Probe all probes except the core (probe) server are returned.

Steps to reproduce Put the relevant code from your application that caused the issue to happen in the code block below call Get-Prtg

# Code goes here!
Get-Probe

What is the output of Get-PrtgClient -Diagnostic?

It tells me that the parameter "Diagnostic" does not exist. Get-PrtgClient returns:

# Output goes here!

Server: [my server name]
Username: [my user name]
PassHash: [my pass hash]
Version: 20.3.62.1397
RetryCount: 1
RetryDelay: 3
LogLevel: Trace, Request

Additional context Anything else I should know to help solve the issue?

lordmilko commented 4 years ago

Hi @johanneslatzel,

This indicates you are using an older version of PrtgAPI that does not support the -Diagnostic parameter. Can you run the following commands and advise whether the XML response contains your core server?

Set-PrtgClient -LogLevel Response

Get-Probe -Verbose

In addition, are you able to advise whether this was working properly in a previous version of PRTG Network Monitor, or the first time you tried this was on your current PRTG version?

johanneslatzel commented 4 years ago

HI @lordmilko,

yesterday I upgraded the Prtg installation to version 20.4.63.1427+ and installed the PrtgApi module version 0.9.13 on all devices which use the api via powershell. This by itself did not solve the problem. After I set the loglevel to Response the probe was still not listed (on the core server). But: If I run Get-Probe on another computer (PrtgApi 0.9.13) the Get-Probe does list the missing probe. So it seems the problem does only occur on the core server. As far as I'm aware the problem occured in previous versions of Prtg too. The sensor I'm trying to fix has been running for a couple of months now and only fails for the one probe that runs on the core server.

lordmilko commented 4 years ago

Hi @johanneslatzel,

That is very strange, I don't know why Get-Probe would return different results depending on which server you run it on. To confirm, you're saying that even when you specified -LogLevel Response, the XML response also did not contain the missing probe?

If you do

Set-PrtgClient -LogLevel All

Get-Probe -Verbose

in PowerShell on the core server, this will show you both the API request and XML response that was retrieved from PRTG. Based on what you've said above, you should find that the XML response is missing your core probe. Then, can you copy and paste the URL that PowerShell was executed into the address bar of your web browser on your core server, and then hit enter and download and open the resulting XML response. Does the XML response from the web browser contain the missing probe?

Finally, are you able to confirm that the ID of your core probe is 1? You can see this in the address bar of your web browser when you click into the probe in the PRTG UI

http://prtg.example.com/probenode.htm?id=1&tabid=1

Can you then run the command Get-Object -Id 1 -Verbose and advise what the output is?

johanneslatzel commented 4 years ago

Ok I tried that and the xml did not contain the probe. But I think I know what the issue actually is. I use different Users on differnt machines, so I tested using different users on the core server and it seems that the user I use on the core server is not able to get the core probe. my admin user on the other hand is able to do that. so it does not depend on the server (or the version) but only depends on which user is used. So I would guess that this is not an issue of PrtgApi but of the user or my prtg configuration.

Thank you very much for your help and sorry if I have wasted your time!

lordmilko commented 4 years ago

Hi @johanneslatzel,

That makes more sense! You can modify these settings in the "Access Rights" section on the Settings page of the object.