// Set the vertical label
if (self->impl->vlabel) {
// Fetch the vertical label
- r = self->impl->vlabel(self->ctx, self, object, vlabel, sizeof(vlabel));
+ r = self->impl->vlabel(self->ctx, self, options, object, vlabel, sizeof(vlabel));
if (r < 0) {
ERROR(self->ctx, "Failed to render the vertical label: %s\n", strerror(-r));
goto ERROR;
}
int td_graph_vlabel_bps(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length) {
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length) {
return __td_string_set(vlabel, length, _("Bits Per Second"));
}
int td_graph_vlabel_days(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length) {
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length) {
return __td_string_set(vlabel, length, _("Days"));
}
int td_graph_vlabel_qps(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length) {
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length) {
return __td_string_set(vlabel, length, _("Queries Per Second"));
}
int td_graph_vlabel_seconds(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length) {
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length) {
return __td_string_set(vlabel, length, _("Seconds"));
}
+
+int td_graph_vlabel_temp(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length) {
+ switch (td_graph_temperature(options)) {
+ case TD_GRAPH_TEMP_KELVIN:
+ return __td_string_set(vlabel, length, _("Kelvin"));
+
+ case TD_GRAPH_TEMP_CELSIUS:
+ return __td_string_set(vlabel, length, _("° Celsius"));
+
+ case TD_GRAPH_TEMP_FAHRENHEIT:
+ return __td_string_set(vlabel, length, _("° Fahrenheit"));
+ }
+
+ return -EINVAL;
+}
const char* object, char* title, size_t length);
// Vertical Label
- int (*vlabel)(td_ctx* ctx, td_graph* graph,
+ int (*vlabel)(td_ctx* ctx, td_graph* graph, const td_graph_render_options* options,
const char* object, char* vlabel, size_t length);
} td_graph_impl;
*/
int td_graph_vlabel_bps(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length);
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length);
int td_graph_vlabel_days(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length);
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length);
int td_graph_vlabel_qps(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length);
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length);
int td_graph_vlabel_seconds(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length);
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length);
+
+int td_graph_vlabel_temp(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length);
#endif /* TELEMETRY_GRAPH_H */
return __td_string_set(title, length, _("Connection Tracking Table"));
}
-static int conntrack_vlabel(td_ctx* ctx,
- td_graph* graph, const char* object, char* vlabel, size_t length) {
+static int conntrack_vlabel(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length) {
return __td_string_set(vlabel, length, _("Entries"));
}
return __td_string_set(title, length, _("Context Switches"));
}
-static int contextswitches_vlabel(td_ctx* ctx,
- td_graph* graph, const char* object, char* vlabel, size_t length) {
+static int contextswitches_vlabel(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length) {
return __td_string_set(vlabel, length, _("Context Switches/s"));
}
return __td_string_set(title, length, _("CPU Frequency"));
}
-static int cpufreq_vlabel(td_ctx* ctx,
- td_graph* graph, const char* object, char* vlabel, size_t length) {
+static int cpufreq_vlabel(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length) {
return __td_string_set(vlabel, length, _("Hz"));
}
.name = "DiskTemperature",
.render = disk_temp_render,
.title = disk_temp_title,
- //.vlabel = td_graph_vlabel_qps,
+ .vlabel = td_graph_vlabel_temp,
// Limits
.lower_limit = -LONG_MAX,
}
static int hostapd_station_signal_vlabel(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length) {
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length) {
return __td_string_set(vlabel, length, _("RSSI - dBm"));
}
}
static int legacy_suricata_vlabel(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length) {
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length) {
return __td_string_set(vlabel, length, _("bps"));
}
return __td_string_set(title, length, _("Load Average"));
}
+static int loadavg_vlabel(td_ctx* ctx, td_graph* graph,
+ const td_graph_render_options* options, const char* object, char* title, size_t length) {
+ return __td_string_set(title, length, _("Load Average"));
+}
+
static int loadavg_render(td_ctx* ctx, td_graph* graph,
const td_graph_render_options* options, td_args* args, const char* object) {
int r;
.name = "LoadAverage",
.render = loadavg_render,
.title = loadavg_title,
- .vlabel = loadavg_title,
+ .vlabel = loadavg_vlabel,
// Flags
.flags = TELEMETRY_GRAPH_REVERSE,
}
static int memory_vlabel(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length) {
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length) {
return __td_string_set(vlabel, length, _("Bytes"));
}
}
static int processor_vlabel(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length) {
+ const td_graph_render_options* options, const char* object, char* vlabel, size_t length) {
return __td_string_set(vlabel, length, _("Percent"));
}