Hot To Generate a Custom Color Palette For Cacti Aggregated Graphs
I had a use case where I wanted to colorizes an aggregated graph with a nice gradient color, so I looked to see how to add a new color template to Cacti, but the process is not usable when one need to add a lot of colors, in my case I was looking to add 110 different colors, and using the webUI was not a options. So I looked on the database schema and found that the color template is managed by 3 tables. One manage the template names plugin_aggregate_color_templates
, and the other plugin_aggregate_color_template_items
is a pivot table which manage the colors per template by referencing the colors
table and the plugin_aggregate_color_template
table.
Create a color Palette
First thing first we need to add our new colors to the colors
table, so I looked a bit and found this nice website which allow you to set few colors and define the number of steps between the colors, and I used another site to find a nice palette for “fire” colors. The cool thing for was that the site will auto generate an PHP array snippet which you can copy and use.
The Code
Now we can write a small script which will take the array and generate a new color templates for us