Sorting of graphs and columns

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

Moderators: Developers, Moderators

hapklaar
Posts: 38
Joined: Tue May 31, 2005 10:06 am

Sorting of graphs and columns

Post by hapklaar »

Hi,

Just installed Cacti and after a few problems I managed to resolve using this forum I still have two questions:

- How do I sort graphs differently? Currently Gi0/10 is placed after Gi0/1 instead of Gi0/2 and so on. Also I would like to get the interface descriptions of the cisco switches in the graph.

- Does Cacti contain a setting to place 2 or more graphs next to eachother. At the moment (default) it places all graphs under eachother.

Thanks for creating such a cool product!!

Regards,
Erwin
User avatar
snark
Posts: 18
Joined: Wed Sep 21, 2005 1:13 am
Contact:

Post by snark »

agreed... how can it possible?
VinceV
Posts: 7
Joined: Mon Nov 13, 2006 8:22 pm

Post by VinceV »

Try this patch against cacti 0.8.6i:

Code: Select all

--- cacti.orig/lib/html_tree.php        2006-10-08 20:06:01.000000000 -0700
+++ cacti/lib/html_tree.php     2006-11-13 17:18:24.000000000 -0800
@@ -457,6 +457,10 @@
        return $dhtml_tree;
 }

+function nat_sort_graphs($a, $b) {
+       return strnatcasecmp($a['title_cache'], $b['title_cache']);
+}
+
 function grow_right_pane_tree($tree_id, $leaf_id, $host_group_data) {
        global $current_user, $colors, $config;

@@ -586,6 +590,7 @@
                                        and graph_local.host_id=" . $leaf["host_id"] . "
                                        $sql_where
                                        order by graph_templates_graph.title_cache");
+                               usort($graphs, 'nat_sort_graphs');

                                if (read_graph_config_option("thumbnail_section_tree_2") == "on") {
                                        html_graph_thumbnail_area($graphs, "", "view_type=tree&graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end(), "<tr bgcolor='#a9b7cb'><td colspa
n='3' class='textHeaderDark'><strong>Graph Template:</strong> " . $graph_template["name"] . "</td></tr>");
User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Post by timi »

does it work on 0.8.6h too ?
VinceV
Posts: 7
Joined: Mon Nov 13, 2006 8:22 pm

Post by VinceV »

It looks like it should work, but I haven't tested it. I applied the patch and it applied cleanly (offset 10 lines). Give it a shot.
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Hi

thanks for your patch. Could you please submit a bug request at http://bugs.cacti.net ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Post by timi »

i will try, can u post the diff file here ?

10q
VinceV
Posts: 7
Joined: Mon Nov 13, 2006 8:22 pm

Post by VinceV »

timi wrote:i will try, can u post the diff file here ?
timi, the diff I posted above should apply to 0.8.6h just fine.

-Vince
User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Post by timi »

i know but when i copy&paste to code, the lines in the diff are not at the right place ... i need to guess where it starts and where it ends
User avatar
snark
Posts: 18
Joined: Wed Sep 21, 2005 1:13 am
Contact:

Post by snark »

i make all changes by hand and... ta-da! this works! thank you VinceV!
User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Post by timi »

done, patched, but looks like in the image :(
Attachments
tree.GIF
tree.GIF (5.5 KiB) Viewed 8316 times
User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Post by timi »

is it a problem if the html_tree.php is not the original one ? i had to modify it for a reason...
VinceV
Posts: 7
Joined: Mon Nov 13, 2006 8:22 pm

Post by VinceV »

timi wrote:is it a problem if the html_tree.php is not the original one ? i had to modify it for a reason...
It shouldn't make a difference. How do you have your graph tree set up? The patch I made doesn't affect the list in the left column, just the right side where the graphs are actually displayed. I think 0.8.6i added some natural sorting options in other places though. You may want to upgrade.
User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Post by timi »

VinceV wrote:
timi wrote:is it a problem if the html_tree.php is not the original one ? i had to modify it for a reason...
It shouldn't make a difference. How do you have your graph tree set up? The patch I made doesn't affect the list in the left column, just the right side where the graphs are actually displayed. I think 0.8.6i added some natural sorting options in other places though. You may want to upgrade.
aha, i understand ... well i will swhitch to .6i after i'm sure that it is safe to :)
User avatar
TheWitness
Developer
Posts: 17061
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

What happens if you change the sort order in 0.8.6i to Natural? This should have fixed this. No patch should be required.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest