New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorted ports, loadbalancer vips, pools by ifName and label #9753
Conversation
The only thing is ordering gets wierd because ge1-10 comes before ge1-2. |
I'll check later if "ORDER BY LENGTH(ifName) , ifName" will work better here. |
On some devices, sorting by ifIndex will probably provide the expected result, and the computing cost would be the best (sorting integers is always better than strings) but we'll not find a solution that fits all devices ... |
I don't think that the performance aspect should matter here. If this sorting would happen while polling, i totally agree with you, as this will generate a lot of overhead. But in this case it's just the overview and the bills $ time mysql -hxxx -ulibrenms -p123 librenms -e "select * from ports where device_id = 1050 ORDER BY LENGTH(ifName), ifName;" > time.test real 0m0.081s $ time mysql -hxxx -ulibrenms -p123 librenms -e "select * from ports where device_id = 1050 ORDER BY ifName;" > time.test real 0m0.085s $ time mysql -hxxx -ulibrenms -p123 librenms -e "select * from ports where device_id = 1050" > time.test real 0m0.067s $ time mysql -hxxx -ulibrenms -p123 librenms -e "select COUNT(*) as count from ports where device_id = 1050" real 0m0.014s |
@Serazio we weren't debating performance. We were saying MySQL queries do alphabetical sort, humans expect natural sort (https://en.wikipedia.org/wiki/Natural_sort_order)
|
@Serazio You could also try to reorder the result of the SQL query in PHP using natsort(). That may help getting a correct natural display. |
I think i found a suitable way, to do this sorting.
I'll update the pull request in the next hours |
I can't help but agreeing with this but for a slightly different reason. Ordering by ifIndex (for ports overview) means you get them grouped on the type typically, ordering by name now means they ports are alphabetic and all over the show. This is one of the things that a per user setting would be ideal. |
Yeah, I think ifIndex would be best here for device oriented port lists. |
@Serazio Any update on this? You will also need to rebase. |
Closing due to inactivity. Feel free to reopen! |
DO NOT DELETE THIS TEXT
Please note
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.