X-Git-Url: https://git.octo.it/?p=collection4.git;a=blobdiff_plain;f=src%2Fmain.c;h=896a61220fb99fbb85cc310fb2614ee626be2169;hp=74d5d27e2b334e53920b4555cd7650efd7346fa0;hb=a7babc69db47718d5e0cc1af48bafaf8eea7c3d1;hpb=01de7d16f1e8dfdf00a31de19e3719b45752eb4d diff --git a/src/main.c b/src/main.c index 74d5d27..896a612 100644 --- a/src/main.c +++ b/src/main.c @@ -37,8 +37,12 @@ #include "utils_cgi.h" #include "action_graph.h" +#include "action_instance_data_json.h" +#include "action_graph_def_json.h" #include "action_list_graphs.h" +#include "action_list_graphs_json.h" #include "action_list_hosts.h" +#include "action_list_hosts_json.h" #include "action_search.h" #include "action_search_json.h" #include "action_show_graph.h" @@ -62,8 +66,12 @@ static int action_usage (void); static const action_t actions[] = { { "graph", action_graph }, + { "instance_data_json", action_instance_data_json }, + { "graph_def_json", action_graph_def_json }, { "list_graphs", action_list_graphs }, + { "list_graphs_json", action_list_graphs_json }, { "list_hosts", action_list_hosts }, + { "list_hosts_json", action_list_hosts_json }, { "search", action_search }, { "search_json", action_search_json }, { "show_graph", action_show_graph }, @@ -102,7 +110,7 @@ static int handle_request (void) /* {{{ */ action = param ("action"); if (action == NULL) { - return (action_usage ()); + return (action_list_graphs ()); } else { @@ -114,12 +122,19 @@ static int handle_request (void) /* {{{ */ for (i = 0; i < actions_num; i++) { if (strcmp (action, actions[i].name) == 0) + { status = (*actions[i].callback) (); + break; + } } if (i >= actions_num) status = action_usage (); + /* Call finish before updating the graph list, so clients don't wait for + * the update to finish. */ + FCGI_Finish (); + gl_update (/* request_served = */ 1); return (status);