diff options
author | Vladimir Kobal <vlad@prokk.net> | 2022-06-22 10:39:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-22 10:39:14 +0200 |
commit | 3bc0e3355492b57b11e0bb47547d8a41d9cacc02 (patch) | |
tree | a1a0b9d16d67f06e7cc35f4cc0c70551e004abac | |
parent | b32ca44319e35eb38e5858730f2ea44ea2268926 (diff) |
Add type label for network interfaces (#13187)
-rw-r--r-- | collectors/proc.plugin/proc_net_dev.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/collectors/proc.plugin/proc_net_dev.c b/collectors/proc.plugin/proc_net_dev.c index cd479dfc57..94807a9e30 100644 --- a/collectors/proc.plugin/proc_net_dev.c +++ b/collectors/proc.plugin/proc_net_dev.c @@ -741,11 +741,13 @@ int do_proc_net_dev(int update_every, usec_t dt) { char buffer[FILENAME_MAX + 1]; snprintfz(buffer, FILENAME_MAX, path_to_sys_devices_virtual_net, d->name); - if(likely(access(buffer, R_OK) == 0)) { + if (likely(access(buffer, R_OK) == 0)) { d->virtual = 1; - } - else + rrdlabels_add(d->chart_labels, "type", "virtual", RRDLABEL_SRC_AUTO); + } else { d->virtual = 0; + rrdlabels_add(d->chart_labels, "type", "real", RRDLABEL_SRC_AUTO); + } if(likely(!d->virtual)) { // set the filename to get the interface speed |