summaryrefslogtreecommitdiffstats
path: root/collectors/charts.d.plugin/example/example.chart.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:22:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:22:44 +0000
commit1e6c93250172946eeb38e94a92a1fd12c9d3011e (patch)
tree8ca5e16dfc7ad6b3bf2738ca0a48408a950f8f7e /collectors/charts.d.plugin/example/example.chart.sh
parentUpdate watch file (diff)
downloadnetdata-1e6c93250172946eeb38e94a92a1fd12c9d3011e.tar.xz
netdata-1e6c93250172946eeb38e94a92a1fd12c9d3011e.zip
Merging upstream version 1.11.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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