Closed terrassen closed 4 years ago
Hi @terrassen,
This is a known issue currently being tracked by #80. PRTG internally uses POST + cookies for most requests, so it can execute queries as long as it likes. PrtgAPI uses GET authentication in most places, which does not work when combined with POST. As such, you can sometimes run into issues when executing queries that construct massive URLs (as is the case here)
The workaround for this is simply to split your request up into multiple sub-requests. In your case, instead of adding all 63 in one request, do half or maybe a third in each request
$SensorParams = Get-Device -id $DeviceId | New-SensorParameters -RawType snmpcustomtable -QueryParameters @{'tableoid_' = '1.3.6.1.4.1.2011.6.139.13.3.3'}
$bigList = $SensorParams.Targets
$counter = [pscustomobject] @{ Value = 0 }
$groupSize = 20
$groups = $bigList | Group-Object -Property { [math]::Floor($counter.Value++ / $groupSize) }
foreach($group in $groups)
{
$SensorParams.Targets = $group.Group
$SensorParams | Add-Sensor
}
Please let me know how you go. As this issue is a duplicate, I will close this issue
Thanks lordmilko
I am able to create the sensor now by creating groups with a maximum of 5 targets per group. Thanks and regards Guido
[cid:itp_oria_4bd656f6-d1dd-4962-93a0-bdf17e4690bc.jpg] Guido Weber Senior Systems Engineer
ITpoint Systems AG | Riedstrasse 1 | CH-6343 Rotkreuz D: +41 41 798 80 34 | M: +41 79 208 64 53 guido.weber@itpoint.ch
www.itpoint.chhttp://www.itpoint.ch | www.oria.chhttp://www.oria.ch | LinkedInhttps://www.linkedin.com/company/itpoint-systems-ag/ | Xinghttps://www.xing.com/companies/itpointsystemsag | Twitterhttps://twitter.com/ITpointAG | Facebookhttps://www.facebook.com/ITpointSystemsAG
Trusted IT for Business
Von: lordmilko notifications@github.com Gesendet: Donnerstag, 5. Dezember 2019 12:41 An: lordmilko/PrtgAPI PrtgAPI@noreply.github.com Cc: Guido Weber guido.weber@itpoint.ch; Mention mention@noreply.github.com Betreff: Re: [lordmilko/PrtgAPI] add-sensor of type snmpcustomtable fails (#122)
Hi @terrassenhttps://github.com/terrassen,
This is a known issue currently being tracked by #80https://github.com/lordmilko/PrtgAPI/issues/80. PRTG internally uses POST + cookies for most requests, so it can execute queries as long as it likes. PrtgAPI uses GET authentication in most places, which does not work when combined with POST. As such, you can sometimes run into issues when executing queries that construct massive URLs (as is the case here)
The workaround for this is simply to split your request up into multiple sub-requests. In your case, instead of adding all 63 in one request, do half or maybe a third in each request
$SensorParams = Get-Device -id $DeviceId | New-SensorParameters -RawType snmpcustomtable -QueryParameters @{'tableoid_' = '1.3.6.1.4.1.2011.6.139.13.3.3'}
$bigList = $SensorParams.Targets
$counter = [pscustomobject] @{ Value = 0 }
$groupSize = 20
$groups = $bigList | Group-Object -Property { [math]::Floor($counter.Value++ / $groupSize) }
foreach($group in $groups)
{
$SensorParams.Targets = $group.Group
$SensorParams | Add-Sensor
}
Please let me know how you do. As this issue is a duplicate, I will close this issue
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/lordmilko/PrtgAPI/issues/122?email_source=notifications&email_token=AEWINCBEEJDC6J2WMEMQ6J3QXDSDJA5CNFSM4JVYEYBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGAN5CY#issuecomment-562093707, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEWINCFRF6GMJYOFWNY7MIDQXDSDJANCNFSM4JVYEYBA.
Hello lordmilko I upgraded to prtgapi 0.9.10 and I am now facing the error message "Add-sensor : Invalid URI: The Uri string is too long."
The new-sensorparamers command is able to detect all 63 interfaces
so that means: Bug 119/121 is fixed.
uri_too_long.txt
What is the output of
Get-PrtgClient -Diagnostic
?Attaching the verbose output as a textfile.