-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
561 lines (469 loc) · 17.5 KB
/
index.html
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>Focuslight - Lightning fast Graphing / Visualization</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Le styles -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/prettify.css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
}
</style>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body data-spy="scroll">
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation" id="top">
<div class="container">
<div class="navbar-inner">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Focuslight</a>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#top">Home</a></li>
<li><a href="#install">Install</a></li>
<li><a href="#basic">Basic</a></li>
<li><a href="#api">API</a></li>
<li><a href="#software">Software</a></li>
<li><a href="https://github.com/focuslight/focuslight/">Source Code</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-globe"></span> English <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="active"><a href="index.html">English</a></li>
<li><a href="index.ja.html">Japanese</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container">
<!-- Main hero unit for a primary marketing message or call to action -->
<div class="jumbotron" style="padding-top: 0px; padding-bottom: 30px; background-color: #CFE2D4">
<h1><img src="img/logo_native002_2.png" alt="Focuslight"></h1>
<p><small>Ruby clone of <a href="http://kazeburo.github.io/GrowthForecast/">GrowthForecast</a></small></p>
<p>Focuslight is a web tool that let's you graph all sorts of metrics via a WebAPI. Our simple API let's you create and update charts in real time, customize your charts through a Web interface, and create charts that combine multiple metrics.</p>
</div>
<section>
<div class="row">
<div class="col-md-6">
<h3>You can graph your MySQL data with 1 line of code</h3>
<pre class="prettyprint linenums">
$ crontab -l
*/5 * * * * curl -d number=`mysql -BN -e 'select count(*) from member' game` http://example.com/api/socialgame/member/register 2>&1 | logger -t post_gf -p local0.info
</pre>
<p>By periodically POSTing to Focuslight with cron, you can make charts without having to deal with complex settings</p>
</div>
<div class="col-md-6"><img src="img/sample1.png" class="img-responsive" /></div>
</div>
</section>
<hr>
<section id="install">
<div class="page-header">
<h1>Installing and Booting</h1>
</div>
<h3>(1) Installing Package Dependencies</h3>
<div class="row">
<div class="col-md-4">
<p>We'll first install the libraries that RRDTool depends on using package managers like yum, apt, homebrew, etc.</p>
<ul>
<li>glib</li>
<li>xml2</li>
<li>pango</li>
<li>cairo</li>
</ul>
<p></p>
</div>
<div class="col-md-8">
<h3>CentOS</h3>
<pre class="prettyprint linenums">
$ sudo yum groupinstall "Development Tools"
$ sudo yum install pkgconfig glib2-devel gettext libxml2-devel pango-devel cairo-devel
</pre>
<h3>Ubuntu</h3>
<pre class="prettyprint linenums">
$ sudo apt-get build-dep rrdtool
</pre>
</div>
</div>
<h3>(2) Installing Focuslight</h3>
<div class="row">
<div class="col-md-4">
<p>We'll use the <a href="http://bundler.io">bundler</a> command to install Focuslight together with its module dependencies.</p>
<p>We recommend that you use Ruby built with <a href="https://github.com/sstephenson/rbenv">rbenv</a> (or others) rather than the default Ruby that ships with your OS.</p>
<p></p>
</div>
<div class="col-md-8">
<pre class="prettyprint linenums">
$ git clone [email protected]:focuslight/focuslight.git
$ cd focuslight
$ gem install bundler
$ bundle install
$ bundle exec rake init
</pre>
<p>Installation will take a bit of time since there are a many gem dependencies.</p>
</div>
</div>
<h3>(3) Starting Focuslight</h3>
<div class="row">
<div class="col-md-4">
<p>You've now installed Focuslight! To start Focuslight, please execute "bundle exec foreman start".</p>
<p>The web server will start on port 5125. You can verify this in your browser.</p>
</div>
<div class="col-md-8">
<h3>Boot Command</h3>
<pre class="prettyprint linenums">
$ bundle exec foreman start
</pre>
<h3>Configuration</h3>
To configure Focuslight, edit the `.env` file in the project root directory.
<table class="table">
<tr>
<th>ENV Name</th>
<th>Description</th>
</tr>
<tr>
<td>DATADIR</td><td>The directory to store the graph data. Default: ./data.</td>
</tr>
<tr>
<td>PORT</td><td>The TCP port to bind to. Default: port 5125.</td>
</tr>
<tr>
<td>HOST</td><td>The IP address to bind to. Default: 0.0.0.0</td>
</tr>
<tr>
<td>FRONT_PROXY (not supported yet)</td><td>If using reverse proxy, uses the IP address of the reverse proxy or CIDR. Multiple IP addresses can be set</td>
</tr>
<tr>
<td>ALLOW_FROM (not supported yet)</td><td>Specify the IP address from which the service can be accessed. If not set, the service can be accessed by all remote hosts.</td>
</tr>
<tr>
<td>1MIN_METRICS (not supported yet)</td><td>Stop the service from updating the graph every minute.</td>
</tr>
<tr>
<td>FLOAT_SUPPORT</td><td>Accept to post floating numbers. Defautlt: n (Accept only interger numbers)</td>
</tr>
<tr>
<td>DBURL</td><td>Database URL such as sqlite://data/gforecast.db for SQLite, or mysql2://root:@localhost/focuslight for MySQL. Default: sqlite://data/gforecast.db</td>
</tr>
<tr>
<td>RRDCACHED (not supported yet)</td><td>Specify rrdcached address. Format is like unix:</path/to/unix.sock>, or <hostname-or-ip>:<port>. Default: no</td>
</tr>
<tr>
<td>MOUNT (not supported yet)</td><td>Provide Focuslight under the specified url path. Default : /</td>
</tr>
<tr>
<td>LOG_LEVEL</td><td>Specify log level. Either of debug, info, warn, error, or fatal. Default: info</td>
</tr>
</table>
</div>
</div>
<h3>If Using MySQL</h3>
<div class="row">
<div class="col-md-4">
<p>You will need to create a database, and add the following permissions when using the MySQL.</p>
<ul>
<li>CREATE</li>
<li>ALTER</li>
<li>DELETE</li>
<li>INSERT</li>
<li>UPDATE</li>
<li>SELECT</li>
</ul>
</div>
<div class="col-md-8">
<h4>Expamle of Commands</h4>
<pre class="prettyprint linenums">
mysql> CREATE DATABASE focuslight;
mysql> GRANT CREATE, ALTER, DELETE, INSERT, UPDATE, SELECT \\
ON focuslight.* TO 'user'\@'localhost' IDENTIFIED BY password;
</pre>
<p>Your username and password are set by DBURL parameter on .env file or system environment variables.</p>
<pre class="prettyprint linenums">
DBURL=mysql2://user:password@localhost/focuslight
</pre>
</div>
</div>
</section>
<section id="basic">
<div class="page-header">
<h1>Basic Usage</h1>
</div>
<h3>How to Register Graphs</h3>
<p>To create graphs or update data, make a request to the following URL via a POST method.</p>
<pre class="prettyprint linenums">
http://example.com/api/:service_name/:section_name/:graph_name
</pre>
<div class="row">
<div class="col-md-3">
<p>The names of the items within the URL to POST to are shown in the table to the right.</p>
<p>You can use multi-byte strings for each item name as long as it is UTF-8.</p>
</div>
<div class="col-md-7">
<table class="table">
<tr>
<th>The Name Used in the Example</th>
<th>Purpose</th>
<th>Actual Parameters</th>
</tr>
<tr>
<td>:service_name</td>
<td>The name of the service that you'd like to graph</td>
<td>blog, photo, place, socialgame</td>
</tr>
<tr>
<td>:section_name</td>
<td>The name of the feature or system to graph, within said service.</td>
<td>entry, user, spot, items</td>
</tr>
<tr>
<td>:graph_name</td>
<td>The actual name of the value being graphed</td>
<td>total_entry, kakin_user, muryo_user</td>
</tr>
</table>
</div>
</div>
<p>For example, if we are graphing the number of registered users in a social game, we would POST to the following URL:</p>
<pre class="prettyprint linenums">
http://example.com/api/socialgame/member/register
</pre>
<p>Also, we would use the following parametens when POSTing.</p>
<table class="table">
<tr>
<th>Parameter</th>
<th>Description</th>
<th>Required/Optional</th>
</tr>
<tr>
<td>number</td>
<td>The number to give the graph</td>
<td>Required</td>
</tr>
<tr>
<td>mode</td>
<td>Update method for the number: count, modified, gauge。<br />
count: Add the value of the number parameter to the pre-registered value.<br />
modified: Overwrite if the value differs from last time.<br />
gauge: Always overwrite with the value of number<br />
Default: gauge mode</td>
<td>Optional</td>
</tr>
<tr>
<td>color</td>
<td>The color of the grah. Specify with #FFFFFF format.</td>
<td>Optional (auto-generated if unspecified in a new graph)</td>
</tr>
</table>
<h3>Example: Creating a New Graph</h3>
<p>Using curl:</p>
<pre class="prettyprint linenums">
$ curl -d number=10 http://example.com/api/socialgame/member/register
</pre>
</section>
<section id="api">
<div class="page-header">
<h1>Other API</h1>
</div>
<h3>Customizing the Graph's Appearance</h3>
<p>You can customize the graph's appearance by adding a few parameters to the graph's URI.</p>
<h4>Endpoint</h4>
<pre class="prettyprint">
URI of a Graph http://example.com/graph/:service_name/:section_name/:graph_name
URI of a Compound Graph http://example.com/graph/:pattern
</pre>
<div class="row">
<div class="col-md-3">
<h4>List of Supported Parameters</h4>
<p>You can even make graphs like the one below just by changing the parameters!</p>
<p><img src="img/sample.png" class="img-responsive" /></p>
<pre class="prettyprint">
http://example.com/graph/service/section/graph?t=d&border=0&legend=0&width=200&background_color=333333&canvas_color=333333&font_color=CCCCCC&axis_color=666666
</pre>
</div>
<div class="col-md-9">
<table class="table">
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
<tr>
<td>t</td>
<td>The range of the graph: y(1 year), m(1 month), w(1 week), 3d(3 days), s3d(3 days, refresh every minute), d(1 day), sd(1 day, refresh every minute), 8h(8 hours), s8h(8 hours, refresh every minute), 4h(4 hours), s4h(4 hours, refresh every minute), h(1 hour), sh(1 hour, refresh every minute), n(half a day), sn(half a day, refresh every minute), c(custom)、sc(custom, refresh every minute)</td>
</tr>
<tr>
<td>from</td>
<td>When `t` is set to `c` or `sc`, this value sets the start time of the graph. Uses the format: 2011/12/08 12:10:00</td>
</tr>
<tr>
<td>to</td>
<td>When `t` is set to `c` or `sc`, this value sets the end time of the graph. Uses the format: 2011/12/08 12:10:00</td>
</tr>
<tr>
<td>width</td>
<td>The width of the graph. (The actual width is a bit wider due to the Legend and other elements)</td>
</tr>
<tr>
<td>height</td>
<td>The height of the graph. (The actual height is a bit higher due to the Legend and other elements)</td>
</tr>
<tr>
<td>graphonly</td>
<td>This mode only plots the graph. No other elements are plotted. Default: 0</td>
</tr>
<tr>
<td>logarithmic</td>
<td>Graphs in logarithmic scale. Default: 0</td>
</tr>
<tr>
<td>xgrid</td>
<td>Setup for the X-axis. Details regarding the format can be found in the <a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html">rrdtool documentation</a>.</td>
</tr>
<tr>
<td>ygrid</td>
<td>Setup for the Y-axis. Details regarding the format can be found in the <a href="http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html">rrdtool documentation</a>.</td>
</tr>
<tr>
<td>background_color</td>
<td>Background color. Specify using the FFFFFF or FFFFFF00 formats (last 2 characters are for the alpha channel).</td>
</tr>
<tr>
<td>canvas_color</td>
<td>The canvas (background) color of the graph. Specify using the FFFFFF or FFFFFF00 formats.</td>
</tr>
<tr>
<td>font_color</td>
<td>The font color. Specify using the FFFFFF or FFFFFF00 formats.</td>
</tr>
<tr>
<td>frame_color</td>
<td>The frame color of the Legend. Specify using the FFFFFF or FFFFFF00 formats.</td>
</tr>
<tr>
<td>axis_color</td>
<td>The border color of the graph. Specify using the FFFFFF or FFFFFF00 formats.</td>
</tr>
<tr>
<td>shadea_color</td>
<td>The border colors for top left and top. Specify using the FFFFFF or FFFFFF00 formats.</td>
</tr>
<tr>
<td>shadeb_color</td>
<td>The border colors for bottom right and bottom. Specify using the FFFFFF or FFFFFF00 formats.</td>
</tr>
<tr>
<td>border</td>
<td>The thickness of the borders. `0` is a valid value. Default: 3.</td>
</tr>
<tr>
<td>legend</td>
<td>Enable the Legend (including summary data of the graph). Default: 1</td>
</tr>
<tr>
<td>sumup</td>
<td>Include the sum value in the Legend. Default: 0</td>
</tr>
</table>
</div>
</div>
<h3>Graph Data Summary</h3>
<p>You can export the Legend information (which includes the summary data of the graph) in JSON format.</p>
<h4>Endpoint</h4>
<pre class="prettyprint">
URI of the Graph Summary http://example.com/summary/:service_name/:section_name/:graph_name
URI of the Compound Graph Summary http://example.com/summary/:pattern
</pre>
<h3>Exporting Graph Data</h3>
<div class="row">
<div class="col-md-3">
<p>You can export your graph data in JSON format.</p>
</div>
<div class="col-md-9">
<h4>Endpoint</h4>
<pre class="prettyprint">
URI of the Graph http://example.com/xport/:service_name/:section_name/:graph_name
URI of the Compound Graph http://example.com/xport/:pattern
</pre>
<h4>List of Parameters</h4>
<table class="table">
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
<tr>
<td>t</td>
<td>The range of the graph: y(1 year), m(1 month), w(1 week), 3d(3 days), s3d(3 days, refresh every minute), d(1 day), sd(1 day, refresh every minute), 8h(8 hours), s8h(8 hours, refresh every minute), 4h(4 hours), s4h(4 hours, refresh every minute), h(1 hour), sh(1 hour, refresh every minute), n(half a day), sn(half a day, refresh every minute), c(custom)、sc(custom, refresh every minute)</td>
</tr>
<tr>
<td>from</td>
<td>When `t` is set to `c` or `sc`, this value sets the start time of the graph. Uses the format: 2011/12/08 12:10:00</td>
</tr>
<tr>
<td>to</td>
<td>When `t` is set to `c` or `sc`, this value sets the end time of the graph. Uses the format: 2011/12/08 12:10:00</td>
</tr>
<tr>
<td>width</td>
<td>Maximum number of rows.</td>
</tr>
</table>
</div>
</div>
</section>
<section id="software">
<div class="page-header">
<h1>Related Softwares</h1>
</div>
<div class="row">
<div class="col-md-12">
<p>Focuslight is a Ruby port of GrowthForecast having HTTP API compatibilities. Therefore, following client software for GrowthForecast should work for Focuslight, too</p>
<h4>fluent-plugin-growthforecast</h4>
<p><a href="https://github.com/tagomoris/fluent-plugin-growthforecast">https://github.com/tagomoris/fluent-plugin-growthforecast</a><br />
Fluentd plugin to output numbers(metrics) to 'GrowthForecast', metrics drawing tool over HTTP.</p>
<h4>rb-growthforecast (ruby)</h4>
<p><a href="https://github.com/tagomoris/rb-growthforecast">https://github.com/tagomoris/rb-growthforecast</a><br />
Client library and command to operate GrowthForecast</p>
<h4>growthforecast-client (ruby)</h4>
<p><a href="https://github.com/sonots/growthforecast-client">https://github.com/sonots/growthforecast-client</a><br />
growthforecast-client is a ruby client library for GrowthForecast API where GrowthForecast is a visualization graph tool.</p>
<h4>Net::GrowthForecast (perl)</h4>
<p><a href="https://metacpan.org/pod/Net::GrowthForecast">https://metacpan.org/pod/Net::GrowthForecast</a><br />
A client library for awesome visualization tool GrowthForecast</p>
<div>
<div>
</section>
<hr>
<footer>
<p>© 2012- Masahiro Nagano</p>
<p>© 2014- Naotoshi Seo</p>
<p><a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons licenses" style="border-width:0" src="http://i.creativecommons.org/l/by/4.0/80x15.png" /></a>- Logo by 125design</p>
</footer>
</div> <!-- /container -->
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/prettify.js"></script>
<script>
(function(){
$('#navbar').scrollspy();
prettyPrint();
})();
</script>
</body>
</html>