Loading

Tuesday, January 26, 2010

Multi-CPU Utilization Graphing in Cacti

The past couple days I've been installing and configuring a new version of Cacti (0.8.7c) from a CactiEZ v0.6 installation. I've been using Cacti for years now and love what it does, however I've found that tweaking it is sometimes problematic.  Since I may go several months or a year or more between tweaking my install I have to rely heavily on the community.  While the Cacti forums are great they often have an overload of information and even out-dated information.

One aspect I've tried to get working before in Cacti is multi-CPU graphing, but I've never had great success.  Today though I found a great post by Peter at goldfisch.at on the subject - along with some other pretty good gems as well, such as extending Cacti by adding a 5-year graph, configuring Cacti to gather disk I/O and using advanced ping.  He had a great, concise set of steps to download the correct templates (which I've done before) and get them working correctly (this is where I've had trouble).  I'm going to list those steps with a little tweaking of my own mainly so I have them as a ready reference so somewhere down the road I can do this again, but the credit is all his.  Thanks Peter.

This originates from the Cacti forums post "Multi CPU Utilization Graph" which has links to the templates referenced here.  In fact, you may want to go there to find the latest and greatest on this topic.

Begin by downloading the template(s) you need (these links are all from the thread above which were the most current at the time of this post):
Next, import the template(s) in Cacti (Import Templates under Import/Export on the Console tab).  Before creating graphs for devices using any of these new templates they need to be modified a bit, otherwise they may report incorrect data.  To correct this issue click on Graph Management / CDEFs. You should see Average All data sources - X sources (X depending on your setup and the template(s) you imported).  If for some reason you don't see these listed type average in the search field and click Go.



In turn click on each of the Average All data sources - X sources and perform the following:
  • Delete the current CDEF items, such as, "Item #1 Custom String: a,b,+,2,/"
  • Add the following three items:
    • Item #1 - Special Data Source: ALL_DATA_SOURCES_NODUPS (AKA "All Data Sources (Don't Include Duplicates))
    • Item #2 - Custom String: 2/4/8 (depending on X above)
    • Item #3 - Operator: /
Each should like something like this:



Now you can create the graphs for each device.  Click Devices / <Host Name> / create graphs for this host.  Under Graph Templates for the selected host click the drop-down box next to create and select "Host MIB - Multi CPU Utilization on X Processor Box" then click Create. On the next screen you will be asked the Index Type, Index Value and Output Type ID - you don't need to enter any values, just click Create.  You aren't done yet - one more important step.

Click Graph Management and locate the graph you just created.  Under Supplemental Graph Template Data select the CPUs you wish to graph in your multi-CPU graph. This is most likely HOSTNAME - CPU Utilization - CPU0 (cpu), HOSTNAME - CPU Utilization - CPU1 (cpu) and so on ...



Now that that's done you should have nice multi-CPU graphs.  You could even delete any previously created CPU utilization graphs, but be careful not to delete the data-sources because the multi-cpu-graph needs these sources.  The multi-CPU graphs will even read data from existing sources.

Cacti multi-CPU utilization graph showing device with two CPUs graphed over the past 24 hours and 7 days:



Cacti multi-CPU utilization graph showing device with eight CPUs graphed over the past month and year:


11 comments:

  1. This is a great post on cacti graph cpu average. Thanks.

    ReplyDelete
  2. The links to the cacti templates are dead. Any chance the files can be found elsewhere? Didn't find them in the original forum thread either, at least not all 4 listed here.

    ReplyDelete
  3. Links are still dead.

    ReplyDelete
  4. Found them online via googling the filenames
    http://www.goldfisch.at/knowwiki/howtos/cacti

    ReplyDelete
  5. Links are dead, but I found by google. Good job. Thanks!!!!

    ReplyDelete
  6. links are

    http://forums.cacti.net/download/file.php?id=14883
    http://forums.cacti.net/download/file.php?id=11252
    http://forums.cacti.net/download/file.php?id=18379
    http://forums.cacti.net/download/file.php?id=11447

    ReplyDelete
  7. I have a 32-core system, where do I get the template for that? Thanks!

    ReplyDelete
  8. NIce Doc!!. But when i used apve for 2 -core CPU . IT gives me error:

    usr/share/cacti/rra/sapdevpsrv_cpu_934.rrd

    I have to create a file there??

    ReplyDelete
  9. I do step by step . I import 8 cpu graph. I see a result -nan percent. Can you help me please? Thanks friends.
    vinicius.inside@gmail.com. What is a -nan?

    ReplyDelete