Collectd Graph Panel v0.4

After 2,5 years and about 100 commits I’ve tagged version 0.4 of Collectd Graph Panel.

This version includes a new interface with a sidebar for plugin selection.

Javascript library jsrrdgraph has been integrated. Graphs will be rendered in the browser using javascript and HTML5 canvas by setting the “graph_type” configuration option to “canvas”. This saves a lot of CPU power on the server. Jsrrdgraph has some nice features. When rendered, you can move through time by dragging the graph from left to right and zoom in and out by scrolling on the graph.


The Collectd compatibility setting has been changed to Collectd 5. If you’re still using Collectd 4, please set the “version” configuration setting to “4”, otherwise the graphs of a couple plugins won’t be showed right (like the interface, df, users plugins).

In this version of CGP, total values are added to the legend of I/O graphs and generated colors will be created using a rainbow palette instead of 9 predefined colors. Please read the changelog or git log for more information about the changes.

New plugins:

Special thanks for this version go to Manuel Luis, who developed jsrrdgraph, xian310 for the new interface, Manuel CISSÉ, Rohit Bhute, Matthias Viehweger, Erik Grinaker, Peter Chiochetti, Karol Nowacki, Aurélien Rougemont, Benjamin Dupuis, yur, Philipp Hellmich, Jonathan Huot, Neptune Ning and Nikoli for their contributions.

I’ve been using GitHub for a while now. You can download or checkout this version of CGP from the GitHub URL’s below. When you have improvements or fixes for CGP, don’t hesitate to send in a Pull Request on GitHub!

v0.4.1 update

I just removed the dependency on mod_rewrite when using jsrrdgraph to draw the graphs. This may solve javascript error:Β Invalid RRD: “Wrong magic id.” undefined.

Git: git clone

