Menu

Order STACK'd datasources in graph

Help
KS1
2011-03-23
2014-12-03
  • KS1

    KS1 - 2011-03-23

    Is it possible to order the datasources in a graph where the datasurces are stacked?

    I have the following lineformat config;

    lineformat = warn=LINE1,D0D050;crit=LINE1,D05050;cpu,idle=AREA,C0C0C0FF,STACK;cpu,user=AREA,0000FFFF,STACK;cpu,system=AREA,FF0000FF,STACK

    I have tried ordering the above differently and using 'plotasAREA' and 'stack=', but cannot get the odering to change on the actual graph.

    So what we are trying to acheive is to have the graph look as we can using something like cacti, i.e. cpu,system and then cpu,user stacked on top of that, followed by cpu,idle stacked at the very top of the graph.

    Is there a way to achieve this?

    Thanks.

     
  • Matthew Wall

    Matthew Wall - 2011-03-25

    lineformat only specifies the style, not the order.

    the order of the data sources is controlled by the cgi arguments and/or the datasetdb.conf file.

    for example:

    showgraph.cgi?host=HOST&service=SERVICE&db=db,ds1,ds2,ds3
    showgraph.cgi?host=HOST&service=SERVICE&db=db,ds3,ds2,ds1

    using the datasetdb.conf file:

    service=SERVICE1&db=db,ds1,ds2,ds3
    service=SERVICE2&db=db,ds3,ds2,ds1

     
  • KS1

    KS1 - 2011-03-30

    Thanks. That's exactly what I was looking to do.

    I had to specify the db each time for it to work, so in datasetdb.conf, I had to use;

    service=SERVICE1&db=db,ds1&db=db,ds2&db=db,ds3

     
  • Michel Blankleder

    This is ok when you see the graph with the mouse over and when you click on it to the show.cgi.
    But when you click the button  "Update Graphs"  the show.cgi rearrange the order of the stack.
    This is with version Nagiosgraph 1.4.4

     
  • Matthew Wall

    Matthew Wall - 2012-03-01

    the problem is that the order is not respected by the plumbing behind 'update graphs'.  when you click 'update graphs' the javascript reorders the data sources alphabetically.  however the stack definition assumes a specific order of data sources.

    a complete solution would respect the data source order and let you rearrange the order of data sources in the graph controls (which is all javascript).  i'm looking for at least a workable solution to this - not sure if it will make the 1.4.5 release.

     
  • Michel Blankleder

    Thanks for the answer.
    Yes, in some cases is what I did. For example the CPU usage stack. In that case I don't care about the order but in the case of the RAM usage,  I want to put the the chaches and used in a stack and the total amount of ram as line1, so when I press update graphs the chaches stacks over the total line.
    Can you give me a hint were to look? maybe I can help to solve the issue.

     
  • Michel Blankleder

    I mean caches.

     
  • Matthew Wall

    Matthew Wall - 2012-03-01

    the code in nagiosgraph.js does not maintain the order of data sources that are passed in via cgi.  it always reorders data sources to match the order of the host/service/db data, which is done alphabetically.  the solution is probably to simply retain sequence when the javascript rebuilds the url.  see mkCGIArgs in nagiosgraph.js.  btw, this needs some refactoring to eliminate the functional duplication between ngshared.pm and nagiosgraph.js.

    i can imagine a more general solution that lets you drag and drop data sources to reorder them interactively, but i'll settle for the simple solution above first.

    the STACK keyword is used with the LINE and AREA directives. it indicates that the values for a data source should be stacked on top of the previous data source.  so the order matters.

     
  • Fif

    Fif - 2014-12-03

    The attached patch against nagisograph 1.5.2 fixes the problem for me.
    It pretty much enforces the order of the RRD DBs passed in the CGI parameters of showgraph.cgi to be the same as the one specified in datasetdb.conf.
    If any DBs are listed in CGI and are missing from datasetdb.conf, they are appended after the DBs listed in datasetdb.conf (if any)

     

Log in to post a comment.

MongoDB Logo MongoDB