X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=graph_def.c;h=a5511f6fbb742bc38f9a725785fd8a859b61b13a;hb=0a4d88e7530531c01324af54e881ca770edd10d2;hp=36b6747a4d46a9e9b7d6754734ba2e691eb27952;hpb=dfabd7793b9cb3fff1525c0e924729189d0d7867;p=collection4.git diff --git a/graph_def.c b/graph_def.c index 36b6747..a5511f6 100644 --- a/graph_def.c +++ b/graph_def.c @@ -3,6 +3,7 @@ #include #include "graph_def.h" +#include "graph.h" #include "graph_config.h" #include "common.h" #include "oconfig.h" @@ -20,6 +21,8 @@ struct graph_def_s char *ds_name; char *legend; uint32_t color; + _Bool stack; + _Bool area; graph_def_t *next; }; @@ -77,10 +80,10 @@ static graph_def_t *def_config_get_obj (graph_config_t *cfg, /* {{{ */ graph_def_t *def; int i; - ident = gl_graph_get_selector (cfg); + ident = graph_get_selector (cfg); if (ident == NULL) { - fprintf (stderr, "def_config_get_obj: gl_graph_get_selector failed"); + fprintf (stderr, "def_config_get_obj: graph_get_selector failed"); return (NULL); } @@ -132,7 +135,7 @@ graph_def_t *def_create (graph_config_t *cfg, graph_ident_t *ident, /* {{{ */ if ((cfg == NULL) || (ident == NULL) || (ds_name == NULL)) return (NULL); - selector = gl_graph_get_selector (cfg); + selector = graph_get_selector (cfg); if (selector == NULL) return (NULL); @@ -206,9 +209,16 @@ int def_config (graph_config_t *cfg, const oconfig_item_t *ci) /* {{{ */ graph_config_get_string (child, &def->legend); else if (strcasecmp ("Color", child->key) == 0) def_config_color (child, &def->color); + else if (strcasecmp ("Stack", child->key) == 0) + graph_config_get_bool (child, &def->stack); + else if (strcasecmp ("Area", child->key) == 0) + graph_config_get_bool (child, &def->area); + else + fprintf (stderr, "def_config: Ignoring unknown config option \"%s\"", + child->key); } - return (gl_graph_add_def (cfg, def)); + return (graph_add_def (cfg, def)); } /* }}} int def_config */ int def_append (graph_def_t *head, graph_def_t *def) /* {{{ */ @@ -310,9 +320,11 @@ int def_get_rrdargs (graph_def_t *def, graph_ident_t *ident, /* {{{ */ index, index); /* Graph part */ - array_append_format (args, "LINE1:def_%04i_avg#%06"PRIx32":%s", + array_append_format (args, "%s:def_%04i_avg#%06"PRIx32":%s%s", + def->area ? "AREA" : "LINE1", index, def->color, - (def->legend != NULL) ? def->legend : def->ds_name); + (def->legend != NULL) ? def->legend : def->ds_name, + def->stack ? ":STACK" : ""); array_append_format (args, "GPRINT:vdef_%04i_min:%%lg min,", index); array_append_format (args, "GPRINT:vdef_%04i_avg:%%lg avg,", index); array_append_format (args, "GPRINT:vdef_%04i_max:%%lg max,", index);