diff options
Diffstat (limited to '')
-rw-r--r-- | collectors/charts.d.plugin/example/example.chart.sh (renamed from charts.d/example.chart.sh) | 15 |
1 files changed, 11 insertions, 4 deletions
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 |