summaryrefslogtreecommitdiff
path: root/docs/examples/jarmon_example_recipes.js
blob: bd5c28fe52af3a032d7a16b2c411d33194a2bd1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* Copyright (c) Richard Wall
 * See LICENSE for details.
 *
 * Some example recipes for Collectd RRD data - you *will* need to modify this
 * based on the RRD data available on your system.
 */
$(function() {

    var tabRecipes = [
        ['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)
        },

        '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)
        },

        '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)
        }
    };

    jarmon.buildTabbedChartUi(
        $('.chart-container').remove(),
        chartRecipes,
        $('.tabbed-chart-interface'),
        tabRecipes,
        $('.chartRangeControl')
    );
});