]> arthur.barton.de Git - netdata.git/blobdiff - charts.d/example.chart.sh
code optimizations; added temperature charts.d plugin
[netdata.git] / charts.d / example.chart.sh
index 0f6251ad803380152dd84b015eca6d53845594f1..aa1005d11aec536a75b4d6c96b7e0a56d38e85d6 100755 (executable)
@@ -1,7 +1,13 @@
 #!/bin/sh
 
+# if this chart is called X.chart.sh, then all functions and global variables
+# must start with X_
+
+# _update_every is a special variable - it holds the number of seconds
+# between the calls of the _update() function
 example_update_every=
 
+# _check is called once, to find out if this chart should be enabled or not
 example_check() {
        # this should return:
        #  - 0 to enable the chart
@@ -10,9 +16,10 @@ example_check() {
        return 0
 }
 
+# _create is called once, to create the charts
 example_create() {
-# create the chart with 3 dimensions
-cat <<EOF
+       # create the chart with 3 dimensions
+       cat <<EOF
 CHART example.random '' "Random Numbers Stacked Chart" "% of random numbers" random random stacked 5000 $example_update_every
 DIMENSION random1 '' percentage-of-absolute-row 1 1
 DIMENSION random2 '' percentage-of-absolute-row 1 1
@@ -22,6 +29,7 @@ EOF
        return 0
 }
 
+# _update is called continiously, to collect the values
 example_update() {
        # the first argument to this function is the microseconds since last update
        # pass this parameter to the BEGIN statement (see bellow).