diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2015-10-03 12:56:20 +0300 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2015-10-03 12:56:20 +0300 |
commit | 71b72e4f59b129ced0a1d15e5ce3b21370edfbbd (patch) | |
tree | 3e393055191fdb756f3c449bb2a25f463b7a143d /charts.d/example.chart.sh | |
parent | 3d916bd468a12150385083d998c866f275c5ab64 (diff) |
code optimizations; added temperature charts.d plugin
Diffstat (limited to 'charts.d/example.chart.sh')
-rwxr-xr-x | charts.d/example.chart.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/charts.d/example.chart.sh b/charts.d/example.chart.sh index 0f6251ad80..aa1005d11a 100755 --- a/charts.d/example.chart.sh +++ b/charts.d/example.chart.sh @@ -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). |