From: Florian Forster Date: Tue, 15 Jun 2010 13:24:14 +0000 (+0200) Subject: graph.[ch]: Implement "graph_get_rrdargs". X-Git-Tag: v4.0.0~252 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=586ff0da90125e8449db2ee1b5894c5883255daa;p=collection4.git graph.[ch]: Implement "graph_get_rrdargs". --- diff --git a/collection.conf b/collection.conf index 58d8c4e..cabea9c 100644 --- a/collection.conf +++ b/collection.conf @@ -90,6 +90,7 @@ TypeInstance "/all/" Title "Diskspace" + VerticalLabel "Bytes" TypeInstance "used" diff --git a/graph.c b/graph.c index 79964f3..154af77 100644 --- a/graph.c +++ b/graph.c @@ -266,4 +266,25 @@ int graph_clear_instances (graph_config_t *cfg) /* {{{ */ return (0); } /* }}} int graph_clear_instances */ +int graph_get_rrdargs (graph_config_t *cfg, graph_instance_t *inst, /* {{{ */ + str_array_t *args) +{ + if ((cfg == NULL) || (inst == NULL) || (args == NULL)) + return (EINVAL); + + if (cfg->title != NULL) + { + array_append (args, "-t"); + array_append (args, cfg->title); + } + + if (cfg->vertical_label != NULL) + { + array_append (args, "-v"); + array_append (args, cfg->vertical_label); + } + + return (0); +} /* }}} int graph_get_rrdargs */ + /* vim: set sw=2 sts=2 et fdm=marker : */ diff --git a/graph.h b/graph.h index 25da1e0..6e9ae07 100644 --- a/graph.h +++ b/graph.h @@ -11,6 +11,7 @@ typedef struct graph_config_s graph_config_t; #include "graph_ident.h" #include "graph_instance.h" #include "oconfig.h" +#include "utils_array.h" /* * Functions @@ -40,5 +41,8 @@ int graph_compare (graph_config_t *cfg, const graph_ident_t *ident); int graph_clear_instances (graph_config_t *cfg); +int graph_get_rrdargs (graph_config_t *cfg, graph_instance_t *inst, + str_array_t *args); + #endif /* GRAPH_H */ /* vim: set sw=2 sts=2 et fdm=marker : */ diff --git a/graph_instance.c b/graph_instance.c index d9821d0..103be23 100644 --- a/graph_instance.c +++ b/graph_instance.c @@ -288,20 +288,9 @@ int inst_get_rrdargs (graph_config_t *cfg, /* {{{ */ if ((cfg == NULL) || (inst == NULL) || (args == NULL)) return (EINVAL); -/* FIXME: Re-enable title and vertical label stuff. */ -#if 0 - if (cfg->title != NULL) - { - array_append (args, "-t"); - array_append (args, cfg->title); - } - - if (cfg->vertical_label != NULL) - { - array_append (args, "-v"); - array_append (args, cfg->vertical_label); - } -#endif + status = graph_get_rrdargs (cfg, inst, args); + if (status != 0) + return (status); defs = graph_get_defs (cfg); if (defs == NULL)