Skip to content

rutos-rutx: Map GPS lat and lon to os module#15033

Merged
murrant merged 1 commit intolibrenms:masterfrom
QuadPiece:patch-1
May 12, 2023
Merged

rutos-rutx: Map GPS lat and lon to os module#15033
murrant merged 1 commit intolibrenms:masterfrom
QuadPiece:patch-1

Conversation

@QuadPiece
Copy link
Copy Markdown
Contributor

Teltonika routers have GPS hardware and it's discovered by LibreNMS, but for some reason only gets graphed.
This maps the coordinates to the OS module, which makes its position appear on the pretty map.

As the GPS coordinates are already there and discovered by LibreNMS, simply used erroneously, I do not believe updated test data is needed.

Web UI before:

before

Web UI after:

after

GPS coordinates were available before, but in the form of a graphed count:

firefox_AzrNaXsovj

This is still the case and this count has not been removed.

DO NOT DELETE THE UNDERLYING TEXT

Please note

Please read this information carefully. You can run ./lnms dev:check to check your code before submitting.

  • Have you followed our code guidelines?
  • If my Pull Request does some changes/fixes/enhancements in the WebUI, I have inserted a screenshot of it.
  • If my Pull Request makes discovery/polling/yaml changes, I have added/updated test data.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926
After you are done testing, you can remove the changes with ./scripts/github-remove. If there are schema changes, you can ask on discord how to revert.

Makes GPS position appear on geographic maps.
@murrant
Copy link
Copy Markdown
Member

murrant commented May 10, 2023

Great!

But because tests didn't fail, this means none of the test files include those two OIDs, can you add them to one of the snmprec and update the test data (or at least add example snmp data here).

@murrant murrant added Device 🖥️ New or added device support Needs Testing Waiting for others to verify that the code functions properly. labels May 10, 2023
@hjcday
Copy link
Copy Markdown
Contributor

hjcday commented May 10, 2023

How does this behave when locations change? I played with this a while ago and found there were some issues updating the lat/lon for the location associated with the device

@murrant
Copy link
Copy Markdown
Member

murrant commented May 10, 2023

It updates the location associated with the device. If multiple devices link to that location, it will update it for all of them. If multiple devices try to update a shared location, it will bounce around constantly.

For mobile devices, they all should have their own location. (This should probably be in the docs...)

@QuadPiece
Copy link
Copy Markdown
Contributor Author

How does this behave when locations change?

The GPS coordinates and map position updates, at least it did when I tested.
But I suspect it only does so during discoveries or daily, as the latency was extremely high. After I moved it I didn't see the map update before the next day.

If you use geo locations, my experience is that if you have a location with the same name, but different GPS coordinates, it will get duplicated:

image

because tests didn't fail, this means none of the test files include those two OIDs, can you add them to one of the snmprec and update the test data (or at least add example snmp data here).

I will nab some sample data from the router as soon as I have access to it and try adding it to an snmprec and test file if I can figure it out.

@QuadPiece
Copy link
Copy Markdown
Contributor Author

QuadPiece commented May 11, 2023

@murrant I attempted to add test data for my device, but unfortunately failed.

Turns out my device wasn't detected out of the box (RUT956 was added to the definitions file locally on our install). So I attempted to follow the docs and added my own device as a variant in includes/definitions/rutos-rutx.yaml, after which I ran ./scripts/collect-snmp-data.php without issue and got an snmprec file.

When running ./scripts/save-test-data.php -o rutos-rutx -v rut956, it ran without reporting issues, however the json file it saved was blank:

image

I most likely have done something wrong. But if it helps, this appears to be the GPS OIDs:

1.3.6.1.4.1.48690.3.1.0|4|59.912195 # Lat
1.3.6.1.4.1.48690.3.2.0|4|10.753871 # Lon
1.3.6.1.4.1.48690.3.5.0|4|10 # Number of GPS sattelites

This appears to already be present in an snmprec from a different device:

1.3.6.1.4.1.48690.3.1.0|4|-37.000000

@Jellyfrog
Copy link
Copy Markdown
Member

@murrant

But because tests didn't fail, this means none of the test files include those two OIDs

lat/long is not selected in the dump function for OS module :)

@murrant
Copy link
Copy Markdown
Member

murrant commented May 12, 2023

Well shit :) Ok lets merge this the snmp data is included.

@murrant murrant merged commit 26c49af into librenms:master May 12, 2023
@murrant murrant removed the Needs Testing Waiting for others to verify that the code functions properly. label May 12, 2023
@librenms-bot
Copy link
Copy Markdown

This pull request has been mentioned on LibreNMS Community. There might be relevant details there:

https://community.librenms.org/t/23-5-0-changelog/21481/1

TheMysteriousX pushed a commit to TheMysteriousX/librenms that referenced this pull request Aug 9, 2023
Makes GPS position appear on geographic maps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Device 🖥️ New or added device support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants