X-Git-Url: https://git.octo.it/?p=collection4.git;a=blobdiff_plain;f=src%2Faction_show_instance.c;h=15130adde95151b07a1ec6f76a1ef9b8a3fc2b0c;hp=92bbf1cb10991ca2d4db6f36d4d6241f00292ca3;hb=15f6457cd19b1b5a07f16be029a7120f60de1c4e;hpb=202f278d38aaa14f73c7975706a67a19465ea3e9
diff --git a/src/action_show_instance.c b/src/action_show_instance.c
index 92bbf1c..15130ad 100644
--- a/src/action_show_instance.c
+++ b/src/action_show_instance.c
@@ -48,11 +48,15 @@
#define MAX_SHOW_GRAPHS 10
+#define SGD_FORMAT_JSON 0
+#define SGD_FORMAT_RRD 1
+
struct show_graph_data_s
{
graph_config_t *cfg;
graph_instance_t *inst;
int graph_count;
+ int format;
};
typedef struct show_graph_data_s show_graph_data_t;
@@ -132,8 +136,12 @@ static int show_time_selector (__attribute__((unused)) void *user_data) /* {{{ *
" \n"
" \n"
" \n"
- " \n"
- " \n");
+ "
\n");
+ printf (" "
+ "
\n"
+ " "
+ "\n
");
+ printf (" \n");
printf ("\n");
@@ -186,7 +194,7 @@ static int left_menu (void *user_data) /* {{{ */
static int show_instance_json (graph_config_t *cfg, /* {{{ */
graph_instance_t *inst,
- time_t begin, time_t end, int index)
+ long begin, long end, int index)
{
yajl_gen_config handler_config;
yajl_gen handler;
@@ -239,12 +247,12 @@ static int show_instance_json (graph_config_t *cfg, /* {{{ */
yajl_gen_string (handler,
(unsigned char *) "begin",
(unsigned int) strlen ("begin"));
- yajl_gen_integer (handler, (long int) begin);
+ yajl_gen_integer (handler, begin);
yajl_gen_string (handler,
(unsigned char *) "end",
(unsigned int) strlen ("end"));
- yajl_gen_integer (handler, (long int) end);
+ yajl_gen_integer (handler, end);
yajl_gen_map_close (handler);
@@ -266,19 +274,14 @@ static int show_instance_json (graph_config_t *cfg, /* {{{ */
return (0);
} /* }}} int show_instance_json */
-static int show_instance_cb (graph_config_t *cfg, /* {{{ */
+static int show_instance_rrdtool (graph_config_t *cfg, /* {{{ */
graph_instance_t *inst,
- void *user_data)
+ long begin, long end, int index)
{
- show_graph_data_t *data = user_data;
char title[128];
char descr[128];
char params[1024];
-
- long begin;
- long end;
char time_params[128];
- int status;
memset (title, 0, sizeof (title));
graph_get_title (cfg, title, sizeof (title));
@@ -292,23 +295,11 @@ static int show_instance_cb (graph_config_t *cfg, /* {{{ */
inst_get_params (cfg, inst, params, sizeof (params));
html_escape_buffer (params, sizeof (params));
- time_params[0] = 0;
- begin = 0;
- end = 0;
-
- status = get_time_args (&begin, &end, /* now = */ NULL);
- if (status == 0)
- {
- snprintf (time_params, sizeof (time_params), ";begin=%li;end=%li",
- begin, end);
- time_params[sizeof (time_params) - 1] = 0;
- }
-
- printf ("