Hello,
I would like to get the world map where all my devices and their states are shown. These devices don't have anything I could ping nor any OS, so they way I have to do it is to call the API to set the device's location by entering coordinates (latitude and longitude) that I store in my database. Trying to do so I'm facing two problems:
1. If I don't set device location at all and they try to change it by the API, nothing happens. The location is still empty and device is not shown on the world map.
2. If I set some location and then try to change it by the API, it works halfway. The world map is updated and shows new location of my device, but if I hover it there or enter device settings, there are still old coordinates shown.
I tried to do this by these two calls:
/api/setlonlat.htm?id=objectid&location=name_of_object_location&lonlat=longitude,latitude /api/setobjectproperty.htm?id=objectid&name=lonlat&value=longitude,latitude
I have the newest version of the PRTG installed (PRTG Network Monitor 20.2.59.1689 x64).
Article Comments
Hello, thank you for your reply. I tried to call the API using both browser and Postman. Both times I received response "OK". Example of log looks as following:
#636946 2020-06-18 13:10:36 127.0.0.1 "user100-prtgadmin" localhost 80 GET /api/setlonlat.htm id=42&lonlat=-74.044651,40.690063&username=prtgadmin&password=*** 200 "PostmanRuntime/7.1.1"
Best regards
Jun, 2020 - Permalink
Hello,
Can you give me the exact calls you made? Don't send the username and password. Just the other parts.
I'm going to test them in my lab.
Benjamin Day
[Paessler Support]
Jun, 2020 - Permalink
Hello, these are the exact API calls I made:
http://localhost/api/setlonlat.htm?id=42&lonlat=-0.127646,51.507462
http://localhost/api/setobjectproperty.htm?id=42&name=lonlat&value=-0.127646,51.507462
Jun, 2020 - Permalink
Hello,
Yes, I can confirm the same is happening to me. I'll submit a bugfix ticket for this.
Thanks!
Benjamin Day
[Paessler Suppport]
Jun, 2020 - Permalink
Hello, great to hear that! I suppose that it will be fixed in the next PRTG release? Do you know when could I expect one?
Jun, 2020 - Permalink
Hello,
I do not know when it will be handled. You can check the release notes for future releases and see the entry for the bug.
Thanks!
Benjamin Day
[Paessler Support]
Jun, 2020 - Permalink
Hello,
Can you please check the contents of the webserver log to see if these API calls are making it to the PRTG server, and not generating errors? The log is in the following folder.
C:\ProgramData\Paessler\PRTG Network Monitor\Logs\webserver
Please check the log for the day you tried this, and search for the API call you made.
Let me know if there is not an error in the log.
Benjamin Day
[Paessler Support]
Jun, 2020 - Permalink