summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-12-12 17:04:44 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-12-12 17:18:15 -0500
commit85a578479406865502a3eb504577c1dfe64f34f5 (patch)
tree83ea749d4c081f3972065c2936cf9a1b628801d6
parentb19ec9de5aaebbfec16279833a66e575d4783643 (diff)
Use less magic+scaffolding in the example setup.
-rw-r--r--docs/examples/index.html11
-rw-r--r--docs/examples/jarmon_example_recipes.js126
2 files changed, 66 insertions, 71 deletions
diff --git a/docs/examples/index.html b/docs/examples/index.html
index 6dc7696..b86fe91 100644
--- a/docs/examples/index.html
+++ b/docs/examples/index.html
@@ -14,17 +14,6 @@
<script type="text/javascript" src="assets/js/dependencies.js"></script>
<script type="text/javascript" src="../../jarmon/jarmon.js"></script>
<script type="text/javascript" src="jarmon_example_recipes.js"></script>
- <script type="text/javascript">
-
- $(function() {
- jarmon.buildTabbedChartUi(
- $('.chart-container').remove(),
- jarmon.CHART_RECIPES_COLLECTD,
- $('.tabbed-chart-interface'),
- jarmon.TAB_RECIPES_STANDARD,
- $('.chartRangeControl')
- );
- });
</script>
</head>
diff --git a/docs/examples/jarmon_example_recipes.js b/docs/examples/jarmon_example_recipes.js
index 524515b..bd5c28f 100644
--- a/docs/examples/jarmon_example_recipes.js
+++ b/docs/examples/jarmon_example_recipes.js
@@ -4,70 +4,76 @@
* Some example recipes for Collectd RRD data - you *will* need to modify this
* based on the RRD data available on your system.
*/
+$(function() {
-if(typeof(jarmon) === 'undefined') {
- var jarmon = {};
-}
+ var tabRecipes = [
+ ['System', ['cpu', 'memory','load']],
+ ['Network', ['interface']]
+ ];
-jarmon.TAB_RECIPES_STANDARD = [
- ['System', ['cpu', 'memory','load']],
- ['Network', ['interface']]
-];
+ var chartRecipes = {
+ 'cpu': {
+ title: 'CPU Usage',
+ data: [
+ ['data/cpu-0/cpu-wait.rrd', 0, 'CPU-0 Wait', '%'],
+ ['data/cpu-1/cpu-wait.rrd', 0, 'CPU-1 Wait', '%'],
+ ['data/cpu-0/cpu-system.rrd', 0, 'CPU-0 System', '%'],
+ ['data/cpu-1/cpu-system.rrd', 0, 'CPU-1 System', '%'],
+ ['data/cpu-0/cpu-user.rrd', 0, 'CPU-0 User', '%'],
+ ['data/cpu-1/cpu-user.rrd', 0, 'CPU-1 User', '%']
+ ],
+ options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS,
+ jarmon.Chart.STACKED_OPTIONS)
+ },
-jarmon.CHART_RECIPES_COLLECTD = {
- 'cpu': {
- title: 'CPU Usage',
- data: [
- ['data/cpu-0/cpu-wait.rrd', 0, 'CPU-0 Wait', '%'],
- ['data/cpu-1/cpu-wait.rrd', 0, 'CPU-1 Wait', '%'],
- ['data/cpu-0/cpu-system.rrd', 0, 'CPU-0 System', '%'],
- ['data/cpu-1/cpu-system.rrd', 0, 'CPU-1 System', '%'],
- ['data/cpu-0/cpu-user.rrd', 0, 'CPU-0 User', '%'],
- ['data/cpu-1/cpu-user.rrd', 0, 'CPU-1 User', '%']
- ],
- options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS,
- jarmon.Chart.STACKED_OPTIONS)
- },
+ 'memory': {
+ title: 'Memory',
+ data: [
+ ['data/memory/memory-buffered.rrd', 0, 'Buffered', 'B'],
+ ['data/memory/memory-used.rrd', 0, 'Used', 'B'],
+ ['data/memory/memory-cached.rrd', 0, 'Cached', 'B'],
+ ['data/memory/memory-free.rrd', 0, 'Free', 'B']
+ ],
+ options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS,
+ jarmon.Chart.STACKED_OPTIONS)
+ },
- 'memory': {
- title: 'Memory',
- data: [
- ['data/memory/memory-buffered.rrd', 0, 'Buffered', 'B'],
- ['data/memory/memory-used.rrd', 0, 'Used', 'B'],
- ['data/memory/memory-cached.rrd', 0, 'Cached', 'B'],
- ['data/memory/memory-free.rrd', 0, 'Free', 'B']
- ],
- options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS,
- jarmon.Chart.STACKED_OPTIONS)
- },
+ 'load': {
+ title: 'Load Average',
+ data: [
+ ['data/load/load.rrd', 'shortterm', 'Short Term', ''],
+ ['data/load/load.rrd', 'midterm', 'Medium Term', ''],
+ ['data/load/load.rrd', 'longterm', 'Long Term', '']
+ ],
+ options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS)
+ },
- 'load': {
- title: 'Load Average',
- data: [
- ['data/load/load.rrd', 'shortterm', 'Short Term', ''],
- ['data/load/load.rrd', 'midterm', 'Medium Term', ''],
- ['data/load/load.rrd', 'longterm', 'Long Term', '']
- ],
- options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS)
- },
+ 'interface': {
+ title: 'Wlan0 Throughput',
+ data: [
+ ['data/interface-wlan0/if_octets.rrd', 'tx', 'Transmit', 'bit/s', function (v) { return -v*8; }],
+ ['data/interface-wlan0/if_octets.rrd', 'rx', 'Receive', 'bit/s', function (v) { return v*8; }]
+ ],
+ options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS)
+ },
- 'interface': {
- title: 'Wlan0 Throughput',
- data: [
- ['data/interface-wlan0/if_octets.rrd', 'tx', 'Transmit', 'bit/s', function (v) { return -v*8; }],
- ['data/interface-wlan0/if_octets.rrd', 'rx', 'Receive', 'bit/s', function (v) { return v*8; }]
- ],
- options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS)
- },
+ 'droprate': {
+ title: 'Ping Droprate',
+ data: [
+ ['data/ping/ping_droprate-google.com.rrd', 0,
+ 'google.com', '%', function (v) { return v*100; }],
+ ['data/ping/ping_droprate-softlayer.com.rrd', 0,
+ 'softlayer.com', '%', function (v) { return v*100; }]
+ ],
+ options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS)
+ }
+ };
- 'droprate': {
- title: 'Ping Droprate',
- data: [
- ['data/ping/ping_droprate-google.com.rrd', 0,
- 'google.com', '%', function (v) { return v*100; }],
- ['data/ping/ping_droprate-softlayer.com.rrd', 0,
- 'softlayer.com', '%', function (v) { return v*100; }]
- ],
- options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS)
- }
-};
+ jarmon.buildTabbedChartUi(
+ $('.chart-container').remove(),
+ chartRecipes,
+ $('.tabbed-chart-interface'),
+ tabRecipes,
+ $('.chartRangeControl')
+ );
+});