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

PrtgAPI Treating [ ] in Object Name As Wildcard Expression #255

Open
Dreystein opened this issue Dec 17, 2021 · 3 comments
Open

PrtgAPI Treating [ ] in Object Name As Wildcard Expression #255

Dreystein opened this issue Dec 17, 2021 · 3 comments
Labels
bug Issues that have been confirmed to be bugs in PrtgAPI and will be fixed in a future version

Comments

@Dreystein
Copy link

Describe the bug

Hello,

get-sensor:
Seems there is a Parsing Problem of the Name Property (maybe the device also). Maybe its a Problem with Brackets)

example is below

PRTG:
PRTG Version PRTG Network Monitor 21.4.73.1656 x64
Operating SystemMicrosoft Windows Server 2019 Datacenter (10.0 Build 17763), 16 CPUs (16x x64 Model 63 Step 0), code page "Windows-1252", on VMware

Under some circumstances when get-sensor throw an error it will deliver all Sensors. When you alter the Data with a piped set-ObjectProperty all Sensor Data will be overwritten not only the one you tried too ...

But anyway thanks for this very good solution to access and chance the Data on PRTG. You made my day when i discovered this program.

Thanks
Heiko

Steps to reproduce

[DBG]: PS Y:\>> get-sensor -Device $Dev
Name                         Id     Device               Group                     Probe      Status
----                         --     ------               -----                     -----       -----
PING                         24496  esxgi02              VMWare Hosts              Probe        Up            
esxgi02 Host Performance]    24497  esxgi02              VMWare Hosts              Probe        Up            
esxgi02 [Hardware Status]    24498  esxgi02              VMWare Hosts              Probe        Up            
HTTPS                        24501  esxgi02              VMWare Hosts              Probe        Up            

[DBG]: PS Y:\>> get-sensor -Name "esxgi02 [Hardware Status]"
<no result>

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

PSVersion      : 5.1.17763.2268
PSEdition      : Desktop
OS             : Microsoft Windows Server 2019 Datacenter
PrtgAPIVersion : 0.9.16
Culture        : de-DE
CLRVersion     : .NET Framework 4.7.2 (461814)
PrtgVersion    : 21.4.73.1656
PrtgLanguage   : english.lng

Additional context

No response

@Dreystein Dreystein added the alleged-bug Bugs raised by people helpfully using the Bug Report template! label Dec 17, 2021
@lordmilko lordmilko added issue-external Issues to do with systems outside of PrtgAPI's control and removed alleged-bug Bugs raised by people helpfully using the Bug Report template! labels Dec 20, 2021
@lordmilko
Copy link
Owner

Correction to my earlier message, this is actually as a result of how PowerShell treats wildcards.

Typically when people talk about "wildcard characters" in PowerShell are usually referring to the * character, which is the only character that is used in 99.99% of cases, and indeed is the only character PrtgAPI supports in its wildcard processing logic. However, PowerShell actually supports a whole range of wildcard characters, including the [ ] combination. As a result, When you filter for a name containing text inside [ ] PowerShell's wildcard filter (invoked by PrtgAPI) filters out the result returned from PRTG, which isn't what you want in this scenario.

If you absolutely must filter for this sensor by name, your best bet would be to do it like so

flt name eq "esxgi02 [Hardware Status]" | Get-Sensor

For more information on creating custom filters, please see the wiki

@lordmilko lordmilko added wontfix Most problems are solvable. If it ever comes to this, you know we're in trouble and removed issue-external Issues to do with systems outside of PrtgAPI's control labels Dec 20, 2021
@lordmilko lordmilko changed the title Parsing Error at get-sensor PrtgAPI Treating [ ] in Object Name As Wildcard Expression Dec 20, 2021
@lordmilko lordmilko added bug Issues that have been confirmed to be bugs in PrtgAPI and will be fixed in a future version and removed wontfix Most problems are solvable. If it ever comes to this, you know we're in trouble labels Dec 20, 2021
@lordmilko
Copy link
Owner

I've had a look into this a little further and have found a way PrtgAPI may be able to work around this in a future release; for the meantime however you should be able to get by by using the workaround described above

@Dreystein
Copy link
Author

Hi there,

thanks for your efforts, i think my approach was anyway wrong and i solved the problem of searching for a known sensor through the sensors id. this approach makes more sense because of the clarity Identity of the Sensor.

And thank you again for your great api. it makes many of my ideas possible

Regards
Heiko

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

2 participants