Harmonized output format to use common abbreviations for the metric names

Signed-off-by: Matthias Petermann <mp@petermann-it.de>
This commit is contained in:
Matthias Petermann 2023-05-26 09:49:16 +02:00
parent ab995826fc
commit df8638858b

View file

@ -53,12 +53,12 @@
#include "netbsd_exporter.h"
void print_filesystem_metric(const char* metric, const char* device, const char* mountpoint, long value) {
printf("netbsd_filesystem_%s_bytes{device=\"%s\",mountpoint=\"%s\"} %ld\n", metric, device, mountpoint, value);
printf("netbsd_fs_%s_bytes{device=\"%s\",mountpoint=\"%s\"} %ld\n", metric, device, mountpoint, value);
}
void print_disk_io_metric(const char* device, long long unsigned int rbytes, long long unsigned int wbytes) {
printf("netbsd_disk_read_bytes{device=\"%s\"} %llu\n", device, rbytes);
printf("netbsd_disk_write_bytes{device=\"%s\"} %llu\n", device, wbytes);
printf("netbsd_dk_read_bytes{device=\"%s\"} %llu\n", device, rbytes);
printf("netbsd_dk_write_bytes{device=\"%s\"} %llu\n", device, wbytes);
}
void print_load_metric(const char* metric, double value) {
@ -66,13 +66,13 @@ void print_load_metric(const char* metric, double value) {
}
void print_network_metric(const char* interface, unsigned long long rxbytes, unsigned long long txbytes, unsigned long long errors) {
printf("netbsd_network_rx_bytes{interface=\"%s\"} %llu\n", interface, rxbytes);
printf("netbsd_network_tx_bytes{interface=\"%s\"} %llu\n", interface, txbytes);
printf("netbsd_network_errors{interface=\"%s\"} %llu\n", interface, errors);
printf("netbsd_netif_rx_bytes{interface=\"%s\"} %llu\n", interface, rxbytes);
printf("netbsd_netif_tx_bytes{interface=\"%s\"} %llu\n", interface, txbytes);
printf("netbsd_netif_errors{interface=\"%s\"} %llu\n", interface, errors);
}
void print_memory_metric(const char* metric, long value) {
printf("netbsd_memory_%s_bytes %ld\n", metric, value);
printf("netbsd_mem_%s_bytes %ld\n", metric, value);
}
void retrieve_disk_space_metrics() {