summaryrefslogtreecommitdiff
path: root/cfg/jarmon-winston.js
blob: 0d36940a11754dea4834b6a48081c2b5cdde1c98 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
define(['jarmon'], function(jarmon) {
	var srv = 'https://winston.parabola.nu/collectd/winston.parabola.nu/'

	var tabRecipes = [
		['Overview', ['load', 'memory', 'swap-use', 'df-vda3', 'df-vda4', 'systemd-units', 'systemd-jobs', 'uptime']],

		['CPU',      ['load', 'cpu-0', 'cpu-1', 'uptime']],
		['Disk',     ['df-vda3', 'df-vda4', 'uptime']],
		['Memory',   ['memory', 'swap-use', 'swap-io', 'uptime']],
		['Net',      ['interface-eth0', 'interface-lo', 'interface-lvpn', 'interface-sit0', 'interface-tunnelipv6', 'uptime']],

		['Other',    ['entropy', 'uptime', 'users', 'uptime']],
	];

	var cpu = function(title, baseUrl) {
		return {
			title: title,
			data: [
				[baseUrl+'cpu-steal.rrd', 0, 'Steal', 'jiffy'],
				[baseUrl+'cpu-interrupt.rrd', 0, 'IRQ', 'jiffy'],
				[baseUrl+'cpu-softirq.rrd', 0, 'SoftIRQ', 'jiffy'],
				[baseUrl+'cpu-system.rrd', 0, 'System', 'jiffy'],
				[baseUrl+'cpu-wait.rrd', 0, 'IO', 'jiffy'],
				[baseUrl+'cpu-user.rrd', 0, 'User', 'jiffy'],
				//[baseUrl+'cpu-nice.rrd', 0, 'Nice', 'jiffy'],
				[baseUrl+'cpu-idle.rrd', 0, 'Idle', 'jiffy'],
			],
			options: jQuery.extend(true, {},
					       jarmon.Chart.BASE_OPTIONS,
					       jarmon.Chart.STACKED_OPTIONS,
					       {yaxis: {min: 0, max: 110}})
		};
	};

	var netIface = function(title, baseUrl) {
		return {
			title: title,
			data: [
				[baseUrl+'if_octets.rrd', 'tx', 'Transmit', 'bit/s', function (v) { return -v*8; }],
				[baseUrl+'if_octets.rrd', 'rx', 'Receive', 'bit/s', function (v) { return v*8; }]
			],
			options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS)
		};
	};

	var chartRecipes = {
		'cpu-0': cpu("CPU-0 Usage", srv+'cpu-0/'),
		'cpu-1': cpu("CPU-1 Usage", srv+'cpu-1/'),

		'df-vda3': {
			title: "df /dev/vda3",
			data: [
				[srv+'df-vda3/df_complex-reserved.rrd', 0, 'Reserved', 'B'],
				[srv+'df-vda3/df_complex-used.rrd', 0, 'Used', 'B'],
				[srv+'df-vda3/df_complex-free.rrd', 0, 'Free', 'B'],
			],
			options: jQuery.extend(true, {},
					       jarmon.Chart.BASE_OPTIONS,
					       jarmon.Chart.STACKED_OPTIONS)
		},

		'df-vda4': {
			title: "df /dev/vda4",
			data: [
				[srv+'df-vda4/df_complex-reserved.rrd', 0, 'Reserved', 'B'],
				[srv+'df-vda4/df_complex-used.rrd', 0, 'Used', 'B'],
				[srv+'df-vda4/df_complex-free.rrd', 0, 'Free', 'B'],
			],
			options: jQuery.extend(true, {},
					       jarmon.Chart.BASE_OPTIONS,
					       jarmon.Chart.STACKED_OPTIONS)
		},

		'entropy': {
			title: 'Entropy',
			data: [
				[srv+'entropy/entropy.rrd', 0, 'Entropy', 'b']
			],
			options: jQuery.extend(true, {},
					       jarmon.Chart.BASE_OPTIONS,
					       {series: {lines: {fill: 0.5}}})
		},

		'interface-eth0': netIface('eth0 Throughput', srv+'interface-eth0/'),
		'interface-lo': netIface('lo Throughput', srv+'interface-lo/'),
		'interface-lvpn': netIface('lvpn Throughput', srv+'interface-lvpn/'),
		'interface-sit0': netIface('sit0 Throughput', srv+'interface-sit0/'),
		'interface-tunnelipv6': netIface('tunnelipv6 Throughput', srv+'interface-tunnelipv6/'),

		'load': {
			title: 'Load Average',
			data: [
				[srv+'load/load.rrd', 'shortterm', 'Short Term (1m)', ''],
				[srv+'load/load.rrd', 'midterm', 'Medium Term (5m)', ''],
				[srv+'load/load.rrd', 'longterm', 'Long Term (15m)', '']
			],
			options: jQuery.extend(true, {},
					       jarmon.Chart.BASE_OPTIONS,
					       {yaxis: {min: 0}})
		},

		'memory': {
			title: 'Memory',
			data: [
				[srv+'memory/memory-used.rrd', 0, 'Used', 'B'],
				[srv+'memory/memory-slab_unrecl.rrd', 0, 'Slab', 'B'],
				[srv+'memory/memory-slab_recl.rrd', 0, 'Slab (Recl)', 'B'],
				[srv+'memory/memory-cached.rrd', 0, 'Cached', 'B'],
				[srv+'memory/memory-buffered.rrd', 0, 'Buffered', 'B'],
				[srv+'memory/memory-free.rrd', 0, 'Free', 'B']
			],
			options: jQuery.extend(true, {},
					       jarmon.Chart.BASE_OPTIONS,
					       jarmon.Chart.STACKED_OPTIONS)
		},

		'swap-use': {
			title: 'Swap Usage',
			data: [
				[srv+'swap/swap-used.rrd', 0, 'Used', 'B'],
				[srv+'swap/swap-cached.rrd', 0, 'Cached', 'B'],
				[srv+'swap/swap-free.rrd', 0, 'Free', 'B']
			],
			options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS,
					       jarmon.Chart.STACKED_OPTIONS)
		},
		'swap-io': {
			title: 'Swap IO',
			data: [
				// In pages unless the Swap.ReportBytes option is set
				[srv+'swap/swap_io-in.rrd', 0, 'In', 'page'],
				[srv+'swap/swap_io-out.rrd', 0, 'Out', 'page']
			],
			options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS)
		},

		'systemd-units': {
			title: 'Systemd units',
			data: [
				//[srv+'systemd/sd_units-inactive.rrd', 0, 'Inactive', ''],
				[srv+'systemd/sd_units-active.rrd', 0, 'Active', ''],
				[srv+'systemd/sd_units-activating.rrd', 0, 'Activating', ''],
				[srv+'systemd/sd_units-reloading.rrd', 0, 'Reloading', ''],
				[srv+'systemd/sd_units-deactivating.rrd', 0, 'Deactivating', ''],
				[srv+'systemd/sd_units-failed.rrd', 0, 'Failed', ''],
			],
			options: jQuery.extend(true, {},
					       jarmon.Chart.BASE_OPTIONS,
					       jarmon.Chart.STACKED_OPTIONS,
					       {series: {lines: {zero: false}},
						yaxis: {minTickSize: 1}})
		},
		'systemd-jobs': {
			title: 'Systemd jobs',
			data: [
				[srv+'systemd/sd_jobs-installed.rrd', 0, 'Installed', ''],
				[srv+'systemd/sd_jobs-queued.rrd', 0, 'Queued', ''],
				[srv+'systemd/sd_jobs-failed.rrd', 0, 'Failed', ''],
			],
			options: jQuery.extend(true, {},
					       jarmon.Chart.BASE_OPTIONS,
					       jarmon.Chart.STACKED_OPTIONS,
					       {series: {lines: {zero: false}},
					        yaxis: {minTickSize: 1}})
		},

		'uptime': {
			title: 'Uptime',
			data: [
				[srv+'uptime/uptime.rrd', 0, 'Uptime', 'days', function(v) { return v/(60*60*24); }]
			],
			options: jQuery.extend(true, {},
					       jarmon.Chart.BASE_OPTIONS,
					       {series: {lines: {fill: 0.5}}})
		},

		'users': {
			title: 'Users',
			data: [
				[srv+'users/users.rrd', 0, 'Users', 'users']
			],
			options: jQuery.extend(true, {},
					       jarmon.Chart.BASE_OPTIONS,
					       {series: {lines: {fill: 0.5}}})
		},
	};

	return {
		name: 'winston',
		chartRecipes,
		tabRecipes
	};
});