#include "ctx.h"
#include "daemon.h"
#include "graph.h"
+#include "i18n.h"
+#include "string.h"
#include "time.h"
// Maximum length of the title/vlabel
return r;
}
+
+int td_graph_vlabel_bps(td_ctx* ctx, td_graph* graph,
+ 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) {
+ 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) {
+ return __td_string_set(vlabel, length, _("Queries Per Second"));
+}
int td_graph_render(td_graph* self, const char* object,
const td_graph_render_options* options, char** buffer, size_t* length);
+/*
+ Commonly used vlabels
+*/
+
+int td_graph_vlabel_bps(td_ctx* ctx, td_graph* graph,
+ 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);
+
+int td_graph_vlabel_qps(td_ctx* ctx, td_graph* graph,
+ const char* object, char* vlabel, size_t length);
+
#endif /* TELEMETRY_GRAPH_H */
return __td_string_format(title, length, _("Station %s - Bandwidth"), object);
}
-static int hostapd_station_bandwidth_vlabel(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length) {
- return __td_string_set(vlabel, length, _("Bits Per Second"));
-}
-
static int hostapd_station_bandwidth_render(td_ctx* ctx,
td_graph* graph, td_args* args, const char* object) {
int r;
.name = "HostapdStationBandwidth",
.render = hostapd_station_bandwidth_render,
.title = hostapd_station_bandwidth_title,
- .vlabel = hostapd_station_bandwidth_vlabel,
+ .vlabel = td_graph_vlabel_bps,
// Limits
.lower_limit = 0,
return __td_string_format(title, length, _("Station %s - Rate Information"), object);
}
-static int hostapd_station_rate_info_vlabel(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length) {
- return __td_string_set(vlabel, length, _("Bits Per Second"));
-}
-
static int hostapd_station_rate_info_render(td_ctx* ctx,
td_graph* graph, td_args* args, const char* object) {
int r;
.name = "HostapdStationRateInfo",
.render = hostapd_station_rate_info_render,
.title = hostapd_station_rate_info_title,
- .vlabel = hostapd_station_rate_info_vlabel,
+ .vlabel = td_graph_vlabel_bps,
// Limits
.lower_limit = 0,
return __td_string_set(title, length, _("DNS Queries"));
}
-static int unbound_queries_vlabel(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length) {
- return __td_string_set(vlabel, length, _("Queries Per Second"));
-}
-
static int unbound_queries_render(td_ctx* ctx,
td_graph* graph, td_args* args, const char* object) {
int r;
.name = "UnboundQueries",
.render = unbound_queries_render,
.title = unbound_queries_title,
- .vlabel = unbound_queries_vlabel,
+ .vlabel = td_graph_vlabel_qps,
// Limits
.lower_limit = 0,
return __td_string_set(title, length, _("Uptime"));
}
-static int uptime_vlabel(td_ctx* ctx, td_graph* graph,
- const char* object, char* vlabel, size_t length) {
- return __td_string_set(vlabel, length, _("Days"));
-}
-
static int uptime_render(td_ctx* ctx,
td_graph* graph, td_args* args, const char* object) {
int r;
.name = "Uptime",
.render = uptime_render,
.title = uptime_title,
- .vlabel = uptime_vlabel,
+ .vlabel = td_graph_vlabel_days,
// Limits
.lower_limit = 0,