Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Colors: opacity using optional alpha in rrdtool

 
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti
Author Message
Mikf



Joined: 13 Aug 2004
Posts: 36
Location: Paris, France

PostPosted: Thu Oct 18, 2007 10:16 am    Post subject: Colors: opacity using optional alpha in rrdtool Reply with quote

hi!

I have search in the forum, if there is a project for using the alpha optional component of the color attribut. But i found nothing usable...
And i didn't read anything on this subject in the roadmap

So, here is my work on the subject.

I have appended a field name 'alpha' in the 'graph_templates_item ' table :

mysql command to append the field:
#alter table graph_templates_item add alpha varchar(2) default "FF";

the code is in the patch file attached.

to use with rrdtool 1.2.x

EDIT 24/oct/2007 : added patch for cacti 0.8.7 with plugin arch



alpha.jpg
 Description:
Example
 Filesize:  466.6 KB
 Viewed:  11236 Time(s)

alpha.jpg



alpha_option.jpg
 Description:
item option
 Filesize:  61.15 KB
 Viewed:  11236 Time(s)

alpha_option.jpg



alpha-colors.patch
 Description:
Version 1.0 opacity option for cacti 0.8.7 + plugin arch
oct 24 2007

Download
 Filename:  alpha-colors.patch
 Filesize:  4.57 KB
 Downloaded:  398 Time(s)


alpha-colors.patch
 Description:
Version 1.0 opacity option for cacti 0.8.6j
oct 18 2007

Download
 Filename:  alpha-colors.patch
 Filesize:  4.58 KB
 Downloaded:  294 Time(s)



Last edited by Mikf on Wed Oct 24, 2007 1:59 pm; edited 1 time in total
Back to top
fmangeant
Cacti Guru User


Joined: 19 Sep 2003
Posts: 2325
Location: Sophia-Antipolis, France

PostPosted: Tue Oct 23, 2007 4:37 am    Post subject: Reply with quote

Very nice, thanks !
Back to top
cigamit
Developer


Joined: 07 Apr 2005
Posts: 978
Location: B/CS Texas

PostPosted: Tue Oct 23, 2007 5:04 pm    Post subject: Reply with quote

Nice patch, testing it on my production box now.
Back to top
Mikf



Joined: 13 Aug 2004
Posts: 36
Location: Paris, France

PostPosted: Wed Oct 24, 2007 2:00 pm    Post subject: Reply with quote

added patch for cacti 0.8.7 with plugin arch
Back to top
jay
Cacti User


Joined: 31 Aug 2005
Posts: 252
Location: Bristol, England

PostPosted: Tue Oct 30, 2007 7:11 am    Post subject: Reply with quote

Hi

I have applied the patch but I'm unable to get this working as my graphs disappear.

I downloaded the win32 GNU version of Patch and did the following:-

C:\Apache2\htdocs\cacti>patch -p1 -N < alpha_colors_201.patch
patching file graphs_items.php
patching file graph_templates_items.php
patching file include/config_arrays.php
patching file include/config_form.php
patching file lib/rrd.php
Hunk #1 succeeded at 557 (offset 2 lines).
patch unexpectedly ends in middle of line
Hunk #2 succeeded at 1103 with fuzz 1 (offset 8 lines).


I then downloaded the patch again and turned off word wrap within notepad in case that was causing and problem and re-applied.

C:\Apache2\htdocs\cacti>
C:\Apache2\htdocs\cacti>patch -p1 -N < alpha_colors.patch
The system cannot find the file specified.

C:\Apache2\htdocs\cacti>patch -p1 -N < alpha-colors.patch
patching file graphs_items.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file graphs_items.php.rej
patching file graph_templates_items.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file graph_templates_items.php.rej
patching file include/config_arrays.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file include/config_arrays.php.rej
patching file include/config_form.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file include/config_form.php.rej
patching file lib/rrd.php
Reversed (or previously applied) patch detected! Skipping patch.
patch unexpectedly ends in middle of line
2 out of 2 hunks ignored -- saving rejects to file lib/rrd.php.rej


When I went to check my graphs they had weren't there ( I had a look through the logs and saw the following:-

10/30/2007 11:38:07 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed "select graph_templates_item.id as graph_templates_item_id, graph_templates_item.cdef_id, graph_templates_item.text_format, graph_templates_item.value, graph_templates_item.hard_return, graph_templates_item.consolidation_function_id, graph_templates_item.graph_type_id, graph_templates_gprint.gprint_text, colors.hex, graph_templates_item.alpha, data_template_rrd.id as data_template_rrd_id, data_template_rrd.local_data_id, data_template_rrd.rrd_minimum, data_template_rrd.rrd_maximum, data_template_rrd.data_source_name, data_template_rrd.local_data_template_rrd_id from graph_templates_item left join data_template_rrd on (graph_templates_item.task_item_id=data_template_rrd.id) left join colors on (graph_templates_item.color_id=colors.id) left join graph_templates_gprint on (graph_templates_item.gprint_id=graph_templates_gprint.id) where graph_templates_item.local_graph_id=371 order by graph_templates_item.sequence"


