[pve-devel] [PATCH] add new pve2.3-vm stream

Alexandre Derumier aderumier at odiso.com
Tue Jan 15 10:02:05 CET 2013


skip=3 to handle new template value

we write to /var/lib/rrdcached/db/pve2-vm as the rrds have not changed

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 data/src/status.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/data/src/status.c b/data/src/status.c
index 304fcf4..f6e89b3 100644
--- a/data/src/status.c
+++ b/data/src/status.c
@@ -942,6 +942,26 @@ update_rrd_data(
 			create_rrd_file(filename, argcount, rrd_def_node);
 		}
 
+	} else if (strncmp(key, "pve2.3-vm/", 10) == 0) {
+		const char *vmid = key + 10;
+
+		skip = 3;
+
+		if (strchr(vmid, '/') != NULL)
+			goto keyerror;
+
+		if (strlen(vmid) < 1)
+			goto keyerror;
+
+		filename = g_strdup_printf(RRDDIR "/%s/%s", "pve2-vm", vmid);
+
+		if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
+
+			mkdir(RRDDIR "/pve2-vm", 0755);
+			int argcount = sizeof(rrd_def_vm)/sizeof(void*) - 1;
+			create_rrd_file(filename, argcount, rrd_def_vm);
+		}
+
 	} else if (strncmp(key, "pve2-vm/", 8) == 0) {
 		const char *vmid = key + 8;
 
-- 
1.7.10.4




More information about the pve-devel mailing list