Closed noaboa97 closed 11 months ago
Hi @noaboa97 As far as I can tell, you need to define multiple values:
Hello @schoenm1 Thank you for your quick reply.
So how I understand you. I would need to do this?
$device | get-sensortarget -rawType "snmpcustomtable" -QueryParameters @{
"tableoid" = "1.3.6.1.2.1.31.1.1"
"identcolumn" = "1.3.6.1.2.1.31.1.1.1.1."
"channel1column" = "1.3.6.1.2.1.31.1.1.1.6."
"channel2column" = "1.3.6.1.2.1.31.1.1.1.10"
} -Timeout 5000 -ErrorAction Stop
With $device | get-sensor port* | get-objectproperty -RawProperty channel2column
i was able to determen 1.3.6.1.2.1.31.1.1.1.10
.
But still the same error.
Could you please elaborate further?
Best
Noah
Hi @noaboa97 Can you try this?
$device | get-sensortarget -rawType "snmpcustomtable" -QueryParameters @{
"tableoid" = "1.3.6.1.2.1.31.1.1"
"identcolumn" = "1.3.6.1.2.1.31.1.1.1.1."
"channel1column" = "1.3.6.1.2.1.31.1.1.1.6."
"channel1snmptype" = "channel1snmptype"
"channel1name" = "Test Channel"
} -Timeout 5000 -ErrorAction Stop
I always use "channel1unit" = "ValueLookup" and define the lookup table "channel1valuelookup" = "oid.mylookup". I don't know if channel1unit is a mandatory parameter or if it can be blank.
Hello @schoenm1
I get the same error.
Okay. I don't define any custom lookup. In the webinterface I can just enter the tableoid and then I get the screenshot I already uploaded.
So I have to figure out what logic is implemented in the frontend of prtg that I can't access when I connect over the api directly to the backend. And unfortunatly currently I don't have access to an unsecured prtg installation to record what the frontend sends to the backend. Maybe that would help me.
So I was curious and tried to find something in the wiki for me to acomplish my goal of just monitoring the uplink port of the switch by looking at the custom snmp table and determining which one was is in use.
To my understanding after carefully reading the wiki it should work as I expected it to work. As written here and further down here
I did some research and found this issue. Which is not relevant to my issue. But it gave me another idea, to try it with New-SensorParameters
and get the DynamicParameters.
$SensorParams = $device | New-SensorParameters -RawType snmpcustomtable -QueryParameters @{ "tableoid" = "1.3.6.1.2.1.31.1.1"}
Now I got the targets in $sensorparams.targets
and can even get the values same as in the table but not as beautiful to look at them.
$sensorparams.targets.snmptable__check[3].Properties
PS C:\Users\Username> $sensorparams.targets.snmptable__check[3].Properties
4
port4
0
0
0
0
61608617013
120288878
0
0
190807311366
203373012
0
0
1000
Anyway now I could create my own objects from this and know which one is the uplink but I still wouldn't have a way how to add only one sensor with this target.
So my question @lordmilko is this a bug?
Thank you and best regards
Noah
Wait a second. I swapped something... I saw your last post now. Perfect. So following point 1 is successful.
$param = Get-Device -id $deviceID | New-SensorParameters @RawTypeParam -Timeout 180
--> $param = Get-Device -id $deviceID | New-SensorParameters -RawType snmpcustomtable -QueryParameters @{ " "tableoid"="1.3.6.1.4.1.1916.1.32.1.4.1.1"} -Timeout 180
I do not have access at the moment to my scripting server. All my Sensor option are in a XML file and my script is handling the PRTGAPI convention for me. At the moment I can not give you the exact powershell command. But from own XML I can tell, that I'm using following parameters:
Now to the 2nd point. You now have a valid $param As far as I can remember, you should use now something like this (with my param/value from above): in $param.targets you will find all possible values to assign to $param. Here the examples (from my mind)
$param.snmptable = $param.targets.snmptable__check
$param.columns__check= $param.targets.columns__check
$param.channel1name = "CPU 1"
$param.channel1snmptype = "float"
$param.channel1unit = "Percent"
$param.identcolumn = $param.Targets.identcolumn | Where-Object {$_.Name -match "^1.3.6.1.4.1.1916.1.32.1.4.1.1$"}
$param.channel1column= $param.Targets.channel1column| Where-Object {$_.Name -match "^1.3.6.1.4.1.1916.1.32.1.4.1.9$"}
The point here is, that e.g. identcolumn is not a simple sting, but must be the predefined (filtered) object from $param.Target.identcolumn
The last point is to add the sensor. This should be
$Get-Device -id $deviceID | Add-Sensor $param
If this is not working, I have to check on my system the day after tomorrow.
Hello @schoenm1
Thank you for your effort.
Sounds really good. Unfortunatly it's not working. I also had to change somethings because I guess my data is a little diffrent.
What are you filtering for in identcolumn
and channel1column
? Should they be the same?
Here's my code and the error:
$param = $device | New-SensorParameters -RawType snmpcustomtable -QueryParameters @{ "tableoid" = "1.3.6.1.2.1.31.1.1"}
$param.snmptable = $param.targets.snmptable__check
$param.columns__check= $param.targets.columns__check
$param.channel1name = "Test 1"
$param.identcolumn = $param.Targets.identcolumn | Where-Object {$_.Value -like "*1.3.6.1.2.1.31.1.1*"}
$param.channel1column= $param.Targets.channel1column| Where-Object {$_.Name -like "*Octets*"}
$device | Add-Sensor $param
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:7 Zeichen:11
+ $device | Add-Sensor $param
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Add-Sensor], PrtgRequestException
+ FullyQualifiedErrorId : PrtgRequestException,PrtgAPI.PowerShell.Cmdlets.AddSensor
Here's my data so you can understand why I changed the where clause:
PS C:\Users\Username> $param.Targets.identcolumn
Value Properties Name
----- ---------- ----
table_index {table_index, table_index, 0} table_index
1.3.6.1.2.1.31.1.1.1.1 {1.3.6.1.2.1.31.1.1.1.1, ifName, 1} ifName
1.3.6.1.2.1.31.1.1.1.2 {1.3.6.1.2.1.31.1.1.1.2, ifInMulticastPkts, 2} ifInMulticastPkts
1.3.6.1.2.1.31.1.1.1.3 {1.3.6.1.2.1.31.1.1.1.3, ifInBroadcastPkts, 3} ifInBroadcastPkts
1.3.6.1.2.1.31.1.1.1.4 {1.3.6.1.2.1.31.1.1.1.4, ifOutMulticastPkts, 4} ifOutMulticastPkts
1.3.6.1.2.1.31.1.1.1.5 {1.3.6.1.2.1.31.1.1.1.5, ifOutBroadcastPkts, 5} ifOutBroadcastPkts
1.3.6.1.2.1.31.1.1.1.6 {1.3.6.1.2.1.31.1.1.1.6, ifHCInOctets, 6} ifHCInOctets
1.3.6.1.2.1.31.1.1.1.7 {1.3.6.1.2.1.31.1.1.1.7, ifHCInUcastPkts, 7} ifHCInUcastPkts
1.3.6.1.2.1.31.1.1.1.8 {1.3.6.1.2.1.31.1.1.1.8, ifHCInMulticastPkts, 8} ifHCInMulticastPkts
1.3.6.1.2.1.31.1.1.1.9 {1.3.6.1.2.1.31.1.1.1.9, ifHCInBroadcastPkts, 9} ifHCInBroadcastPkts
1.3.6.1.2.1.31.1.1.1.10 {1.3.6.1.2.1.31.1.1.1.10, ifHCOutOctets, 10} ifHCOutOctets
1.3.6.1.2.1.31.1.1.1.11 {1.3.6.1.2.1.31.1.1.1.11, ifHCOutUcastPkts, 11} ifHCOutUcastPkts
1.3.6.1.2.1.31.1.1.1.12 {1.3.6.1.2.1.31.1.1.1.12, ifHCOutMulticastPkts, 12} ifHCOutMulticastPkts
1.3.6.1.2.1.31.1.1.1.13 {1.3.6.1.2.1.31.1.1.1.13, ifHCOutBroadcastPkts, 13} ifHCOutBroadcastPkts
1.3.6.1.2.1.31.1.1.1.15 {1.3.6.1.2.1.31.1.1.1.15, ifHighSpeed, 14} ifHighSpeed
1.3.6.1.2.1.31.1.1.1.18 {1.3.6.1.2.1.31.1.1.1.18, ifAlias, 15} ifAlias
PS C:\Users\Username> $param.Targets.channel1column
Value Properties Name
----- ---------- ----
{, , 0}
1.3.6.1.2.1.31.1.1.1.2 {1.3.6.1.2.1.31.1.1.1.2, ifInMulticastPkts, 2} ifInMulticastPkts
1.3.6.1.2.1.31.1.1.1.3 {1.3.6.1.2.1.31.1.1.1.3, ifInBroadcastPkts, 3} ifInBroadcastPkts
1.3.6.1.2.1.31.1.1.1.4 {1.3.6.1.2.1.31.1.1.1.4, ifOutMulticastPkts, 4} ifOutMulticastPkts
1.3.6.1.2.1.31.1.1.1.5 {1.3.6.1.2.1.31.1.1.1.5, ifOutBroadcastPkts, 5} ifOutBroadcastPkts
1.3.6.1.2.1.31.1.1.1.6 {1.3.6.1.2.1.31.1.1.1.6, ifHCInOctets, 6} ifHCInOctets
1.3.6.1.2.1.31.1.1.1.7 {1.3.6.1.2.1.31.1.1.1.7, ifHCInUcastPkts, 7} ifHCInUcastPkts
1.3.6.1.2.1.31.1.1.1.8 {1.3.6.1.2.1.31.1.1.1.8, ifHCInMulticastPkts, 8} ifHCInMulticastPkts
1.3.6.1.2.1.31.1.1.1.9 {1.3.6.1.2.1.31.1.1.1.9, ifHCInBroadcastPkts, 9} ifHCInBroadcastPkts
1.3.6.1.2.1.31.1.1.1.10 {1.3.6.1.2.1.31.1.1.1.10, ifHCOutOctets, 10} ifHCOutOctets
1.3.6.1.2.1.31.1.1.1.11 {1.3.6.1.2.1.31.1.1.1.11, ifHCOutUcastPkts, 11} ifHCOutUcastPkts
1.3.6.1.2.1.31.1.1.1.12 {1.3.6.1.2.1.31.1.1.1.12, ifHCOutMulticastPkts, 12} ifHCOutMulticastPkts
1.3.6.1.2.1.31.1.1.1.13 {1.3.6.1.2.1.31.1.1.1.13, ifHCOutBroadcastPkts, 13} ifHCOutBroadcastPkts
1.3.6.1.2.1.31.1.1.1.15 {1.3.6.1.2.1.31.1.1.1.15, ifHighSpeed, 14} ifHighSpeed
1.3.6.1.2.1.31.1.1.1.18 {1.3.6.1.2.1.31.1.1.1.18, ifAlias, 15} ifAlias
And here are where clauses what they filter for:
PS C:\Users\Username> $param.Targets.identcolumn | Where-Object {$_.Value -like "*1.3.6.1.2.1.31.1.1*"}
Value Properties Name
----- ---------- ----
1.3.6.1.2.1.31.1.1.1.1 {1.3.6.1.2.1.31.1.1.1.1, ifName, 1} ifName
1.3.6.1.2.1.31.1.1.1.2 {1.3.6.1.2.1.31.1.1.1.2, ifInMulticastPkts, 2} ifInMulticastPkts
1.3.6.1.2.1.31.1.1.1.3 {1.3.6.1.2.1.31.1.1.1.3, ifInBroadcastPkts, 3} ifInBroadcastPkts
1.3.6.1.2.1.31.1.1.1.4 {1.3.6.1.2.1.31.1.1.1.4, ifOutMulticastPkts, 4} ifOutMulticastPkts
1.3.6.1.2.1.31.1.1.1.5 {1.3.6.1.2.1.31.1.1.1.5, ifOutBroadcastPkts, 5} ifOutBroadcastPkts
1.3.6.1.2.1.31.1.1.1.6 {1.3.6.1.2.1.31.1.1.1.6, ifHCInOctets, 6} ifHCInOctets
1.3.6.1.2.1.31.1.1.1.7 {1.3.6.1.2.1.31.1.1.1.7, ifHCInUcastPkts, 7} ifHCInUcastPkts
1.3.6.1.2.1.31.1.1.1.8 {1.3.6.1.2.1.31.1.1.1.8, ifHCInMulticastPkts, 8} ifHCInMulticastPkts
1.3.6.1.2.1.31.1.1.1.9 {1.3.6.1.2.1.31.1.1.1.9, ifHCInBroadcastPkts, 9} ifHCInBroadcastPkts
1.3.6.1.2.1.31.1.1.1.10 {1.3.6.1.2.1.31.1.1.1.10, ifHCOutOctets, 10} ifHCOutOctets
1.3.6.1.2.1.31.1.1.1.11 {1.3.6.1.2.1.31.1.1.1.11, ifHCOutUcastPkts, 11} ifHCOutUcastPkts
1.3.6.1.2.1.31.1.1.1.12 {1.3.6.1.2.1.31.1.1.1.12, ifHCOutMulticastPkts, 12} ifHCOutMulticastPkts
1.3.6.1.2.1.31.1.1.1.13 {1.3.6.1.2.1.31.1.1.1.13, ifHCOutBroadcastPkts, 13} ifHCOutBroadcastPkts
1.3.6.1.2.1.31.1.1.1.15 {1.3.6.1.2.1.31.1.1.1.15, ifHighSpeed, 14} ifHighSpeed
1.3.6.1.2.1.31.1.1.1.18 {1.3.6.1.2.1.31.1.1.1.18, ifAlias, 15} ifAlias
PS C:\Users\Username> $param.Targets.channel1column| Where-Object {$_.Name -like "*Octets*"}
Value Properties Name
----- ---------- ----
1.3.6.1.2.1.31.1.1.1.6 {1.3.6.1.2.1.31.1.1.1.6, ifHCInOctets, 6} ifHCInOctets
1.3.6.1.2.1.31.1.1.1.10 {1.3.6.1.2.1.31.1.1.1.10, ifHCOutOctets, 10} ifHCOutOctets```
get-sensortarget : Cannot guess sensor target table: multiple tables found. Available tables: snmptablecheck, columnscheck, identcolumn, channel1column, channel1valuelookup, channel2column, channel2valuelookup, channel3column, channel3valuelookup, channel4column, channel4valuelookup, channel5column, channel5valuelookup, channel6column, channel6valuelookup, channel7column, channel7valuelookup, channel8column, channel8valuelookup, channel9column, channel9valuelookup, channel10column, channel10valuelookup.
As the error indicates, you need to specify the table name. From the wiki
By default, Get-SensorTarget will try and guess the table name the raw sensor targets are contained in within the PRTG Sensor Creation page. In the event more than one table is found, PrtgAPI will throw an exception specifying the possible table names available. A table name can then be specified to the -Table parameter of Get-SensorTarget
Get-Device -Id 3002 | Get-SensorTarget -rt exexml -Table exefile
Generally speaking, you do not actually need to use Get-SensorTarget
. Internally, Get-SensorTarget
executes most of the same API requests as would happen when retrieving DynamicSensorParameters
with New-SensorParameters
. If you're creating new sensors, DynamicSensorParameters
contains a Targets
property containing the data that Get-SensorTarget
would normally return, but for all of the tables, allowing you to fixup your parameters object as required.
Add-Sensor : PRTG was unable to complete the request. The server responded with the following error: Nothing was selected, no sensors could be created.
New versions of PRTG have broken PrtgAPI's ability to create sensors. As per #341 I am not in a position to fix this any time soon, and would recommend using an older version of PRTG (if possible) if this is absolutely critical. I don't know what version broke PrtgAPI
Hello @lordmilko
Thank you for your input.
If I add the Table I want, I can now get some output, the same that in Targets
from DynamicSensorParameters. I still don't understand how to edit the New-SensorParameter
to properly create the sensor.
We aren't running the newest PRTG Version, so we are fine for now and we can still create sensors (I created the Meraki License and Health Sensor yesterday over PRTG API). But we wanted to upgrade soon but then we really have to think about it and test that in a test environment and investigate in which version it breaks.
We run 22.4.81.1532+
Have you talked to Paessler about this Issue?
I'm sorry to hear about your medical issue. I hope you get well soon! Take care!
@schoenm1 were you able to check on your script server?
Best
Noah
Hi @noaboa97,
The error you are getting "Nothing was selected" is indicative that the version of PRTG you are running is affected by the same issue as #341. I don't know what version the issue was introduced in. This issue seems like it may affect all sensor types when selecting a sensor target that is not the first one in the list.
Thanks
@lordmilko So this error only affects sensors, where a sensor target needs to be selected?
Thats what it seems based on the information gathered so far in #341
Hi @noaboa97 I tried this morning on my productive System (23.2.84.1566+) This example is working for me. this will create the same sensor if I click in GUI:
$deviceID = 65750
$param = Get-Device -id $deviceID | New-SensorParameters -RawType snmpcustomtable -QueryParameters @{"tableoid"="1.3.6.1.4.1.1916.1.32.1.4.1.1"} -Timeout 180
$param.Name = "My new Sensor"
$param.snmptable__check = $param.targets.snmptable__check
$param.columns__check= $param.targets.columns__check
$param.channel1name = "CPU 1"
$param.channel1snmptype = "float"
$param.channel1unit = "Percent"
$param.identcolumn = $param.Targets.identcolumn | Where-Object {$_.Name -match "^1.3.6.1.4.1.1916.1.32.1.4.1.1$"}
$param.channel1column= $param.Targets.channel1column| Where-Object {$_.Name -match "^1.3.6.1.4.1.1916.1.32.1.4.1.5$"}
Get-Device -id $deviceID | Add-Sensor $param
On this example, my table will give me just one sensor back, because this is a standalone switch and not a stack.
With my several hundrets sensor, I use snmpcustomtable
, but not that much.
In most scenarios, I'm using a oid from the manufacturer and convert this to snmplibs and use the -RawType snmplibrary
.
So I don't have to know the oid, but can use the filter to search for e.g. Fan or PowerSupply.
Hello @schoenm1
Thanks for checking.
Unfortunatly with your sensor there is only one entry in the table which aparently works but if there are more than one it's not working. I have to check with my collegeagues at work if we can use another sensor. But the snmpcustomtable is the one they have been using since other don't work and they never cared to investigate.
I tried to look at the prtgAPI code to figure out where the GET
is used instead of POST
but wasn't successfull. Anyhow I'm just starting to learn C# .Net so I was just curious.
Tomorrow I'm leaving for holiday and maybe I can further investigate this after I'm back from vacation. I still need the get a unsecured PRTG Server at work so I can check and record the API request to compare them. This could maybe help.
@lordmilko
Would also be good to know, where excatly the request ist created and the GET
is used.
Could we also change the label to bug?
Best
Noah
Hi @noaboa97 I tested with a table more than one entry. On GUI: before PowerShell Module commands:
$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: In my case, this is also working with more than one entry in Table.
If you specify -Verbose
to Add-Sensor
you can see the issue is with addsensor5.htm
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
Hello guys
Thank you for your support. We upgraded our PRTG servers a while ago but I haven't been able to test it. Today I had some spare time and was able to check out the new release which should fix the issue. Which it does indeed! Thank you very much @lordmilko I hope you are better :)
Here's the code:
# defining port number
$number = 2
# get the device
$device = get-device -id 88195 #87701
# generate sensor parameters of type snmpcustomtable needs the queryparameters snmp table oid
$param = $device | New-SensorParameters -RawType snmpcustomtable -QueryParameters @{ "tableoid" = "1.3.6.1.2.1.31.1.1"}
# name of the new sensor
$param.Name = "port$number / INET"
# row to choose from the table and filter by name
$param.snmptable__check = $param.targets.snmptable__check | where {$_.name -eq "port$number"}
# column to choose we use all didn't have a use case where I need to filter
$param.columns__check= $param.targets.columns__check
# name of the first channel
$param.channel1name = "Traffic IN"
# snmptype in webinterface it's called value type possible values: float=Absolute (float),diff=delta (counter),abs=(unsigned integer),sign=Absolute (signed integer)
$param.channel1snmptype = "diff"
# Channel Unit the see options check the dropdown in the webinterface of PRTG
$param.channel1unit = "BytesBandwidth"
# Use channel 2
$param.usechannel2 = 1
$param.channel2name = "Traffic OUT"
$param.channel2snmptype = "diff"
$param.channel2unit = "BytesBandwidth"
# Identification Column
$param.identcolumn = $param.Targets.identcolumn | Where-Object {$_.name -eq "ifName"}
# Column which value to show as sensor
$param.channel1column= $param.Targets.channel1column| Where-Object {$_.Name -eq "ifHCInOctets"}
$param.channel2column= $param.Targets.channel1column| Where-Object {$_.Name -eq "ifHCOutOctets"}
# Add Sensor to device
$device | Add-Sensor $param -verbose
We create two channels one for traffic in and the other for traffic out.
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.
I get the following error when I run the code above:
Here's what PRTG outputs if I do it manual in the webinterface:
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