67 thoughts on “Collectd Graph Panel v0.4

  1. Conrad

    Pretty Cool! πŸ™‚
    Hope, there will be in future also plugins for openvpn and thermal πŸ™‚

  2. Tom

    I’ve check out the newest version from git. I’ve enabled canvas mode πŸ™‚
    But it still give me only Invalid RRD: β€œWrong magic id.” undefined. πŸ™

    Is this, because I am using nginx? I don’t have apache and mod_rewrite

  3. pommi Post author

    Hi Tom! mod_rewrite isn’t required, so that shouldn’t be the problem.

    I’ll try to explain what is going on. With canvas enabled, the graphs are created by javascript. To provide the rrd files to javascript, I created rrd.php. So javascript downloads the needed RRD file for the Load graph via for example: http://domain.tld/rrd.php/your-hostname/load/load.rrd. When you look at the HTML source you can see what RRD files are downloaded between the canvas tags.

    You’ll get this message when downloading the required RRD files fails some way. To debug this problem, please download one of the RRD files manually and see what you get. An error?

  4. Tom

    Hi Pommi,
    thanks for your anwer.

    When I try to load : i am getting a 404 error my nginx.

  5. Tom

    Sorry, forgot to attach log :/

    2013/06/01 00:02:30 [error] 25941#0: *253 open() “/var/www//htdocs/cgp/rrd.php//load/load.rrd” failed (20: Not a directory)

  6. Conrad

    I’ve tried to create an openvpn-plugin. But is only half working :/
    I get the users graph, but the correct ds-name is not set.

    The traffic graph seems not to be created. PHP-Error says:
    Undefined index in GenericIO.class.php on line 46
    Undefined index in GenericIO.class.php on line 46
    (also line 52,53,50,60)

    Don’t know why. Could you have a look?

    Structure is:


  7. l13t

    Also i’ve trouble with NUT plugin.
    I’ve errors when web interface try to show information about UPS frequency.
    There is difference between original variant of plugin and my resolution of problem.

    diff cgp.orig/plugin/nut.php cgp/plugin/nut.php master * ] 11:18 AM
    data_sources = array(‘value’);

    > $obj->data_sources = array(‘frequency’);

  8. yeah

    is this new version compatible with the rrd format created by collectd 4.10? 4.10 is what’s available for redhat/centos 6. for my centos 6 hosts, graphs aren’t being displayed for df, interface, ntpd, and users. cgp-0.3 displays all graphs just fine. also, cgp-0.4 displays all graphs fine on my debian wheezy hosts.

  9. pommi Post author

    hi yeah, please read the blog again, and in particular the part about collectd 4…

  10. yeah

    yep, actually fully reading the blog post and implementing the needed change in config.local.php worked great. sorry to bother…

  11. Conrad

    Btw pommi, can you have a look at my git pull? πŸ™‚ Would be nice, if this could be merged for nginx-users.


  12. pommi Post author

    l13t: tnx for your post about the NUT plugin. It should be fixed now.

  13. Tasslehoff

    Hi, I got an error that seems like the problem Conrad reported.

    I configured collectd for a tplink access point interfaces via snmp plugin, rrd file seems fine but collectd returns these errors on apache error_log:
    PHP Notice: Undefined index: eth0-rx in /cgp/type/GenericIO.class.php on line 59, referer: https://serverhostname/cgp/host.php?h=tplink.local&p=snmp

    I’m using the last version of cgp (via git) and collectd version 5.1.0 (debian wheezy main repository).

    Any suggestion?


  14. Conrad

    There seems to be a problem with ping :/ When I open it, I can see a graph for latency, but there is also an popup with an error “Unknown argument: undefinied”

    PHP Logs here:


  15. Nik

    Goog products.
    But when graph_type is “canvas” I can’t open details graph (detail.php)

  16. pommi Post author

    Hi Nik, indeed, this isn’t possible at the moment.

    @Conrad: fixed!

  17. Conrad

    Thank you for fixing πŸ™‚
    Btw, it would be very nice, if it would be possible to define the names for myself (vertical_label, ds-names), like its possible with collection3 iirc.

  18. djtremors

    Works nicely as expected. Was looking and liking jarmon which had tabs and dynamic building of the page without having to reload the whole page. only downside of the lacking examples of how to support multiple hosts and configs to suit.
    Although I managed to get Jarmon working with multiservers, configs were a pain.
    CGP simply reads all the dirs/files and renders whats available as any gui should.

    Only would like to suggest a more dynamic page where jquery to load the page would make this more ultimate. Also give ability to segregate the areas like jarmon, ie system, network, disk, etc as so far I see only a page reload possible.

  19. Radu Rambet

    Great plugin. Just awesome.

    Would it be possible to write additional plugin for openwrt type of data
    Collectd is great for embedded applications like openwrt but theirs plugin are a little bit different and especially designed for wireless.

    I would like to be Abe to write myself additional plugin for iwinfo for instance. Is there any tutorial how to add additional plugin to graph panel v. 4?

    Thank you!

  20. djtremors

    For those of you who have nginx and issues with collectd 5 with canvas mode still getting “wrong magic id”. this is a workaround I wrote since rrd.php expects $_SERVER[‘PATH_INFO’] to exist which is Apache only. I fudged the 2 files below to make this work with no rewrite or anythign and works for my nginx setup.

    I’ve commented out one line and added one below, further below added a section under the EITHACK comment.

    function parse_filename($file) {
    if ($this->graph_type == 'canvas') {
    // EITHACK
    //$file = 'rrd.php/' . str_replace($this->datadir . '/', '', $file);
    // EITHACK
    $file = 'rrd.php?' . str_replace($this->datadir . '/', '', $file);
    return $this->rrd_escape($file);

    require_once 'inc/';
    // EITHACK
    if (!isset($_SERVER['PATH_INFO']))
    if ($file = validateRRDPath($CONFIG['datadir'], $_SERVER['PATH_INFO'])) {

  21. pommi Post author

    @Philipp: nope, unfortunately not. I test every plugin I initially add. So I need to install redis, connect collectd and understand a little bit what is going on. This is time consuming… But when I have time, I add it πŸ˜‰
    @djtremos: Please have a look at, for more info about the PATH_INFO variable and Nginx. Thanks for the jquery suggestion. Too bad I’m not a very good frontend developer. Thomas Harold has done some work on jquery. You can probably try his version of CGP some time.
    @Radu: Which plugins aren’t working with OpenWRT, only iwinfo? About writing your own CGP plugin, just try to copy the php of a plugin that looks a bit alike, and change/adjust it to make it work.

  22. gdi67

    I can’t drag the graph like you did in the video. I installed CGP in the NGINX with php-fpm. All of them are in the latest version. Do I need any further configuration?

  23. Radu

    Problem solved .
    iwinfo IS working on openwrt it is just it does not have proper php file on my server.(Debian) I just updated by hand and everything is ok.

    Abut my own plugins i read a bit and managed to do it myself .Easy.
    Great work anyhow

  24. tom wang

    i am using 0.4 and 0.41 to monitor our test website, it reported that error: could not parse color in ‘ ‘ on the interface rrd file. I do not know what is wrong, anyone could help?

  25. Alex Juarez

    Just for anybody else who comes across the “wrong magic id” issue. This is an example of the fastcgi_split_path_info that worked for me.

    location ~ ^(.*\.php)(.*)$ {
    root /var/www/html;
    fastcgi_index index.php;

    fastcgi_split_path_info ^(.+php)(.*)$;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    include fastcgi_params;

  26. Didi


    I want to make a Python Plugin which should displayed like the load plugin… How can I realise this? I can make “normal” graphes but this one with just lines like the load plugin I cant… i hope somepne can help me πŸ˜‰

  27. chris


    I want to use the mongodb write plugin, is there a chance to use CGP with a mongo data source?

  28. pommi Post author

    Hi Chris, currently there is no support in CGP for that.

    @Markus: See js/RrdGraph.js; search for font.

  29. Boris

    thanks a lot for your last release. canvas option is very useful.
    Do you forecast to develop a plugin for jmx rrd files >> GenericJMX?
    It would be quite interesting to know about the memory used by my tomcat server(garbage collector…).

  30. Tasslehoff

    Hi, I have a suggestion.
    Is it possibile to leave the 2hr/8hr/day/week/month/ etc etc links also when selecting graph_type=canvas?

  31. Pingback: Simple web based system monitoring on Ubuntu Server :

  32. Ilya

    Hi, first of all thanks for the great interface.
    One question: I wrote a simple script which is executed via exec plugin and returns the ldap response types:
    PUTVAL myhost/LdapSearch/duration interval=10 N:41
    In the interface I am getting an error. Is there any easy way to include some arbitrary exec plugin or any workaround for me to see that graph?

  33. Ilya

    Yes, I got no error, but the graph simply was not there. Now I got it: There need to be a php file for each plugin one needs (as ldapsearch was a custom one, I simply had to write one πŸ˜‰ ). so I modified the load plugin the following way

    data_sources = array('seconds');
    $obj->ds_names = array(
    'seconds' => 'seconds',
    $obj->colors = array(
    'seconds' => '00ff00',
    $obj->rrd_title = 'Request Duration';
    $obj->rrd_vertical = 'Seconds';
    $obj->rrd_format = '%.2lf';


    Only one question (I hardly speak php): Is there a way to put the list of machines supervised by collectd (as shown on the index page) beside the plugin list?

    Thanks a lot

  34. pommi Post author

    @Ilya please download the latest version of CGP. I’ve dropped the PHP file per plugin recently. This is not required anymore. The plugin PHP files have been replaced by JSON files that just makes the graphs prettier.

  35. FamilyMan

    Hey pommi. Great work!
    I’m not aware about web servers and PHP but I’d like to setup CGP to monitor collectd statictics from time to time. Can you please share with me a short guide how can I do it based on nginx, apache, any other web server software?
    P.S. My system is up-to-date ArchLinux x64, I can install and configure everything on it.
    Btw, I’d prepare a package for Arch if you explain me what and where shoud be copied/installed, explain dependencies etc.

  36. FamilyMan

    Hi pommi,
    I found an explanation ( and have installed the lighttpd + CGP.
    Then I got an error: Error: No Collectd hosts found in /var/lib/collectd/rrd
    After a short research I found the answer:

    Hi Xan, This message can mean 2 things:
    1. Your collectd datadir is not in /var/lib/collectd/rrd. Set $CONFIG[‘datadir’] in conf/config.local.php to set the correct one.
    2. Your webserver user (for example: user www-data when Debian/Apache2) is not allowed to read the files in /var/lib/collectd/rrd

    The #1 is not my case for sure.
    Regarding #2. The /var/lib/collectd/rrd contains the data for sure:

    # ls -R /var/lib/collectd/rrd

    cpu-0 hddtemp interface-lo interface-net1 memory sensors-atk0110-acpi-0
    cpu-1 interface-cipsec0 interface-net0 load nut sensors-coretemp-isa-0000

    The #2 I’ve tried to fix by set chown -R http.http on /var/lib/collectd:

    ls -lR /var/lib/collectd

    total 4
    drwxr-xr-x 14 http http 4096 Jul 27 10:33 localhost.localdomain

    total 48
    drwxr-xr-x 2 http http 4096 Jul 26 19:04 cpu-0
    drwxr-xr-x 2 http http 4096 Jul 26 19:04 cpu-1

    But it doesn’t help.
    The lighttpd is running under http.http … Any thoughts?

  37. FamilyMan

    Ok, I found the answer: php.ini should be updated to allow access into /var/lib/collectd/rrd and /usr/bin folders.

  38. suli


    I am running collectd on my router and I don’t need to view the statistics real time. So I copy the /collectd/rdd to my windows laptop, download the rddtool for windows (with cygwin) and run CGP in XAMMP.
    It doesn’t surprise me that I can not get it work straightly with path like “C:\collectd\rdd” and “C:\collectd\rddtool”.

    What format of path should I put in config.local.php file, so it can be recogonized by CGP in XAMMP on windows?

    thanks a lot.

  39. suli

    Forget the XAMMP on windows, I saved my life by intalling it on a debian VM. And then I managed to make it run on my openwrt box too (uhttpd+php+rrdtool), with a few code fix ( although it take me a long time).

    My suggestion for someone else have troubles running CGP:
    1. make sure your collectd work well. Go to the rrd file directory “ls -l” to corfirm that all rrd files are there and updated
    2. Follow the address of the error page. If it is a broken image icon, right click it and copy the image link, paste it into a new browser window to see the detail.
    3. There are php file name in the link. Go to /www/CGP directory, find the exact php file, open it with edit, try to understand how it work. Follow the procedure, check output of every variable using echo and print_r. Google the function or the output error message to understand how it work and the reason of error, so you can know why it didn’t work as you expected and then google the fix solution.
    4. The working copy on the vm is very useful, as it provide something I can compare to.
    5. understand how collectd manage its plugin and rrd file is also required

    I am not a php programmer and not a native English user either, so it is not as difficult as you think ^_^

  40. pommi Post author

    Fantastic suli! This is amazing. πŸ˜€ I saw your 1st reply a month ago and thought: OMG not Windows πŸ˜• I was pleasantly surprised when red you installed it on Debian! 😎 Great way to go. Thanks for your debugging steps as well.

  41. suli

    Some information about collectd csv file to graphic :

    RRD is great for trend, but I have some data saved to csv so that I can retrieve the exact value. So I need some tools that can get the csv file from server and make chart out of it. Finally, I find dygraphs, it seems just suit my needs. I will do some homework to make it work for me, or even try to combine it with CGP code (the part that phrase the collectd data directory)

    Maybe someone have done this already, please let me know, thanks.

  42. Vin

    Hi All,

    First of all, to pommi, thanks for for building CGP. It is an awesome tool and the best front-end I have seen for collectd.

    I need some help though, do you know if the file and aggregate plugins are supported?

    I tried to aggregate the CPU here but CGP is not rendering the images, and I haven’t found a place to enable debugging to see what is breaking.

    Similarly, the file plugin is not returning anything. I do have data in the rrd files though.

    Any idea as to why?


  43. Alexey Portnov

    I gather stat for 3 interfaces from our firewall/router.
    Is it possible to create separate graph for each interface like it was in cgp-0.3?

  44. Matt Garrett

    Nice tool.

    When doing category of hosts to show on main page
    Is it possible to use wildcards ?
    $CONFIG[‘cat’][‘Bangalore’] = array(‘bngsti-n-b*’);

    So that all host names that start with bngsti-n-b have a category under Bangalore

  45. A Mac User

    The following link contains a collection of changes I made to CGP (forgot to mention, elsewhere, I’m using collectd 5.7.0):

    I’ve added various features along with some cosmetic changes. I don’t have a github account and don’t need nor want to set one up at this point. Hopefully you’ll agree that at least some of these changes are worth propagating to your code-base and uploading to github.

    The following changes were made:

    – config.php: added a ‘use_json_order’ config item to allow the order of the
    graphs shown on a web page to be controlled by the order of the entries in the
    json file

    – config.php: added a ‘mapped_names’ config item to allow host, plugin and
    instance names to be translated for web-page/graph display purposes, only

    – config.php: added a ‘show_all_in_non_overview’ config item to all the
    overview-plugin links to also be shown in the list of non-overview plugins

    – detail.php: change(s) to support the ‘use_json_order’ config item (see next
    item, also)

    – detail.php: updated/added some comments — note that there may be additional
    changes required to support ‘use_json_order’ … I’m using the canvas graph
    type and did not test my changes with any other type (since setting the png
    graph type yields multiple graphing failures on OS X 10.8.5, whereas canvas
    graphs all worked well — nice work!) … I’m also not using the aggregation
    plugin for anything, so that could also cause some perturbations

    – graph.php: some change(s) to support the ‘mapped_name’ config item and some
    code reformatting changes

    – host.php: change(s) to support the ‘mapped_name’ config item

    – change(s) to support the ‘use_json_order’ and ‘mapped_name’
    config item

    – change(s) to support the ‘mapped_name’ config item

    – changes to cause the graphs to automatically be shown on a
    host’s page when there are no ‘overview’ plugin(s) for that host and there’s
    only 1 plugin for that host

    – change(s) to support the ‘use_json_order’ config item

    – CGP.js: allow graphs with additional time-spans (now: 5/10/15/20/30 minutes,
    1/2/4/6/12 hours, 1/2/7/30/60/90/180/270 days and 1/2/3/5 years)

    – RrdGraph.js: append a “live time-span phrase” to the graph title:

    + indicates the time-span included in the graph (e.g., “2 days” or “6 hours”)
    and includes the starting and ending date/time for the graph data (e.g.,
    2016-Dec-31 … 2017-Jan-02 at 15:02):

    o if the graph starts and ends in the same year and the year is the current
    year, the year is excluded (e.g., Jan-02 … Jan-04 at 08:00)

    o if the graph starts and ends in the same year and the year is not the
    current year, the year is shown once, as a prefix (e.g.,
    2016 Dec-29 … Dec-31 at 21:45)

    o if the graph starts and ends at the same time-of-day, the time is shown
    only once, as a suffix (e.g., Jan-02 … Jan-04 at 7:32)

    o if the graph starts and ends at different times-of-day, the time is shown
    with each date — this only occurs when using time-spans which are not
    multiples of 1 day (e.g., 6 hours – Jan-02 16:12 … Jan-02 22:12)

    + the above characteristics are cumulative – e.g., the graph starts and ends in
    different years and the graph starts and ends at different times-of-day …
    Graph Title β€” 12 hours : 2016-Dec-31 16:50 … 2017-Jan-01 04:50

    NOTE: I’m assuming that all this javascript “stuff” comes into play only when when using the ‘canvas’ graph type (if that’s not valid, then additional changes/corrections may be needed for other graph types).

    I hope others will find these changes to be useful. BTW, I looked at all the collectd front ends that run on OS X and CGP (using ‘canvas’) was the ONLY one able to create all my graphs … and it does does it with such refinement.


  46. pommi Post author

    Hi A Mac User! Thanks for your contribution! To get those changes reviewed and merged I need a remote git repository to merge from. Github isn’t necessary, or a private git repo is also fine.

  47. A Mac User

    Unfortunately, I don’t use git and don’t have time to “git into it” at this point in time. #;-)

    The referenced download is the complete hierarchy (with added .orig copies for all files that were changed) and it’s based upon the current Github repository (to be sure, I downloaded and compared all the files on 2017-01-05, just before making the archive of my changes).

    Someone that already uses git can create a private repo then do what needs to be done (in a matter of minutes, from what I’ve read about git). I don’t care about credit, just that others are able to benefit from that work I did, so I don’t really care how the changes get propagated.

  48. Nick

    Hi Pommi, thanks for such a great and easy to use software!

    Would you expect it to work on manually created .rrd files or is there something special about the .rrd files created by collectd?

    I created a RRD with rrdtool create temperature.rrd –step 60 DS:temperature:GAUGE:120:0:60 RRA:MIN:0.5:12:525600 RRA:MAX:0.5:12:525600 RRA:AVERAGE:0.5:1:525600 and have populated it with some data, but while CGP is still displaying the default collectd graphs (mem, cpu etc), it won’t display my hand crafted .rrd.

    If I create the .png manually I see a nice graph. rrdtool graph temp.png -w 785 -h 120 -a PNG –slope-mode –start -9000 –end now DEF:temperature=temperature/temperature.rrd:temperature:MAX LINE1:temperature#ff0000:”temperature”

    Other than a HTTP error 500, I can’t find any other logging which might help diagnose what is going wrong. Lighttpd access/error logs don’t show anything interesting. The URL of the image which is broken is http:///CGP/graph.php?p=temperature&t=temperature&h=watering&s=86400&x=800&y=350

    Linux permissions to the hand crafted .rrd files are the same as the permissions to the other working .rrd files that are created by collectd, so I am out of troubleshooting ideas at this stage. Is there anything you can think of?


  49. pommi Post author

    Hi Nick, I wouldn’t recommend it, but it is possible. You need to make sure you save the rrd files with a specific naming scheme:


    So there are 5 components:

    • hostname
    • plugin
    • plugin instance (optional)
    • type
    • type instance (optional)

    Let’s for example have a look at the CPU plugin. It uses all of these 5 components:


    And the contents of the rrd need to be according to the types database defined by collectd:

    Then it should work.

Leave a Reply

Your email address will not be published.