- if ((perf->flags & PERF_SYSTEM_DISK) && disk_read && disk_written) {
- values[0].counter = disk_read;
- values[1].counter = disk_written;
- vl.values = values;
- vl.values_len = 2;
- vl.time = timestamp;
- vl.interval = interval_g;
- sstrncpy(vl.plugin, "netapp", sizeof(vl.plugin));
- sstrncpy(vl.host, host->name, sizeof(vl.host));
- sstrncpy(vl.plugin_instance, instance, sizeof(vl.plugin_instance));
- sstrncpy(vl.type, "disk_octets", sizeof(vl.type));
- vl.type_instance[0] = 0;
- DEBUG("%s/netapp-%s/disk_octets: %"PRIu64" %"PRIu64, host->name, instance, disk_read, disk_written);
- plugin_dispatch_values (&vl);
- }
- if ((perf->flags & PERF_SYSTEM_NET) && net_recv && net_sent) {
- values[0].counter = net_recv;
- values[1].counter = net_sent;
- vl.values = values;
- vl.values_len = 2;
- vl.time = timestamp;
- vl.interval = interval_g;
- sstrncpy(vl.plugin, "netapp", sizeof(vl.plugin));
- sstrncpy(vl.host, host->name, sizeof(vl.host));
- sstrncpy(vl.plugin_instance, instance, sizeof(vl.plugin_instance));
- sstrncpy(vl.type, "if_octets", sizeof(vl.type));
- vl.type_instance[0] = 0;
- DEBUG("%s/netapp-%s/if_octects: %"PRIu64" %"PRIu64, host->name, instance, net_recv, net_sent);
- plugin_dispatch_values (&vl);
- }
- if ((perf->flags & PERF_SYSTEM_CPU) && cpu_busy && cpu_total) {
- /* values[0].gauge = (double) (cpu_busy - perf->last_cpu_busy) / (cpu_total - perf->last_cpu_total) * 100; */
- values[0].counter = cpu_busy / 10000;
- vl.values = values;
- vl.values_len = 1;
- vl.time = timestamp;
- vl.interval = interval_g;
- sstrncpy(vl.plugin, "netapp", sizeof(vl.plugin));
- sstrncpy(vl.host, host->name, sizeof(vl.host));
- sstrncpy(vl.plugin_instance, instance, sizeof(vl.plugin_instance));
- sstrncpy(vl.type, "cpu", sizeof(vl.type));
- sstrncpy(vl.type_instance, "system", sizeof(vl.plugin_instance));
- /* if (perf->last_cpu_busy && perf->last_cpu_total) printf("CPU: busy: %lf - idle: %lf\n", values[0].gauge, 100.0 - values[0].gauge); */
- /* if (perf->last_cpu_busy && perf->last_cpu_total) plugin_dispatch_values ("cpu", &vl); */
- DEBUG("%s/netapp-%s/cpu: busy: %"PRIu64" - idle: %"PRIu64, host->name, instance, cpu_busy / 10000, cpu_total / 10000);
- plugin_dispatch_values (&vl);
-
- /* values[0].gauge = 100.0 - (double) (cpu_busy - perf->last_cpu_busy) / (cpu_total - perf->last_cpu_total) * 100; */
- values[0].counter = (cpu_total - cpu_busy) / 10000;
- vl.values = values;
- vl.values_len = 1;
- vl.time = timestamp;
- vl.interval = interval_g;
- sstrncpy(vl.plugin, "netapp", sizeof(vl.plugin));
- sstrncpy(vl.host, host->name, sizeof(vl.host));
- sstrncpy(vl.plugin_instance, instance, sizeof(vl.plugin_instance));
- sstrncpy(vl.type, "cpu", sizeof(vl.type));
- sstrncpy(vl.type_instance, "idle", sizeof(vl.plugin_instance));
- /* if (perf->last_cpu_busy && perf->last_cpu_total) plugin_dispatch_values ("cpu", &vl); */
- plugin_dispatch_values (&vl);
-
- perf->last_cpu_busy = cpu_busy;
- perf->last_cpu_total = cpu_total;
- }
-}