PrtgAPI: Create a SNMP Custom Table Sensor Error

What’s going on?

Hello

I’m trying to create a snmpcustomtable sensor and filter what I want to select.

Here’s the code that’s giving me a hard time.

$device = get-device -name XXX
$device | get-sensortarget -rawType "snmpcustomtable" -QueryParameters @{
    "tableoid" = "1.3.6.1.2.1.31.1.1"
} -Timeout 5000 -ErrorAction Stop

I get the following error when I run the code above:

get-sensortarget : Cannot guess sensor target table: multiple tables found. Available tables: snmptable__check, columns__check, identcolumn, channel1column, channel1valuelookup, channel2column, 
channel2valuelookup, channel3column, channel3valuelookup, channel4column, channel4valuelookup, channel5column, channel5valuelookup, channel6column, channel6valuelookup, channel7column, channel7valuelookup, 
channel8column, channel8valuelookup, channel9column, channel9valuelookup, channel10column, channel10valuelookup.
In Zeile:1 Zeichen:11
+ $device | get-sensortarget -rawType "snmpcustomtable" -QueryParameter ...
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-SensorTarget], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,PrtgAPI.PowerShell.Cmdlets.GetSensorTarget

Here’s what PRTG outputs if I do it manual in the webinterface: SNMPCustom-Table

I would of expected some sort of array with objects inside of it to iterate over them.

What am I missing? Or is this maybe a bug?

Best regards

Noah

Due Dilligance

  • It wasn’t covered by the wiki, I swear!
  • I have tried doing some basic research on this issue but haven’t been able to come up with anything. Please help!

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 18 (4 by maintainers)

Most upvoted comments

Hi @noaboa97 I tested with a table more than one entry. On GUI: image before PowerShell Module commands: image

$deviceID = 58352
$param = Get-Device -id $deviceID | New-SensorParameters -RawType snmpcustomtable -QueryParameters @{"tableoid"="1.3.6.1.4.1.2011.5.25.31.1.1.10.1"} -Timeout 180                               
$param.Name = "My new Fan Sensor"
$param.snmptable__check = $param.targets.snmptable__check
$param.columns__check= $param.targets.columns__check
$param.channel1name  = "Fan 1"
$param.channel1snmptype = "float"
$param.channel1unit = "count"
$param.identcolumn = $param.Targets.identcolumn | Where-Object {$_.Name -match "^1.3.6.1.4.1.2011.5.25.31.1.1.10.1.1$"}
$param.channel1column= $param.Targets.channel1column| Where-Object {$_.Name -match "^1.3.6.1.4.1.2011.5.25.31.1.1.10.1.2$"}
Get-Device -id $deviceID | Add-Sensor $param

Name                         Id     Device               Group                     Probe                 Status
----                         --     ------               -----                     -----                 ------
My new Fan Sensor            58354  TEST Huawei Switch   LAN Service               PROBE01               Unknown
My new Fan Sensor            58355  TEST Huawei Switch   LAN Service               PROBE01               Unknown
My new Fan Sensor            58356  TEST Huawei Switch   LAN Service               PROBE01               Unknown
My new Fan Sensor            58357  TEST Huawei Switch   LAN Service               PROBE01               Unknown

After PowerShell commands: image In my case, this is also working with more than one entry in Table.