Closed schoenm1 closed 2 years ago
Does the very specific path C:\Program Files (x86)\PRTG Network Monitor\snmplibs\
exist? i.e. if you copy and paste that path into Windows Explorer and navigate to it (don't type it as there may be spelling differences) on the probe you attempted to add the folder to, does it work?
Hi,
I am seing this same issue.
Code ` var oidlib = client.GetSensorTypes(device.Id).First(t => t.Id == "snmplibrary").QueryTargets.First(t => t.Value.Contains("BGP-FULL"));
DynamicSensorParameters dynamicSensorParameters = client.GetDynamicSensorParameters(
deviceOrId: device,
sensorType: "snmplibrary",
queryParameters: oidlib,
timeout: 120
);
dynamicSensorParameters["interfacenumber__check"] = dynamicSensorParameters.Targets["interfacenumber__check"];
client.AddSensor(device.Id, dynamicSensorParameters);`
Exception:
Synchronously executing request https://xx.xx.com/controls/addsensor2.htm?id=50532&sensortype=snmplibrary&username=xx&passhash=xx 568 [!] Exception caught System.Net.Http.HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error). at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
Webserver logs:
2022-10-28 08:40:18.766766 ERRR TId 12084 CoreWebServer> Webserver: Error (/controls): Internal Error: Cannot open file "C:\Program Files (x86)\PRTG Network Monitor\snmplibs\". The system cannot find the path specified, URL: /controls/addsensor3.htm?id=50532&tmpid=566& 2022-10-28 08:41:30.141993 ERRR TId 8448 CoreWebServer> Webserver: Error (/controls): Internal Error: Cannot open file "C:\Program Files (x86)\PRTG Network Monitor\snmplibs\". The system cannot find the path specified, URL: /controls/addsensor3.htm?id=50532&tmpid=568&
Both the folder exists, and the file "BGP-FULL.oidlib" exists. It would seem something is missing in the query, so the webserver does not recieve the oidlib name? Adding manually with GUI works fine.
Does the very specific path
C:\Program Files (x86)\PRTG Network Monitor\snmplibs\
exist? i.e. if you copy and paste that path into Windows Explorer and navigate to it (don't type it as there may be spelling differences) on the probe you attempted to add the folder to, does it work?
Yes, the path exist on PRTG Core Server. I can open (copy/paste) on Windows Explorer and Windows-R (Run) copy/paste
Can you run Process Monitor while attempting to create the sensor using PrtgAPI and filter for all entries where the path contains snmplibs
Based on this, we may see some specific error messages - e.g. items with status NAME NOT FOUND
or ACCESS DENIED
which could give clues as to what's going on here
With running Process Monitor on PRTG Core Server, one new line is shown, when process following command:
$sensor = $dev | Add-Sensor $param
Where should I see a NAME NOT FOUND
or ACCESS DENIED
?
I opened a Paessler case. Answer from Paessler Support:
Paessler tested my scenario and was able to reprocude the issue in browser (not in PRTG GUI, but API Calls).
Example Paessler:
Manual creating a sensor, the request is: addsensor2.htm
(POST Request) with Payload &id=2445&sensortype=snmplibrary_nolist&preselection_snmplibrary_nolist=Host_Resources_mib.oidlib"
.
If API query is changed and https://server.domain.com/controls/addsensor2.htm?id=2445&sensortype=snmplibrary&id=2445&sensortype=snmplibrary_nolist&preselection_snmplibrary_nolist=Host_Resources_mib.oidlib&username=prtgadmin&password=prtgadmin
is used (in Browser), it is working.
As a result Paessler Support suspect an error / missing update in the API and recommend to report this to @lordmilko
If I compare the Paessler API call with mine from debug output https://myserver.domain.com/controls/addsensor2.htm?id=61884&sensortype=snmplibrary&username=user123&passhash=****
, there is missing the part _nolist&preselection_snmplibrary_nolist=Host_Resources_mib.oidlib
.
Does this help to reproduce the issue?
Please be advised I have managed to reproduce this issue and can confirm this is a bug in PrtgAPI
If you specify -Verbose
to New-SensorParameters
, you'll observe that PrtgAPI does actually do the right thing in that scenario. The issue is, once you've got your DynamicSensorParameters
object and actually try and add it, you actually have to go through the whole addsensor2/3/4
dance again. PrtgAPI is not holding on to and re-specifying the sensor query target object that was previously specified; previous versions of PRTG let PrtgAPI get away with this incorrect behavior, however that is no longer the case.
Aha, is this fixable without breaking too much?
Hi all,
Please be advised a fix for this has now been pushed
Can you please follow the Manual installation instructions and advise whether PrtgAPI 0.9.18-preview.8 resolves your issue?
I, atleast, can confirm that this worked for me with the latest .net lib and additionally setting the DynamicType to true.
dynamicSensorParameters["interfacenumber__check"] = genericSensorTargets;
dynamicSensorParameters.DynamicType = true;
client.AddSensor(device.Id, dynamicSensorParameters);
Thank you for excellent following up (again), I have been stuck with this issue for quite some time :)
The fix with 'PrtgAPI 0.9.18-preview.8' is working well in my case. thank a lot @lordmilko for your high-speed fix.
What's going on?
Have you ever had the Error Message from PRTGServer: 500 (Internal Server Error)? I try to add a snmplibrary Sensor with PRTGApi Module and can not add any sensor for a specific snmplibrary. (In PRTG GUI, the same snmplibrary is working well).
Steps to reproduce
In PRTG Serverlog, i found following logEntries: Core.log
2022-10-28 04:45:52.485849 ERRR TId 16024 Core> SendMetaRequest error(Cannot open file "C:\Program Files (x86)\PRTG Network Monitor\snmplibs\". The system cannot find the path specified)
CoreWeb Server.log2022-10-28 04:40:48.207350 ERRR TId 9288 CoreWebServer> Webserver: Error (/controls): Internal Error: Cannot open file "C:\Program Files (x86)\PRTG Network Monitor\snmplibs\". The system cannot find the path specified, URL: /controls/addsensor3.htm?id=61884&tmpid=1061&
2022-10-28 04:45:52.485849 ERRR TId 16024 CoreWebServer> Webserver: Error (/controls): Internal Error: Cannot open file "C:\Program Files (x86)\PRTG Network Monitor\snmplibs\". The system cannot find the path specified, URL: /controls/addsensor3.htm?id=61973&tmpid=1063&
What is the output of 'Get-PrtgClient -Diagnostic'? Tried with official 0.9.17 and 0.9.18-preview6