Also when I looked at a graph template and looked at one of the items I saw the following:-

Notice: Undefined index: alpha in C:\Apache2\htdocs\cacti\graph_templates_items.php on line 335


I don't use the plugin arch. The only modification I have done to Cacti is to the colours.

http://forums.cacti.net/viewtopic.php?t=6308&highlight=colors

Any ideas???

Jay
Back to top
streaker69
Cacti Pro User


Joined: 27 Mar 2006
Posts: 647
Location: Psychic Amish Network Administrator

PostPosted: Tue Oct 30, 2007 7:35 am    Post subject: Reply with quote

Very cool addon. Worked perfectly!
Back to top
Mikf



Joined: 13 Aug 2004
Posts: 36
Location: Paris, France

PostPosted: Tue Oct 30, 2007 7:42 am    Post subject: Reply with quote

Jay : do you have done this :
alter table graph_templates_item add alpha varchar(2) default "FF";
on your cacti database ?
Back to top
jay
Cacti User


Joined: 31 Aug 2005
Posts: 252
Location: Bristol, England

PostPosted: Tue Oct 30, 2007 7:43 am    Post subject: Reply with quote

aaaaah..that might be the problem as I didn't run this command within the database. I will try this now and get back to you.

Thanks for the quick response.

Jay
Back to top
jay
Cacti User


Joined: 31 Aug 2005
Posts: 252
Location: Bristol, England

PostPosted: Tue Oct 30, 2007 8:55 am    Post subject: Reply with quote

Hi

That's works like a charm now ) . Thanks for your assistance.

How do you get your graphs to look like the one you have shown?? I like the way you have drawn a line over the coloured area to define the graphs better. I have tried this and I can get the line drawn over the area but it shows both of the colours under the graphs as shown in my screenshots. I would like it so that it just shows one of the colours within the legend as yours does.

Jay



TrafficStats_graph_template.jpg
 Description:
 Filesize:  21.12 KB
 Viewed:  10778 Time(s)

TrafficStats_graph_template.jpg



TrafficStats.jpg
 Description:
 Filesize:  32.81 KB
 Viewed:  10778 Time(s)

TrafficStats.jpg


Back to top
chrisgapske
Cacti User


Joined: 22 May 2007
Posts: 268
Location: Padacuh, Ky-Alpena, MI-Gulf Shores,AL

PostPosted: Tue Oct 30, 2007 9:14 am    Post subject: This is really nice. Reply with quote

I hope the devolipers add this to the base code it is a great and simple option.

I don't want to loose it when I upgrade to 0.8.8/0.9.0.
Back to top
Mikf



Joined: 13 Aug 2004
Posts: 36
Location: Paris, France

PostPosted: Tue Oct 30, 2007 6:22 pm    Post subject: Reply with quote

Jay: the screen of the items i used


items.jpg
 Description:
 Filesize:  497.96 KB
 Viewed:  10734 Time(s)

items.jpg


Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12642
Location: Muenster, Germany

PostPosted: Thu Nov 08, 2007 5:36 am    Post subject: Re: This is really nice. Reply with quote

chrisgapske wrote:
I hope the devolipers add this to the base code it is a great and simple option.

I don't want to loose it when I upgrade to 0.8.8/0.9.0.
It's on my todo list. We won't loose it
Reinhard
(a devoliper I love this typo )
Back to top
chrisgapske
Cacti User


Joined: 22 May 2007
Posts: 268
Location: Padacuh, Ky-Alpena, MI-Gulf Shores,AL

PostPosted: Thu Nov 08, 2007 8:59 am    Post subject: Reply with quote

That is great to hear.

Thanks as always.
Back to top
fmangeant
Cacti Guru User


Joined: 19 Sep 2003
Posts: 2325
Location: Sophia-Antipolis, France

PostPosted: Mon Nov 19, 2007 9:51 am    Post subject: Reply with quote

For those who haven't upgraded to Cacti 0.8.7a, this nice patch has been added to the Cacti core
Back to top
TFC
Cacti Pro User


Joined: 09 Apr 2003
Posts: 617
Location: Izmir/Turkey

PostPosted: Thu Nov 13, 2008 9:57 am    Post subject: Reply with quote

Mikf wrote:
Jay: the screen of the items i used


There are 4 legent exists. How to hide 2 of them. One of outbound other one is inbound?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group