}
// Call the implementation to add some arguments
- r = self->impl->render(self->ctx, self, args, object);
+ r = self->impl->render(self->ctx, self, options, args, object);
if (r < 0)
goto ERROR;
#include "daemon.h"
#include "graph.h"
+typedef struct td_graph_render_options {
+ // Output Format
+ const char* format;
+
+ // Locale
+ const char* locale;
+
+ // Dimensions
+ struct {
+ unsigned int h;
+ unsigned int w;
+ } dimensions;
+
+ // Interval
+ struct {
+ time_t t_start;
+ time_t t_end;
+ } interval;
+
+ // Flags
+ enum {
+ TD_GRAPH_OMIT_TITLE = (1 << 0),
+ } flags;
+} td_graph_render_options;
+
typedef struct td_graph_impl {
// Name
const char* name;
int (*available)(td_ctx* ctx, td_daemon* daemon);
// Render!
- int (*render)(td_ctx* ctx, td_graph* graph,
+ int (*render)(td_ctx* ctx, td_graph* graph, const td_graph_render_options* options,
td_args* args, const char* object);
// Title
int td_graph_require_sources(td_graph* self,
td_args* args, const char* name, const char** objects);
-typedef struct td_graph_render_options {
- // Output Format
- const char* format;
-
- // Locale
- const char* locale;
-
- // Dimensions
- struct {
- unsigned int h;
- unsigned int w;
- } dimensions;
-
- // Interval
- struct {
- time_t t_start;
- time_t t_end;
- } interval;
-
- // Flags
- enum {
- TD_GRAPH_OMIT_TITLE = (1 << 0),
- } flags;
-} td_graph_render_options;
-
int td_graph_render(td_graph* self, const char* object,
const td_graph_render_options* options, char** buffer, size_t* length);
+/*
+ Temperatures
+*/
+typedef enum td_graph_temps {
+ TD_GRAPH_TEMP_KELVIN,
+ TD_GRAPH_TEMP_CELSIUS,
+ TD_GRAPH_TEMP_FAHRENHEIT,
+} td_graph_temps;
+
/*
Commonly used vlabels
*/
return __td_string_set(vlabel, length, _("Entries"));
}
-static int conntrack_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
+static int conntrack_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
int r;
// This requires the conntrack source
return __td_string_set(vlabel, length, _("Context Switches/s"));
}
-static int contextswitches_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
+static int contextswitches_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
int r;
// This requires the contextswitches source
return __td_string_set(vlabel, length, _("Hz"));
}
-static int cpufreq_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* _object) {
+static int cpufreq_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* _object) {
char object[NAME_MAX];
int r;
return __td_string_set(title, length, _("Disk Temperature"));
}
-static int disk_temp_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
+static int disk_temp_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
int r;
// Load all sources
return __td_string_format(title, length, _("Station %s - Bandwidth"), object);
}
-static int hostapd_station_bandwidth_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
+static int hostapd_station_bandwidth_render(td_ctx* ctx,td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
int r;
// Require the source
return __td_string_format(title, length, _("Station %s - Rate Information"), object);
}
-static int hostapd_station_rate_info_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
+static int hostapd_station_rate_info_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
int r;
// Require the source
return __td_string_set(vlabel, length, _("RSSI - dBm"));
}
-static int hostapd_station_signal_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
+static int hostapd_station_signal_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
int r;
// This require the source
return __td_string_set(vlabel, length, _("bps"));
}
-static int legacy_suricata_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
+static int legacy_suricata_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
int r;
const char* chains[] = {
return __td_string_set(title, length, _("Load Average"));
}
-static int loadavg_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
+static int loadavg_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
int r;
// This requires the loadavg source
return __td_string_set(vlabel, length, _("Bytes"));
}
-static int memory_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
+static int memory_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
int r;
// This requires the loadavg source
#define COLOR_LOAD60 COLOR_ORANGE
#define COLOR_LOAD10 COLOR_YELLOW
-static int pressure_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* source) {
+static int pressure_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* source) {
int r;
// This requires the source
"%s - %s", _("Pressure Stall Information"), _("Processor"));
}
-static int pressure_cpu_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
- return pressure_render(ctx, graph, args, "pressure-cpu");
+static int pressure_cpu_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
+ return pressure_render(ctx, graph, options, args, "pressure-cpu");
}
const td_graph_impl pressure_cpu_graph = {
"%s - %s", _("Pressure Stall Information"), _("Input/Output"));
}
-static int pressure_io_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
- return pressure_render(ctx, graph, args, "pressure-io");
+static int pressure_io_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
+ return pressure_render(ctx, graph, options, args, "pressure-io");
}
const td_graph_impl pressure_io_graph = {
"%s - %s", _("Pressure Stall Information"), _("Memory"));
}
-static int pressure_memory_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
- return pressure_render(ctx, graph, args, "pressure-memory");
+static int pressure_memory_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
+ return pressure_render(ctx, graph, options, args, "pressure-memory");
}
const td_graph_impl pressure_memory_graph = {
return __td_string_set(vlabel, length, _("Percent"));
}
-static int processor_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
+static int processor_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
int r;
// This requires the loadavg source
return __td_string_set(title, length, _("DNS Queries"));
}
-static int unbound_queries_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
+static int unbound_queries_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
int r;
// Load all sources
return __td_string_set(title, length, _("DNS Recursion Time"));
}
-static int unbound_recursion_time_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
+static int unbound_recursion_time_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
int r;
// Load all sources
return __td_string_set(title, length, _("Uptime"));
}
-static int uptime_render(td_ctx* ctx,
- td_graph* graph, td_args* args, const char* object) {
+static int uptime_render(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, td_args* args, const char* object) {
int r;
// This requires the uptime source