- char file[512];
- int status;
-
- status = snprintf (file, 512, cpu_filename, inst);
- if (status < 1)
- return;
- else if (status >= 512)
- return;
-
- rrd_update_file (host, file, val, ds_def, ds_num);
-}
-
-#if CPU_HAVE_READ
-#define BUFSIZE 512
-static void cpu_submit (int cpu_num, unsigned long long user,
- unsigned long long nice, unsigned long long syst,
- unsigned long long idle, unsigned long long wait)
-{
- char buf[BUFSIZE];
- char cpu[16];
-
- if (snprintf (buf, BUFSIZE, "%u:%llu:%llu:%llu:%llu:%llu", (unsigned int) curtime,
- user, nice, syst, idle, wait) >= BUFSIZE)
- return;
- snprintf (cpu, 16, "%i", cpu_num);
-
- plugin_submit (MODULE_NAME, cpu, buf);
+ value_t values[1];
+ value_list_t vl = VALUE_LIST_INIT;
+
+ values[0].counter = value;
+
+ vl.values = values;
+ vl.values_len = 1;
+ vl.time = time (NULL);
+ strcpy (vl.host, hostname_g);
+ strcpy (vl.plugin, "cpu");
+ snprintf (vl.plugin_instance, sizeof (vl.type_instance),
+ "%i", cpu_num);
+ vl.plugin_instance[DATA_MAX_NAME_LEN - 1] = '\0';
+ strcpy (vl.type_instance, type_instance);
+
+ plugin_dispatch_values ("cpu", &vl);