Currently in LibreNMS, when viewing a list of devices and clicking on the Device column header, the sorting is done by the hostname field. For those who use FQDNs when adding devices, this makes perfect sense and should work as expected.
However, for those who add devices by IP address, such as those of us using it in environs where DNS names don’t exist or we can’t rely on them, this fails miserably. First, the sort is done alphanumerically, meaning devices IP addresses show up sorted such as
10.10.10.1
10.10.10.11
10.10.10.12
10.10.10.2
instead of
10.10.10.1
10.10.10.2
10.10.10.11
10.10.10.12
Second, even if we have SNMP data such that sysName is akin to an FQDN (in my case, Cisco gear where I’ve set the hostname and domain-name so that the returned sysName does come back as such) AND we modify config.php with the line
$config[‘force_ip_to_sysname’] = true;
based on the info on the Configuration page which reads, in part,
When using IP addresses as a hostname you can instead represent the devices on the WebUI by its SNMP sysName resulting in an easier to read overview of your network. This would apply on networks where you don’t have DNS records for most of your devices.
while we get to see the sysName in bigger text, clicking the Device column header causes confusion all around for users. It’s not sorted (properly) by IP, nor is it alphabetical by sysName.
It would be nice to either have a setting which lets us choose how things are sorted via the Device column, or better, since the above setting specifically makes sysName how devices are represented, automatically change the sort mechanism to sort by sysName instead of hostname.
Digging under the hood in the database (MariaDB in my case), I know I can easily do things like
select * from devices order by INET_ATON(hostname);
in order to get the order I want. But noting the table structures, I also understand it might be difficult to have the Device column sorted properly by IP since you have no way of knowing whether users added devices by FQDN or IP, and so hostname values could be a mix in the devices table. So being able to properly sort hostnames when they’re all IPs might require a global setting that the admin is responsible for setting. Or it may not be possible, since the INET_ATON() function is for MariaDB/MySQL, but users may be using other DBMS.
But if the admin has configured LibreNMS with the setting mentioned above in config.php, making sysName more prominent than hostname in the Devices column, odds are they’ll want to sort the devices by sysName as well.