diff options
Diffstat (limited to '')
-rw-r--r-- | collectors/charts.d.plugin/example/Makefile.inc | 13 | ||||
-rw-r--r-- | collectors/charts.d.plugin/example/README.md | 2 | ||||
-rw-r--r-- | collectors/charts.d.plugin/example/example.chart.sh (renamed from charts.d/example.chart.sh) | 15 | ||||
-rw-r--r-- | collectors/charts.d.plugin/example/example.conf (renamed from conf.d/charts.d/example.conf) | 0 |
4 files changed, 26 insertions, 4 deletions
diff --git a/collectors/charts.d.plugin/example/Makefile.inc b/collectors/charts.d.plugin/example/Makefile.inc new file mode 100644 index 000000000..e6838fbbe --- /dev/null +++ b/collectors/charts.d.plugin/example/Makefile.inc @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +# THIS IS NOT A COMPLETE Makefile +# IT IS INCLUDED BY ITS PARENT'S Makefile.am +# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT + +# install these files +dist_charts_DATA += example/example.chart.sh +dist_chartsconfig_DATA += example/example.conf + +# do not install these files, but include them in the distribution +dist_noinst_DATA += example/README.md example/Makefile.inc + diff --git a/collectors/charts.d.plugin/example/README.md b/collectors/charts.d.plugin/example/README.md new file mode 100644 index 000000000..bfd5e210a --- /dev/null +++ b/collectors/charts.d.plugin/example/README.md @@ -0,0 +1,2 @@ +This is just an example charts.d data collector. + diff --git a/charts.d/example.chart.sh b/collectors/charts.d.plugin/example/example.chart.sh index ffc98712f..1562c597a 100644 --- a/charts.d/example.chart.sh +++ b/collectors/charts.d.plugin/example/example.chart.sh @@ -1,9 +1,10 @@ +# shellcheck shell=bash # no need for shebang - this file is loaded from charts.d.plugin +# SPDX-License-Identifier: GPL-3.0-or-later # netdata # real-time performance and health monitoring, done right! # (C) 2016 Costa Tsaousis <costa@tsaousis.gr> -# GPL v3+ # # if this chart is called X.chart.sh, then all functions and global variables @@ -46,7 +47,7 @@ example_get() { example_value4=$((8192 + (RANDOM * 16383 / 32767) )) if [ $example_count -gt 0 ] - then + then example_count=$((example_count - 1)) [ $example_last -gt 16383 ] && example_value4=$((example_last + (RANDOM * ( (32767 - example_last) / 2) / 32767))) @@ -54,8 +55,14 @@ example_get() { else example_count=$((1 + (RANDOM * 5 / 32767) )) - [ $example_last -gt 16383 -a $example_value4 -gt 16383 ] && example_value4=$((example_value4 - 16383)) - [ $example_last -le 16383 -a $example_value4 -lt 16383 ] && example_value4=$((example_value4 + 16383)) + if [ $example_last -gt 16383 ] && [ $example_value4 -gt 16383 ] + then + example_value4=$((example_value4 - 16383)) + fi + if [ $example_last -le 16383 ] && [ $example_value4 -lt 16383 ] + then + example_value4=$((example_value4 + 16383)) + fi fi example_last=$example_value4 diff --git a/conf.d/charts.d/example.conf b/collectors/charts.d.plugin/example/example.conf index 6232ca584..6232ca584 100644 --- a/conf.d/charts.d/example.conf +++ b/collectors/charts.d.plugin/example/example.conf |