question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create a SNMP Custom Table Sensor Error

See original GitHub issue

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!

Issue Analytics

  • State:open
  • Created 2 months ago
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
schoenm1commented, Jul 20, 2023

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.

0reactions
noaboa97commented, Jul 20, 2023

I tried again and it’s not working. Same error. I can’t see the error with -verbose.

$device = get-device -id 88195 #87701
$param = $device | New-SensorParameters -RawType snmpcustomtable -QueryParameters @{ "tableoid"          = "1.3.6.1.2.1.31.1.1"} 
$param.Name = "INET Test"
$param.snmptable = $param.targets.snmptable__check
$param.columns__check= $param.targets.columns__check
$param.channel1name  = "Test 1"
$param.channel1snmptype = "float"
$param.channel1unit = "BytesBandwidth"
$param.identcolumn = $param.Targets.identcolumn | Where-Object {$_.Name -like "*Octets*"}
$param.channel1column= $param.Targets.channel1column| Where-Object {$_.Name -like "*Octets*"}

$device | Add-Sensor $param -verbose

Output:

AUSFÜHRLICH: Ausführen des Vorgangs "Add-Sensor" für das Ziel "INET Test (Destination: fw-001 (ID: 88195))".
AUSFÜHRLICH: Add-Sensor: Synchronously executing request 
https://domain/api/table.xml?content=sensors&columns=objid,name,probe,group,favorite,lastvalue,device,downtime,downtimetime,downtimesince,uptime,uptimetime,uptimesince,knowntime,cumsince,last
check,lastup,lastdown,minigraph,schedule,basetype,baselink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&count=*&filter_parentid=88195&filter_type=
snmpcustomtable&username=user&passhash=passhash
AUSFÜHRLICH: Add-Sensor: Synchronously executing request https://domain/controls/addsensor2.htm?id=88195&sensortype=snmpcustomtable&username=user&passhash=passhash
AUSFÜHRLICH: Add-Sensor: Synchronously executing request https://domain/controls/addsensor3.htm?id=88195&tmpid=79&tableoid_=1.3.6.1.2.1.31.1.1
AUSFÜHRLICH: Add-Sensor: Synchronously executing request 
https://domain/addsensor5.htm?name_=INET+Test&priority_=3&inherittriggers=1&intervalgroup=1&interval_=60%7C60+seconds&errorintervalsdown_=1&tags_=snmpcustomsensor+snmpcustomtable&nametemplate
_=&tableoid_=1.3.6.1.2.1.31.1.1&snmptable__check=1%7Cport1%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C%7C&ident=&columns_=1&channel1name_=Test+1&channel1snmptype_=float&channel1customunit_=&usecha
nnel2_=0&channel2name_=&channel2snmptype_=abs&channel2customunit_=&usechannel3_=0&channel3name_=&channel3snmptype_=abs&channel3customunit_=&usechannel4_=0&channel4name_=&channel4snmptype_=abs&channel4customu
nit_=&usechannel5_=0&channel5name_=&channel5snmptype_=abs&channel5customunit_=&usechannel6_=0&channel6name_=&channel6snmptype_=abs&channel6customunit_=&usechannel7_=0&channel7name_=&channel7snmptype_=abs&cha
nnel7customunit_=&usechannel8_=0&channel8name_=&channel8snmptype_=abs&channel8customunit_=&usechannel9_=0&channel9name_=&channel9snmptype_=abs&channel9customunit_=&usechannel10_=0&channel10name_=&channel10sn
mptype_=abs&channel10customunit_=&anti-csrf-token=ZGMwYzQwNTljZDFlNzU3MzVhNTY4ZmJmNmJhOGNjZmJlOWYxMTQ2MjA3MDhlYzkyNmU5N2UzOTJlNzBjYjFlYQ%3D%3D&channel1unit_=BytesBandwidth&channel1valuelookup_=%7CNone&channe
l2column_=%7C%7C0%7C&channel2unit_=Count&channel2valuelookup_=%7CNone&channel3column_=%7C%7C0%7C&channel3unit_=Count&channel3valuelookup_=%7CNone&channel4column_=%7C%7C0%7C&channel4unit_=Count&channel4valuel
ookup_=%7CNone&channel5column_=%7C%7C0%7C&channel5unit_=Count&channel5valuelookup_=%7CNone&channel6column_=%7C%7C0%7C&channel6unit_=Count&channel6valuelookup_=%7CNone&channel7column_=%7C%7C0%7C&channel7unit_
=Count&channel7valuelookup_=%7CNone&channel8column_=%7C%7C0%7C&channel8unit_=Count&channel8valuelookup_=%7CNone&channel9column_=%7C%7C0%7C&channel9unit_=Count&channel9valuelookup_=%7CNone&channel10column_=%7
C%7C0%7C&channel10unit_=Count&channel10valuelookup_=%7CNone&snmptable_=1%7Cport1%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C%7C&snmptable_=2%7Cport2%7C0%7C0%7C0%7C0%7C142150347772%7C256748528%7C0%
7C0%7C52135960056%7C193040126%7C0%7C0%7C1000%7C%7C&snmptable_=3%7Cport3%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C10%7C%7C&snmptable_=4%7Cport4%7C0%7C0%7C0%7C0%7C38537426508%7C138607317%7C0%7C0%7C127
311148726%7C187469088%7C0%7C0%7C1000%7C%7C&snmptable_=5%7Cport5%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C10%7C%7C&snmptable_=6%7Cport6%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C10%7C%7C&snmp
table_=7%7Cport7%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C10%7C%7C&snmptable_=8%7Cport8%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C10%7C%7C&snmptable_=9%7Cport9%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C
0%7C0%7C0%7C0%7C0%7C10%7C%7C&snmptable_=10%7Cport10%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C10%7C%7C&snmptable_=11%7Cport11%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C10%7C%7C&snmptable_=12%
7Cport12%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C10%7C%7C&snmptable_=13%7Cport13%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C0%7C10%7C%7C&columns__check=%7C%7C0%7C&columns__check=1.3.6.1.2.1.31.1
.1.1.1%7CifName%7C1%7C&columns__check=1.3.6.1.2.1.31.1.1.1.2%7CifInMulticastPkts%7C2%7C&columns__check=1.3.6.1.2.1.31.1.1.1.3%7CifInBroadcastPkts%7C3%7C&columns__check=1.3.6.1.2.1.31.1.1.1.4%7CifOutMulticast
Pkts%7C4%7C&columns__check=1.3.6.1.2.1.31.1.1.1.5%7CifOutBroadcastPkts%7C5%7C&columns__check=1.3.6.1.2.1.31.1.1.1.6%7CifHCInOctets%7C6%7C&columns__check=1.3.6.1.2.1.31.1.1.1.7%7CifHCInUcastPkts%7C7%7C&column
s__check=1.3.6.1.2.1.31.1.1.1.8%7CifHCInMulticastPkts%7C8%7C&columns__check=1.3.6.1.2.1.31.1.1.1.9%7CifHCInBroadcastPkts%7C9%7C&columns__check=1.3.6.1.2.1.31.1.1.1.10%7CifHCOutOctets%7C10%7C&columns__check=1
.3.6.1.2.1.31.1.1.1.11%7CifHCOutUcastPkts%7C11%7C&columns__check=1.3.6.1.2.1.31.1.1.1.12%7CifHCOutMulticastPkts%7C12%7C&columns__check=1.3.6.1.2.1.31.1.1.1.13%7CifHCOutBroadcastPkts%7C13%7C&columns__check=1.
3.6.1.2.1.31.1.1.1.15%7CifHighSpeed%7C14%7C&columns__check=1.3.6.1.2.1.31.1.1.1.18%7CifAlias%7C15%7C&identcolumn_=1.3.6.1.2.1.31.1.1.1.6%7CifHCInOctets%7C6%7C&identcolumn_=1.3.6.1.2.1.31.1.1.1.10%7CifHCOutOc
tets%7C10%7C&channel1column_=1.3.6.1.2.1.31.1.1.1.6%7CifHCInOctets%7C6%7C&channel1column_=1.3.6.1.2.1.31.1.1.1.10%7CifHCOutOctets%7C10%7C&sensortype=snmpcustomtable&id=88195&tmpid=79
Add-Sensor : PRTG was unable to complete the request. The server responded with the following error: Nothing was selected, no sensors could be created.
In Zeile:11 Zeichen:11
+ $device | Add-Sensor $param -verbose
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Add-Sensor], PrtgRequestException
    + FullyQualifiedErrorId : PrtgRequestException,PrtgAPI.PowerShell.Cmdlets.AddSensor`

So maybe they fixed it with the newest version of PRTG (23.2.84.1566+)?

Because @carsten0407 is running 23.2.83.1760 Maybe he can verify if it works with the newer version?

And I’m running 22.4.81.1532+ I’m on holiday for 3 weeks now but we’re going to update the servers at some point after my holidays. Then I can verify

Read more comments on GitHub >

github_iconTop Results From Across the Web

PRTG Manual: SNMP Custom Table Sensor
The SNMP Custom Table sensor monitors entries from a table that is provided via the Simple Network Management Protocol (SNMP). You can create...
Read more >
7.8.125 SNMP Custom Table Sensor
The SNMP Custom Table Sensor monitors entries from a table that is provided via Simple Network Management Protocol (SNMP). You can create one...
Read more >
SNMP Custom Table Sensor
The SNMP Custom Table Sensor monitors entries from a table that is provided via Simple Network Management Protocol (SNMP). You can create one...
Read more >
Issue #66 · lordmilko/PrtgAPI - Custom SNMP
The most likely explanation here is the latter reason: either the device you're trying to create this sensor on does not support SNMP...
Read more >
PRTG Tutorial - SNMP Custom Sensors and SNMP ... - YouTube
... the OIDs in those MIBs to create SNMP Custom and SNMP Library sensors. ... Table of Contents: 0:00 - Intro & disclosure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found