lordmilko / PrtgAPI

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

Creating sensors with custom names #393

Closed Dieg12 closed 4 months ago

Dieg12 commented 4 months ago

What's going on?

Hello,

I'm trying to create custom SNMP memory sensors, I used the commands that you described in this issue : https://github.com/lordmilko/PrtgAPI/issues/66 $device = Get-Device "***" $params = $device | New-SensorParameters -RawType snmpmemory -Target *Physical* $params.Name = "Test nom custom" $device | Add-Sensor $params

However, when the sensor is created the name is still the default one for this kind of sensor : image

Maybe I did something wrong and you can help me on that.

Thank you in advance and excuse me if my English is not perfect.

Due Dilligance

lordmilko commented 4 months ago

I believe that certain sensor types may ignore the name you specify. Anything to do with SNMP definitely seems like something that would do that.

You can rename the object after it has been created using the Rename-Object cmdlet

Dieg12 commented 4 months ago

Thank you very much for the answer, does the command Add-Sensor return the newly created sensor so I can modify its properties directly ?

lordmilko commented 4 months ago

Yes

Dieg12 commented 4 months ago

Thank you very much for the quick answer, I use PrtgAPI in my job so thank you for not leaving me stuck for too long :)