{"id":2495,"date":"2016-08-15T00:00:32","date_gmt":"2016-08-15T07:00:32","guid":{"rendered":"http:\/\/192.168.3.4\/?p=2495"},"modified":"2018-07-05T03:56:45","modified_gmt":"2018-07-05T10:56:45","slug":"cacti-custom-graphing-features","status":"publish","type":"post","link":"https:\/\/www.cloudacm.com\/?p=2495","title":{"rendered":"Cacti Custom Graphing Features"},"content":{"rendered":"<p class=\"western\">The default graphs that ship with Cacti provide a good starting point for your monitoring needs. However, you may find that the graphs don&#8217;t draw attention to what you would like.<\/p>\n<p class=\"western\">In this post, I&#8217;ll cover steps to customize your graphing functions. Also, we&#8217;ll cover ways to get more text information on your graphs, so lets begin.<\/p>\n<p class=\"western\">The default network traffic graph is reminiscent of the days of MRTG. I like to set my graph with both inbound and outbound traffic represented as a solid line and a transparent area. Here is an example of how I set it up.<\/p>\n<p class=\"western\"><a href=\"http:\/\/192.168.3.4\/wp-content\/uploads\/2016\/08\/CactiGraphCustom1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2504 aligncenter\" src=\"http:\/\/192.168.3.4\/wp-content\/uploads\/2016\/08\/CactiGraphCustom1.png\" alt=\"CactiGraphCustom1\" width=\"595\" height=\"210\" srcset=\"https:\/\/www.cloudacm.com\/wp-content\/uploads\/2016\/08\/CactiGraphCustom1.png 595w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2016\/08\/CactiGraphCustom1-300x106.png 300w\" sizes=\"auto, (max-width: 595px) 100vw, 595px\" \/><\/a><\/p>\n<p class=\"western\">The legend has the solid colors to represent the values. The transparency prevents readings from being masked by top layer values. To get these settings on your graphs, you&#8217;ll need to edit them. Go to Console \/ Management \/ Graph Management. Select the graph you want to edit, in my example, that is Localhost \u2013 Traffic \u2013 wlan0. Click the link in the upper right hand corner, \u201cEdit Graph Template\u201d.<\/p>\n<p class=\"western\">This is were the magic happens. In the top section \u201cGraph Template Items\u201d, click on the item that denotes the inbound traffic, mine says \u201c(traffic_in): Inbound\u201d.<\/p>\n<p class=\"western\">The values I have set for my Inbound Line graph are as follows:<\/p>\n<p><em>Data Source: Interface \u2013 Traffic &#8211; (traffic_in)<\/em><br \/>\n<em>Color: 00CF00<\/em><br \/>\n<strong><em>Opacity\/Alpha Channel: 100%<\/em><\/strong><br \/>\n<strong><em>Graph Item Type: LINE1<\/em><\/strong><br \/>\n<em>Consolidation Function: AVERAGE<\/em><br \/>\n<em>CDEF Function: None<\/em><br \/>\n<em>Value:<\/em><br \/>\n<em>GPRINT Type: Normal<\/em><br \/>\n<strong><em>Text Format: Inbound<\/em><\/strong><br \/>\n<em>Insert Hard Return:<\/em><br \/>\n<strong><em>Sequence: 2<\/em><\/strong><\/p>\n<p>For my Inbound Area graph, these are the settings:<\/p>\n<p><em>Data Source: Interface \u2013 Traffic &#8211; (traffic_in)<\/em><br \/>\n<em>Color: 00CF00<\/em><br \/>\n<strong><em>Opacity\/Alpha Channel: 40%<\/em><\/strong><br \/>\n<strong><em>Graph Item Type: AREA<\/em><\/strong><br \/>\n<em>Consolidation Function: AVERAGE<\/em><br \/>\n<em>CDEF Function: None<\/em><br \/>\n<em>Value:<\/em><br \/>\n<em>GPRINT Type: Normal<\/em><br \/>\n<strong><em>Text Format: <\/em><\/strong><br \/>\n<em>Insert Hard Return:<\/em><br \/>\n<strong><em>Sequence: 10<\/em><\/strong><\/p>\n<p class=\"western\">I put emphasis on the items that were different to draw your attention to what&#8217;s going on here.<\/p>\n<p class=\"western\">The Opacity value dictates how dark or light the graph item color should be in respect to its transparency. You can see that the area graph is 40% transparent, were as the line graph has no transparency. Also, you can see that the Graph Item Type tells what kind of graph to draw, ie LINE1 with a line width of 1 pixel, AREA for a solid graphing area.<\/p>\n<p class=\"western\">The Text Format field is what appears in the graph legend along with a color box. I like to keep the non transparent colors out of the legend. The faded look can cause some visual confusion for me. However, format as you like.<\/p>\n<p class=\"western\">The Sequence value is something I&#8217;ll explain in a bit. It will be easier to understand once I bring it all together.<\/p>\n<p class=\"western\">The Outbound graph items are similar with the only key differnces being these:<\/p>\n<p><em>Data Source: Interface \u2013 Traffic &#8211; (traffic_out)<\/em><br \/>\n<em> Color: 0D006A<\/em><br \/>\n<em> Text Format: Outbound<\/em><\/p>\n<p class=\"western\">I follow the same Opacity and Graph Type conventions as I did with the Inbound traffic. Also, the legend value reflects what type of graph item this is.<\/p>\n<p class=\"western\">Now, back to the Sequence values. The graph items are basically images that Cacti will create with the built in RRDTool function. Each item represents a layer image that will be stacked over the following graph items, much like cut out pieces of construction paper are stacked on each other.<\/p>\n<p class=\"western\">I like to keep my area graph items on the bottom of the stack and my line graph items on the top. Reversing this order can wash out the line readings visually, should the area values exceed a line value.<\/p>\n<p class=\"western\">Now the legend values that appear that show numeric values is a graph item that uses GPRINT. I haven&#8217;t covered this yet, so lets cover it now.<\/p>\n<p class=\"western\">One of my graph items that deals with these type of readings is set as follows:<\/p>\n<p><em>Data Source: Interface \u2013 Traffic &#8211; (traffic_in)<\/em><br \/>\n<em>Color: None<\/em><br \/>\n<em>Opacity\/Alpha Channel: 100%<\/em><br \/>\n<strong><em>Graph Item Type: GPRINT<\/em><\/strong><br \/>\n<strong><em>Consolidation Function: LAST<\/em><\/strong><br \/>\n<em>CDEF Function: None<\/em><br \/>\n<em>Value:<\/em><br \/>\n<em>GPRINT Type: Normal<\/em><br \/>\n<strong><em>Text Format: Current:<\/em><\/strong><br \/>\n<em>Insert Hard Return:<\/em><br \/>\n<em>Sequence: 3<\/em><\/p>\n<p class=\"western\">Again, drawing attention to the key values. GPRINT tells Cacti I want to write text to the graph legend at the bottom. The Text Format value is how I&#8217;m labeling the value in the graph.<\/p>\n<p class=\"western\">The actual reading value is from the Consolidation Function setting. This can be set to LAST, MIN, MAX, or AVERAGE.<\/p>\n<p class=\"western\">That pretty much covers how to customize the graphing in Cacti to suit your needs. Now I&#8217;ll cover how to plot values that are unknown.<\/p>\n<p class=\"western\"><a href=\"http:\/\/192.168.3.4\/wp-content\/uploads\/2016\/08\/CactiGraphCustom2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2508\" src=\"http:\/\/192.168.3.4\/wp-content\/uploads\/2016\/08\/CactiGraphCustom2.png\" alt=\"CactiGraphCustom2\" width=\"595\" height=\"224\" srcset=\"https:\/\/www.cloudacm.com\/wp-content\/uploads\/2016\/08\/CactiGraphCustom2.png 595w, https:\/\/www.cloudacm.com\/wp-content\/uploads\/2016\/08\/CactiGraphCustom2-300x113.png 300w\" sizes=\"auto, (max-width: 595px) 100vw, 595px\" \/><\/a><\/p>\n<p class=\"western\">There are occasions when gaps in your graph could mislead you to believe the readings are low. Placing unknown plot values can help you avoid this confusion. From the graph in this example, we can tell the system is off-line and not just idle.<\/p>\n<p class=\"western\">To do this we need to create a special CDEF called \u201cUnknown\u201d. First, lets get into the Cacti Console \/ Management \/ Graph Management \/ CDEFs page. Click \u201cAdd\u201d from the upper right hand corner of the page.<\/p>\n<p class=\"western\">Enter in the new CDEF&#8217;s name, we&#8217;ll call it \u201cUnknown\u201d. Now we can add our CDEF Items, of which we will add 5 in total. Here is what you should enter in for each item and their order.<\/p>\n<p><em>Item 1<\/em><br \/>\n<em>CDEF Item Type: Special Data Source<\/em><br \/>\n<em>CDEF Item Value: Current Graph Item Data Source<\/em><\/p>\n<p><em>Item 2<\/em><br \/>\n<em>CDEF Item Type: Custom String<\/em><br \/>\n<em>CDEF Item Value: UN<\/em><\/p>\n<p><em>Item 3<\/em><br \/>\n<em>CDEF Item Type: Function<\/em><br \/>\n<em>CDEF Item Value: INF<\/em><\/p>\n<p><em>Item 4<\/em><br \/>\n<em>CDEF Item Type: Function<\/em><br \/>\n<em>CDEF Item Value: UNKN<\/em><\/p>\n<p><em>Item 5<\/em><br \/>\n<em>CDEF Item Type: Function<\/em><br \/>\n<em>CDEF Item Value: IF<\/em><\/p>\n<p class=\"western\">The CDEF should read \u201ccdef=CURRENT_DATA_SOURCE,UN,INF,UNKN,IF\u201d<\/p>\n<p class=\"western\">I won&#8217;t explain what each means, it will result in a long and lengthy read. You can find out more on the Cacti website, <a href=\"http:\/\/www.cacti.net\/\">http:\/\/www.cacti.net<\/a><\/p>\n<p class=\"western\">Now we can edit our Graph Template and add our new CDEF to plot any unknown data readings. Do this by going to Console \/ Management \/ Graph Management \u2013 Select the graph you want to add the CDEF to. Next, select Edit Graph Template from the upper right hand corner.<\/p>\n<p class=\"western\">In the Graph Template Items, note the Data Source then click the \u201cAdd\u201d link. My example used a Data Source of \u201c(load_1min)\u201d<\/p>\n<p class=\"western\">Set the values of the Graph Template Item as such:<\/p>\n<p><em>Data Source: Unix \u2013 Load Average &#8211; (load_1min)<\/em><br \/>\n<em>Color: FFC350<\/em><br \/>\n<strong><em>Opacity\/Alpha Channel: 100%<\/em><\/strong><br \/>\n<strong><em>Graph Item Type: AREA<\/em><\/strong><br \/>\n<em>Consolidation Function: AVERAGE<\/em><br \/>\n<strong><em>CDEF Function: Unknown<\/em><\/strong><br \/>\n<em>Value:<\/em><br \/>\n<em>GPRINT Type: Normal<\/em><br \/>\n<em>Text Format: <\/em><br \/>\n<em>Insert Hard Return:<\/em><br \/>\n<strong><em>Sequence: 1<\/em><\/strong><\/p>\n<p class=\"western\">Just like before, I have drawn your attention to the key values in this graph template item.<\/p>\n<p class=\"western\">I typically set this item as the first of the sequence, this is because I want these reading to be on top and not masked by other values.<\/p>\n<p class=\"western\">Next, I set my color to pink and graph it as a non transparent area. This makes it easier to view since I rarely use pink for any other graph function.<\/p>\n<p class=\"western\">Click Save and now your graph should plot values that are non numeric as unknown.<\/p>\n<p class=\"western\">Conclusion, there is a bunch more you can do with Cacti. This is just a sample of some of the customization you can do.<\/p>\n<p class=\"western\"><strong>I would like to thank Paul Porter for his write up, check it ou<\/strong>t.<\/p>\n<p class=\"western\"><span style=\"color: #0563c1;\"><span lang=\"zxx\"><u><a href=\"https:\/\/paulgporter.net\/2012\/12\/12\/enhanced-cacti-graph\/\">https:\/\/paulgporter.net\/2012\/12\/12\/enhanced-cacti-graph\/<\/a><\/u><\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The default graphs that ship with Cacti provide a good starting point for your monitoring needs. However, you may find that the graphs don&#8217;t draw attention to what you would like. In this post, I&#8217;ll cover steps to customize your graphing functions. Also, we&#8217;ll cover ways to get more text information on your graphs, so lets begin. The default network traffic graph is reminiscent of the days of MRTG. I like to set my graph with both inbound and outbound&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.cloudacm.com\/?p=2495\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,3],"tags":[],"class_list":["post-2495","post","type-post","status-publish","format-standard","hentry","category-data-mining","category-rd"],"_links":{"self":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/2495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2495"}],"version-history":[{"count":13,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/2495\/revisions"}],"predecessor-version":[{"id":3346,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/2495\/revisions\/3346"}],"wp:attachment":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}