diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:19:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:20:17 +0000 |
commit | a64a253794ac64cb40befee54db53bde17dd0d49 (patch) | |
tree | c1024acc5f6e508814b944d99f112259bb28b1be /collectors/tc.plugin/plugin_tc.c | |
parent | New upstream version 1.10.0+dfsg (diff) | |
download | netdata-upstream/1.11.0+dfsg.tar.xz netdata-upstream/1.11.0+dfsg.zip |
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/tc.plugin/plugin_tc.c (renamed from src/plugin_tc.c) | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/src/plugin_tc.c b/collectors/tc.plugin/plugin_tc.c index 4b6d84e11..083cc2986 100644 --- a/src/plugin_tc.c +++ b/collectors/tc.plugin/plugin_tc.c @@ -1,6 +1,9 @@ -#include "common.h" +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "plugin_tc.h" #define RRD_TYPE_TC "tc" +#define PLUGIN_TC_NAME "tc.plugin" // ---------------------------------------------------------------------------- // /sbin/tc processor @@ -391,9 +394,9 @@ static inline void tc_device_commit(struct tc_device *d) { , RRD_TYPE_TC ".qos" , "Class Usage" , "kilobits/s" - , "tc" + , PLUGIN_TC_NAME , NULL - , 7000 + , NETDATA_CHART_PRIO_TC_QOS , localhost->rrd_update_every , d->enabled_all_classes_qdiscs ? RRDSET_TYPE_LINE : RRDSET_TYPE_STACKED ); @@ -402,7 +405,7 @@ static inline void tc_device_commit(struct tc_device *d) { rrdset_next(d->st_bytes); if(unlikely(d->name_updated)) rrdset_set_name(d->st_bytes, d->name); - // FIXME + // TODO // update the family } @@ -439,9 +442,9 @@ static inline void tc_device_commit(struct tc_device *d) { , RRD_TYPE_TC ".qos_packets" , "Class Packets" , "packets/s" - , "tc" + , PLUGIN_TC_NAME , NULL - , 7010 + , NETDATA_CHART_PRIO_TC_QOS_PACKETS , localhost->rrd_update_every , d->enabled_all_classes_qdiscs ? RRDSET_TYPE_LINE : RRDSET_TYPE_STACKED ); @@ -455,7 +458,7 @@ static inline void tc_device_commit(struct tc_device *d) { rrdset_set_name(d->st_packets, name); } - // FIXME + // TODO // update the family } @@ -492,9 +495,9 @@ static inline void tc_device_commit(struct tc_device *d) { , RRD_TYPE_TC ".qos_dropped" , "Class Dropped Packets" , "packets/s" - , "tc" + , PLUGIN_TC_NAME , NULL - , 7020 + , NETDATA_CHART_PRIO_TC_QOS_DROPPED , localhost->rrd_update_every , d->enabled_all_classes_qdiscs ? RRDSET_TYPE_LINE : RRDSET_TYPE_STACKED ); @@ -508,7 +511,7 @@ static inline void tc_device_commit(struct tc_device *d) { rrdset_set_name(d->st_dropped, name); } - // FIXME + // TODO // update the family } @@ -545,9 +548,9 @@ static inline void tc_device_commit(struct tc_device *d) { , RRD_TYPE_TC ".qos_tokens" , "Class Tokens" , "tokens" - , "tc" + , PLUGIN_TC_NAME , NULL - , 7030 + , NETDATA_CHART_PRIO_TC_QOS_TOCKENS , localhost->rrd_update_every , RRDSET_TYPE_LINE ); @@ -561,7 +564,7 @@ static inline void tc_device_commit(struct tc_device *d) { rrdset_set_name(d->st_tokens, name); } - // FIXME + // TODO // update the family } @@ -599,9 +602,9 @@ static inline void tc_device_commit(struct tc_device *d) { , RRD_TYPE_TC ".qos_ctokens" , "Class cTokens" , "ctokens" - , "tc" + , PLUGIN_TC_NAME , NULL - , 7040 + , NETDATA_CHART_PRIO_TC_QOS_CTOCKENS , localhost->rrd_update_every , RRDSET_TYPE_LINE ); @@ -616,7 +619,7 @@ static inline void tc_device_commit(struct tc_device *d) { rrdset_set_name(d->st_ctokens, name); } - // FIXME + // TODO // update the family } @@ -857,7 +860,7 @@ void *tc_main(void *ptr) { struct rusage thread; - char buffer[TC_LINE_MAX+1] = ""; + char command[FILENAME_MAX + 1]; char *words[PLUGINSD_MAX_WORDS] = { NULL }; uint32_t BEGIN_HASH = simple_hash("BEGIN"); @@ -876,23 +879,24 @@ void *tc_main(void *ptr) { #endif uint32_t first_hash; - snprintfz(buffer, TC_LINE_MAX, "%s/tc-qos-helper.sh", netdata_configured_plugins_dir); - char *tc_script = config_get("plugin:tc", "script to run to get tc values", buffer); + snprintfz(command, TC_LINE_MAX, "%s/tc-qos-helper.sh", netdata_configured_plugins_dir); + char *tc_script = config_get("plugin:tc", "script to run to get tc values", command); while(!netdata_exit) { FILE *fp; struct tc_device *device = NULL; struct tc_class *class = NULL; - snprintfz(buffer, TC_LINE_MAX, "exec %s %d", tc_script, localhost->rrd_update_every); - debug(D_TC_LOOP, "executing '%s'", buffer); + snprintfz(command, TC_LINE_MAX, "exec %s %d", tc_script, localhost->rrd_update_every); + debug(D_TC_LOOP, "executing '%s'", command); - fp = mypopen(buffer, (pid_t *)&tc_child_pid); + fp = mypopen(command, (pid_t *)&tc_child_pid); if(unlikely(!fp)) { - error("TC: Cannot popen(\"%s\", \"r\").", buffer); + error("TC: Cannot popen(\"%s\", \"r\").", command); goto cleanup; } + char buffer[TC_LINE_MAX+1] = ""; while(fgets(buffer, TC_LINE_MAX, fp) != NULL) { if(unlikely(netdata_exit)) break; @@ -1074,9 +1078,9 @@ void *tc_main(void *ptr) { , NULL , "NetData TC CPU usage" , "milliseconds/s" - , "tc" + , PLUGIN_TC_NAME , NULL - , 135000 + , NETDATA_CHART_PRIO_NETDATA_TC_CPU , localhost->rrd_update_every , RRDSET_TYPE_STACKED ); @@ -1101,9 +1105,9 @@ void *tc_main(void *ptr) { , NULL , "NetData TC script execution" , "milliseconds/run" - , "tc" + , PLUGIN_TC_NAME , NULL - , 135001 + , NETDATA_CHART_PRIO_NETDATA_TC_TIME , localhost->rrd_update_every , RRDSET_TYPE_AREA ); |