Sorting of graphs and columns

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

Moderators: Developers, Moderators

sysmgr3
Posts: 1
Joined: Wed Jan 10, 2007 11:26 am
Location: Canada

Newbie question

Post by sysmgr3 »

How can add this patch?

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

Post by gandalf »

Copy this stuff into a file of your liking

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>");
and save it to the main cacti directory. From command line, enter

Code: Select all

patch -p1 -N < your.patch
where your.patch is the file you've just created
Reinhard
VinceV
Posts: 7
Joined: Mon Nov 13, 2006 8:22 pm

Post by VinceV »

FYI: This patch has been incorporated into cacti 0.8.6j.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

You are correct.

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?
m4tth3wv
Posts: 5
Joined: Mon Dec 11, 2006 4:42 pm

Still an issue

Post by m4tth3wv »

Updated to cacti 0.8.6j. Graph tree's are "natural sorting".

The graphs and datasources view incorrectly.

List of data sources:
Attachments
Clipboard01.jpg
Clipboard01.jpg (47.32 KiB) Viewed 4458 times
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Well, I didn't add it to the Data Source list. I guess I was simply adding to the Tree and Host Graph displays and not either the Data Sources or Graphs from the Console. Hmm. Can you log another feature request in Mantis. (http://bugs.cacti.net). Sorry about that... :oops:
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?
User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Post by timi »

m4tth3wv
Posts: 5
Joined: Mon Dec 11, 2006 4:42 pm

Post by m4tth3wv »

This maybe something I'm doing, since the graphs do not sort properly either. I tried the other hack as well.

I'll go ahead and submit the bug request for the datasources.
Attachments
Clipboard01.jpg
Clipboard01.jpg (89.04 KiB) Viewed 4430 times
Zxin
Posts: 2
Joined: Sun May 28, 2006 8:10 pm

Post by Zxin »

There is no sorting method for a "Host" type (or at least I can't find it), or to do this I would have to add individual graphs.
I currently have:

Default Tree
- Infrastructure (Heading)
- Host: Switch 1 (Graph)

I have tried changing to natural at the Infrastructure level and click on propagate changes, but it did not affect the each host Host graph.

Am I missing something?

-Thomas
TheWitness wrote: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
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

m4tth3wv,

The picture you post is properly sorted.

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?
m4tth3wv
Posts: 5
Joined: Mon Dec 11, 2006 4:42 pm

Post by m4tth3wv »

The order goes like this:

gi0/1
gi0/10
gi0/11
......
gi0/2

An expected order would be:

gi0/1
gi0/2
gi0/3
.....
gi0/10
gi0/11
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Hmm,

Change the display order from Graph Template to Data Query based for this host and see if it works in one version but not in the next. More QA on contributions I am thinking.

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?
Zxin
Posts: 2
Joined: Sun May 28, 2006 8:10 pm

Post by Zxin »

Worked like a charm for me.
Thanks!

-Thomas
TheWitness wrote:Hmm,

Change the display order from Graph Template to Data Query based for this host and see if it works in one version but not in the next. More QA on contributions I am thinking.

TheWitness
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Zwim,

Can you please add a bug report indicating which host display type is not properly sorting. I don't have the time to research it, and need your feedback. The site is http://bugs.cacti.net

Thanks,

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?
m4tth3wv
Posts: 5
Joined: Mon Dec 11, 2006 4:42 pm

Post by m4tth3wv »

That works for me too.

If Zwim didn't create a bug report, let me know and I will.

Thanks, again.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests