#include <limits.h>
#include <locale.h>
#include <stdlib.h>
+#include <unistd.h>
#include <rrd.h>
// Show nicer labels
"--dynamic-labels",
- // Add a watermark
- "--watermark=" PACKAGE_NAME,
-
// Honour upper/lower limit
"--rigid",
int td_graph_render(td_graph* self, const char* object,
const td_graph_render_options* options, char** buffer, size_t* length) {
td_args* args = NULL;
+ char hostname[HOST_NAME_MAX] = "";
char vlabel[VLABEL_MAX] = "";
char** data = NULL;
FILE* f = NULL;
if (r < 0)
goto ERROR;
+ // Fetch the system's hostname
+ r = gethostname(hostname, sizeof(hostname));
+ if (r < 0) {
+ ERROR(self->ctx, "Failed to fetch the hostname: %m\n");
+ r = -errno;
+ goto ERROR;
+ }
+
+ // Add a watermark
+ r = td_args_push(args, "--watermark=%s - %s", PACKAGE_NAME, hostname);
+ if (r < 0)
+ goto ERROR;
+
// Select the output format
if (options->format) {
r = td_args_push(args, "--imgformat=%s", options->format);