Sorting by Ip address (hostname)

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
Commodore
Posts: 1
Joined: Mon Jan 08, 2007 11:18 am

Sorting by Ip address (hostname)

Post by Commodore »

The new version sorts, yay!, but when sorting by hostname, that are Ip address it doesent work so well ie:

10.10.1.10
10.10.1.100
10.10.1.101
10.10.1.20

etc.

So here is a fix for that:

in your hosts.php file just above:
$hosts = db_fetch_assoc("SELECT .........

I added:
$sortby=$_REQUEST["sort_column"];
if ($sortby=="hostname") {
$sortby="INET_ATON(hostname)";
}

then changed:
ORDER BY " . $_REQUEST["sort_column] . " " . $_REQUEST["sort_direction"] . "

to
ORDER BY " . $sortby . " " . $_REQUEST["sort_direction"] . "


Thought I would share this,

--Andrew
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

WOuld you please be so kind to open a feature request item at http://bugs.cacti.net to document your request?
Thanks
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests