-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path27_configuration_templates.html
724 lines (558 loc) · 69.5 KB
/
27_configuration_templates.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
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Configuration templates — RPi-Monitor v2.13-r0</title>
<link rel="shortcut icon" href="_static/favicon.ico"/>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="next" title="Usages" href="30_index.html" />
<link rel="prev" title="Alert configuration" href="26_alert.html" />
<script src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-6853682829194266",
enable_page_level_ads: true
});
</script>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-114314379-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-18642541-8');
</script>
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> RPi-Monitor
</a>
<div class="version">
2.13
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="01_features.html">Keys features of RPi-Monitor</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="10_index.html">Getting started</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="20_index.html">Configuration</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="21_daemon.html">Daemon configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="22_extraction.html">Metrics extraction configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="23_configuration_helper.html">Interactive Configuration Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="24_web.html">Web interface configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="25_addons.html">Addons configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="26_alert.html">Alert configuration</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Configuration templates</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="30_index.html">Usages</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="40_index.html">To go further</a></li>
</ul>
<hr />
<div style="padding: 0;">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:inline-block;width:300px;height:250px"
data-ad-client="ca-pub-6853682829194266"
data-ad-slot="2876944524"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">RPi-Monitor</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li><a href="20_index.html">Configuration</a> »</li>
<li>Configuration templates</li>
<li class="wy-breadcrumbs-aside">
<!-- User defined GitHub URL -->
<a href="https://github.com/XavierBerger/RPi-Monitor/blob/develop/docs/source/27_configuration_templates.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="configuration-templates">
<h1>Configuration templates<a class="headerlink" href="#configuration-templates" title="Permalink to this headline">¶</a></h1>
<p><strong>RPi-Monitor</strong> comes with example files showing the capabilities of some features
and functions available in status page.
These files are installed into <code class="docutils literal"><span class="pre">/etc/rpimonotor/templates/</span></code>.
To see how a specific file is behaving, you can include this file into your
configuration file using the <code class="docutils literal"><span class="pre">include</span></code>.</p>
<div class="admonition hint">
<p class="first admonition-title">Hint</p>
<p class="last">By default, files are included and commented out into <code class="docutils literal"><span class="pre">data.conf</span></code>.
To activate them, you can simply uncomment them and restart <code class="docutils literal"><span class="pre">rpimonitord</span></code>.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>Remember to restart <strong>RPi-Monitor</strong> to apply the configuration change:</p>
<div class="last highlight-default"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">init</span><span class="o">.</span><span class="n">d</span><span class="o">/</span><span class="n">rpimonitor</span> <span class="n">restart</span>
</pre></div>
</div>
</div>
<div class="section" id="page-header">
<h2>Page header<a class="headerlink" href="#page-header" title="Permalink to this headline">¶</a></h2>
<p>This function allow to define a custom logo, custom title.</p>
<p>Here is an example of configuration : <code class="docutils literal"><span class="pre">/etc/rpimonitor/template/example.header.conf</span></code></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">web</span><span class="o">.</span><span class="n">page</span><span class="o">.</span><span class="n">icon</span><span class="o">=</span><span class="s1">'img/avatar.png'</span>
<span class="n">web</span><span class="o">.</span><span class="n">page</span><span class="o">.</span><span class="n">menutitle</span><span class="o">=</span><span class="s1">'XB-Monitor <sub>('</span><span class="o">+</span><span class="n">data</span><span class="o">.</span><span class="n">hostname</span><span class="o">+</span><span class="s1">')</sub>'</span>
<span class="n">web</span><span class="o">.</span><span class="n">page</span><span class="o">.</span><span class="n">pagetitle</span><span class="o">=</span><span class="s1">'XB-Monitor ('</span><span class="o">+</span><span class="n">data</span><span class="o">.</span><span class="n">hostname</span><span class="o">+</span><span class="s1">')'</span>
</pre></div>
</div>
<p><code class="docutils literal"><span class="pre">data.hostname</span></code> is a value automatically extracted by <strong>RPi-Monitor</strong>.
It is not needed to add this extration in configuration file.</p>
<p>The file <code class="docutils literal"><span class="pre">avatar.png</span></code> has been added into <code class="docutils literal"><span class="pre">/usr/share/rpimonitor/web/img/</span></code>.</p>
<p>Here is the result:</p>
<div class="figure align-center">
<a class="reference internal image-reference" href="_images/header001.png"><img alt="_images/header001.png" src="_images/header001.png" style="width: 500px;" /></a>
</div>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last">See defails in <a class="reference external" href="24_web.html#header-customisation">Header definition</a></p>
</div>
</div>
<div class="section" id="friends">
<h2>Friends<a class="headerlink" href="#friends" title="Permalink to this headline">¶</a></h2>
<p>Add “friends” links <strong>RPi-Monitor</strong> running on different platform together.</p>
<p>A friend is simply another computer running <strong>RPi-Monitor</strong>. Configuring friends
will add a drop down list on the right of the top menu with a links to
<strong>RPi-Monitor</strong> sitting on the other computer.</p>
<div class="figure align-center">
<a class="reference internal image-reference" href="_images/friends001.png"><img alt="_images/friends001.png" src="_images/friends001.png" style="width: 500px;" /></a>
</div>
<p>Each friend is identified by an <code class="docutils literal"><span class="pre">id</span></code> and is described by 2 parameters: <code class="docutils literal"><span class="pre"><title></span></code> and <code class="docutils literal"><span class="pre"><link></span></code>.</p>
<p>Here is an example of configuration : <code class="docutils literal"><span class="pre">/etc/rpimonitor/template/example.friends.conf</span></code></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">web</span><span class="o">.</span><span class="n">friends</span><span class="o">.</span><span class="mf">1.</span><span class="n">title</span><span class="o">=</span><span class="s2">"Raspberry Pi"</span>
<span class="n">web</span><span class="o">.</span><span class="n">friends</span><span class="o">.</span><span class="mf">1.</span><span class="n">link</span><span class="o">=</span><span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="mf">192.168</span><span class="o">.</span><span class="mf">0.123</span><span class="p">:</span><span class="mi">8888</span><span class="o">/</span>
<span class="n">web</span><span class="o">.</span><span class="n">friends</span><span class="o">.</span><span class="mf">2.</span><span class="n">title</span><span class="o">=</span><span class="s2">"Shuttle"</span>
<span class="n">web</span><span class="o">.</span><span class="n">friends</span><span class="o">.</span><span class="mf">2.</span><span class="n">link</span><span class="o">=</span><span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="mf">192.168</span><span class="o">.</span><span class="mf">0.2</span><span class="p">:</span><span class="mi">8888</span><span class="o">/</span>
<span class="n">web</span><span class="o">.</span><span class="n">friends</span><span class="o">.</span><span class="mf">3.</span><span class="n">title</span><span class="o">=</span><span class="s2">"Netbook"</span>
<span class="n">web</span><span class="o">.</span><span class="n">friends</span><span class="o">.</span><span class="mf">3.</span><span class="n">link</span><span class="o">=</span><span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="mf">192.168</span><span class="o">.</span><span class="mf">0.38</span><span class="p">:</span><span class="mi">8888</span><span class="o">/</span>
</pre></div>
</div>
<div class="figure align-center">
<img alt="_images/friends002.png" src="_images/friends002.png" />
</div>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last">See details in <a class="reference external" href="24_web.html#friends">Friends definition</a></p>
</div>
</div>
<div class="section" id="badges-and-labels">
<h2>Badges and labels<a class="headerlink" href="#badges-and-labels" title="Permalink to this headline">¶</a></h2>
<p>The functions <code class="docutils literal"><span class="pre">Label</span></code> and <code class="docutils literal"><span class="pre">Badge</span></code> are designed to write a text highligted by a color base on condition.</p>
<p>Here is an example of configuration : <code class="docutils literal"><span class="pre">/etc/rpimonitor/template/example.badge_and_label.conf</span></code></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1">########################################################################</span>
<span class="c1"># Example showing usage of labels (also applicable for badges)</span>
<span class="c1"># Page 1:</span>
<span class="c1"># Information Status Statistics</span>
<span class="c1"># - ssh service active - yes -no</span>
<span class="c1"># - rpimonitor service active - yes -no</span>
<span class="c1"># - http service active - yes -no</span>
<span class="c1"># - https service active - yes -no</span>
<span class="c1">########################################################################</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">1.</span><span class="n">name</span><span class="o">=</span><span class="n">ssh</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">1.</span><span class="n">source</span><span class="o">=</span><span class="n">netstat</span> <span class="o">-</span><span class="n">nlt</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">1.</span><span class="n">regexp</span><span class="o">=</span><span class="n">tcp</span> <span class="o">.*</span><span class="p">:(</span><span class="mi">22</span><span class="p">)</span><span class="o">.*</span><span class="n">LISTEN</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">1.</span><span class="n">default</span><span class="o">=</span><span class="mi">0</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">2.</span><span class="n">name</span><span class="o">=</span><span class="n">rpimonitor</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">2.</span><span class="n">source</span><span class="o">=</span><span class="n">netstat</span> <span class="o">-</span><span class="n">nlt</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">2.</span><span class="n">regexp</span><span class="o">=</span><span class="n">tcp</span> <span class="o">.*</span><span class="p">:(</span><span class="mi">8888</span><span class="p">)</span><span class="o">.*</span><span class="n">LISTEN</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">2.</span><span class="n">default</span><span class="o">=</span><span class="mi">0</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">3.</span><span class="n">name</span><span class="o">=</span><span class="n">http</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">3.</span><span class="n">source</span><span class="o">=</span><span class="n">netstat</span> <span class="o">-</span><span class="n">nlt</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">3.</span><span class="n">regexp</span><span class="o">=</span><span class="n">tcp</span> <span class="o">.*</span><span class="p">:(</span><span class="mi">80</span><span class="p">)</span><span class="o">.*</span><span class="n">LISTEN</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">3.</span><span class="n">default</span><span class="o">=</span><span class="mi">0</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">4.</span><span class="n">name</span><span class="o">=</span><span class="n">https</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">4.</span><span class="n">source</span><span class="o">=</span><span class="n">netstat</span> <span class="o">-</span><span class="n">nlt</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">4.</span><span class="n">regexp</span><span class="o">=</span><span class="n">tcp</span> <span class="o">.*</span><span class="p">:(</span><span class="mi">443</span><span class="p">)</span><span class="o">.*</span><span class="n">LISTEN</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">4.</span><span class="n">default</span><span class="o">=</span><span class="mi">0</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">title</span><span class="o">=</span><span class="s2">"Servers"</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">icon</span><span class="o">=</span><span class="n">daemons</span><span class="o">.</span><span class="n">png</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">1</span><span class="o">=</span><span class="s2">"<b>ssh</b> : "</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">ssh</span><span class="p">,</span><span class="s2">"==22"</span><span class="p">,</span><span class="s2">"OK"</span><span class="p">,</span><span class="s2">"label-success"</span><span class="p">)</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">ssh</span><span class="p">,</span><span class="s2">"!=22"</span><span class="p">,</span><span class="s2">"KO"</span><span class="p">,</span><span class="s2">"label-danger"</span><span class="p">)</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">2</span><span class="o">=</span><span class="s2">"<b>rpimonitor</b> : "</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">rpimonitor</span><span class="p">,</span><span class="s2">"==8888"</span><span class="p">,</span><span class="s2">"OK"</span><span class="p">,</span><span class="s2">"label-success"</span><span class="p">)</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">rpimonitor</span><span class="p">,</span><span class="s2">"!=8888"</span><span class="p">,</span><span class="s2">"KO"</span><span class="p">,</span><span class="s2">"label-danger"</span><span class="p">)</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">3</span><span class="o">=</span><span class="s2">"<b>nginx http</b> : "</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">http</span><span class="p">,</span><span class="s2">"==80"</span><span class="p">,</span><span class="s2">"OK"</span><span class="p">,</span><span class="s2">"label-success"</span><span class="p">)</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">http</span><span class="p">,</span><span class="s2">"!=80"</span><span class="p">,</span><span class="s2">"KO"</span><span class="p">,</span><span class="s2">"label-danger"</span><span class="p">)</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">4</span><span class="o">=</span><span class="s2">"<b>nginx https</b> : "</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">https</span><span class="p">,</span><span class="s2">"==443"</span><span class="p">,</span><span class="s2">"OK"</span><span class="p">,</span><span class="s2">"label-success"</span><span class="p">)</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">https</span><span class="p">,</span><span class="s2">"!=443"</span><span class="p">,</span><span class="s2">"KO"</span><span class="p">,</span><span class="s2">"label-danger"</span><span class="p">)</span>
</pre></div>
</div>
<p>In this example, we monitor if the service <code class="docutils literal"><span class="pre">ssh</span></code> is listening on port <code class="docutils literal"><span class="pre">22</span></code> and display a
label <code class="docutils literal"><span class="pre">OK</span></code> if yes or a label <code class="docutils literal"><span class="pre">KO</span></code> if not.</p>
<p>We do the same for <strong>RPi-Monitor</strong> on port <code class="docutils literal"><span class="pre">8888</span></code> and for <code class="docutils literal"><span class="pre">nginx</span></code> on port <code class="docutils literal"><span class="pre">80</span></code> and <code class="docutils literal"><span class="pre">443</span></code>.</p>
<p>Information is extracted from the command <code class="docutils literal"><span class="pre">netstat</span></code>.</p>
<p>The regular expression will return the port number if a service is listening
on this port or nothing if no service is listenning on this port.</p>
<p>The results are accessible into javascript from the variable data. This
variable is passed to the Label function as value.</p>
<p>For ssh, the condition is <code class="docutils literal"><span class="pre">"==22"</span></code> to check if the value is equal to
<code class="docutils literal"><span class="pre">22</span></code> or <code class="docutils literal"><span class="pre">"!=22"</span></code> to check if the value is different form <code class="docutils literal"><span class="pre">22</span></code>. As only one of
the condition will be <code class="docutils literal"><span class="pre">true</span></code>, only one label will be displayed.</p>
<p>Other ports checking are using the same technic.</p>
<p>Here is the result:</p>
<img alt="_images/label001.png" class="align-center" src="_images/label001.png" />
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last">See details in <a class="reference external" href="24_web.html#status">Badge and Label definition in status definition</a></p>
</div>
</div>
<div class="section" id="multiple-pages">
<h2>Multiple pages<a class="headerlink" href="#multiple-pages" title="Permalink to this headline">¶</a></h2>
<p>Status and statistics can be sorted in pages. The parameter <code class="docutils literal"><span class="pre"><page</span> <span class="pre">id></span></code> of
<code class="docutils literal"><span class="pre">web</span></code> configuration is defining in which page data is displayed.</p>
<p>Here is an example of configuration : <code class="docutils literal"><span class="pre">/etc/rpimonitor/template/example.multipage.conf</span></code></p>
<div class="highlight-default"><div class="highlight"><pre><span></span>########################################################################
# Example how to use JustGageBar in status page
# Page: 1
# Information Status Statistics
# - random data - yes -yes
# Page: 2
# Information Status Statistics
# - random data - yes -yes
########################################################################
web.status.1.title="Status 1"
web.statistics.1.title="Statistics 1"
web.status.2.title="Status 2"
web.statistics.2.title="Statistics 2"
dynamic.1.name=data1
dynamic.1.source=od -vAn -N2 -tu2 < /dev/urandom
dynamic.1.regexp=(\d+)
dynamic.1.postprocess=$1%100
dynamic.1.rrd=GAUGE
dynamic.2.name=data2
dynamic.2.source=od -vAn -N2 -tu2 < /dev/random
dynamic.2.regexp=(\d+)
dynamic.2.postprocess=$1%100
dynamic.2.rrd=GAUGE
web.status.1.content.1.title="Data 1"
web.status.1.content.1.icon=cpu_temp.png
web.status.1.content.1.line.1="data1: <b>"+data.data1+"</b>"
web.statistics.1.content.1.title="Data 1"
web.statistics.1.content.1.graph.1=data1
web.statistics.1.content.1.ds_graph_options.living_room_temp.label=Data 1
web.status.2.content.1.title=LinkToGraph(1,0,"Data 2")
web.status.2.content.1.icon=cpu_temp.png
web.status.2.content.1.line.1="data1: <b>"+data.data2+"</b>"
web.statistics.2.content.1.title="Data 2"
web.statistics.2.content.1.graph.1=data2
web.statistics.2.content.1.ds_graph_options.living_room_temp.label=Data 2
</pre></div>
</div>
<p>The new page will be accessible by a drop down menu as shown in the screenshot bellow.</p>
<div class="figure align-center" id="id1">
<a class="reference internal image-reference" href="_images/multipages001.png"><img alt="_images/multipages001.png" src="_images/multipages001.png" style="width: 500px;" /></a>
<p class="caption"><span class="caption-text"><strong>RPi-Monitor</strong> showing multiple status pages</span></p>
</div>
<div class="figure align-center" id="id2">
<a class="reference internal image-reference" href="_images/multipages002.png"><img alt="_images/multipages002.png" src="_images/multipages002.png" style="width: 500px;" /></a>
<p class="caption"><span class="caption-text"><strong>RPi-Monitor</strong> showing multiple graph pages</span></p>
</div>
</div>
<div class="section" id="progress-bar">
<h2>Progress bar<a class="headerlink" href="#progress-bar" title="Permalink to this headline">¶</a></h2>
<p>The functions <code class="docutils literal"><span class="pre">ProgressBar</span></code> are designed to draw a progress bar. Default color is bleu.
Color can change base on <strong>warning</strong> and <strong>danger</strong> thresholds.</p>
<p>Here is an example of configuration : <code class="docutils literal"><span class="pre">/etc/rpimonitor/template/example.progressbar.conf</span></code></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1">########################################################################</span>
<span class="c1"># Example how to use progressbar in status page</span>
<span class="c1"># Page: 1</span>
<span class="c1"># Information Status Statistics</span>
<span class="c1"># - static data - yes -no</span>
<span class="c1">########################################################################</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">title</span><span class="o">=</span><span class="s2">"ProgressBar"</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">icon</span><span class="o">=</span><span class="n">version</span><span class="o">.</span><span class="n">png</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">1</span><span class="o">=</span><span class="s1">'<b>ProgressBar without warning or critical</b>'</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">2</span><span class="o">=</span><span class="n">ProgressBar</span><span class="p">(</span><span class="mi">33</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">3</span><span class="o">=</span><span class="s1">'<b>ProgressBar with warning lower than critical (Example: disk usage)</b>'</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">4</span><span class="o">=</span><span class="n">ProgressBar</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">33</span><span class="p">,</span> <span class="mi">66</span><span class="p">)</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">5</span><span class="o">=</span><span class="n">ProgressBar</span><span class="p">(</span><span class="mi">50</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">33</span><span class="p">,</span> <span class="mi">66</span><span class="p">)</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">6</span><span class="o">=</span><span class="n">ProgressBar</span><span class="p">(</span><span class="mi">75</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">33</span><span class="p">,</span> <span class="mi">66</span><span class="p">)</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">7</span><span class="o">=</span><span class="s1">'<b>ProgressBar with warning higher than critical (Example: ink cartridge)</b>'</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">8</span><span class="o">=</span><span class="n">ProgressBar</span><span class="p">(</span><span class="mi">75</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">66</span><span class="p">,</span> <span class="mi">33</span><span class="p">)</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">9</span><span class="o">=</span><span class="n">ProgressBar</span><span class="p">(</span><span class="mi">50</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">66</span><span class="p">,</span> <span class="mi">33</span><span class="p">)</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">10</span><span class="o">=</span><span class="n">ProgressBar</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">66</span><span class="p">,</span> <span class="mi">33</span><span class="p">)</span>
</pre></div>
</div>
<p>Here is the result:</p>
<div class="figure align-center" id="id3">
<a class="reference internal image-reference" href="_images/web001.png"><img alt="_images/web001.png" src="_images/web001.png" style="width: 400px;" /></a>
<p class="caption"><span class="caption-text">Show warning and critical and colors</span></p>
</div>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last">See details in <a class="reference external" href="24_web.html#status">ProgressBar definition in status definition</a></p>
</div>
</div>
<div class="section" id="justgagebar">
<h2>JustGageBar<a class="headerlink" href="#justgagebar" title="Permalink to this headline">¶</a></h2>
<p>Justgage is a handy JavaScript plugin for generating and animating nice & clean gauges.
It is based on Raphaël library for vector drawing, so it’s completely resolution independent and self-adjusting.</p>
<p>Here is an example of configuration : <code class="docutils literal"><span class="pre">/etc/rpimonitor/template/example.justgage.conf</span></code></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1">########################################################################</span>
<span class="c1"># Example how to use JustGageBar in status page</span>
<span class="c1"># Page: 1</span>
<span class="c1"># Information Status Statistics</span>
<span class="c1"># - example with static data - yes -no</span>
<span class="c1">########################################################################</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">title</span><span class="o">=</span><span class="s2">"JustGageBar"</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">icon</span><span class="o">=</span><span class="n">version</span><span class="o">.</span><span class="n">png</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">1</span><span class="o">=</span><span class="s1">'<b>JustGageBar default configuration</b>'</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">2</span><span class="o">=</span><span class="n">JustGageBar</span><span class="p">(</span><span class="s2">"Normal"</span><span class="p">,</span> <span class="s2">"No Colors"</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span><span class="o">+</span><span class="s2">" "</span><span class="o">+</span><span class="n">JustGageBar</span><span class="p">(</span><span class="s2">"Warning"</span><span class="p">,</span> <span class="s2">"No Colors"</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span><span class="o">+</span><span class="s2">" "</span><span class="o">+</span><span class="n">JustGageBar</span><span class="p">(</span><span class="s2">"Critical"</span><span class="p">,</span> <span class="s2">"No Colors"</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">3</span><span class="o">=</span><span class="s1">'<b>JustGageBar custom colors</b>'</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">4</span><span class="o">=</span><span class="n">JustGageBar</span><span class="p">(</span><span class="s2">"Normal"</span><span class="p">,</span> <span class="s2">"Colors"</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="mi">80</span><span class="p">,[</span> <span class="s2">"#0ba9d7"</span><span class="p">,</span> <span class="s2">"#02f9c8"</span><span class="p">,</span> <span class="s2">"#00ff00"</span> <span class="p">])</span><span class="o">+</span><span class="s2">" "</span><span class="o">+</span><span class="n">JustGageBar</span><span class="p">(</span><span class="s2">"Warning"</span><span class="p">,</span> <span class="s2">"Colors"</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="mi">80</span><span class="p">,[</span> <span class="s2">"#0ba9d7"</span><span class="p">,</span> <span class="s2">"#02f9c8"</span><span class="p">,</span> <span class="s2">"#00ff00"</span> <span class="p">])</span><span class="o">+</span><span class="s2">" "</span><span class="o">+</span><span class="n">JustGageBar</span><span class="p">(</span><span class="s2">"Critical"</span><span class="p">,</span> <span class="s2">"Colors"</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="mi">80</span><span class="p">,[</span> <span class="s2">"#0ba9d7"</span><span class="p">,</span> <span class="s2">"#02f9c8"</span><span class="p">,</span> <span class="s2">"#00ff00"</span> <span class="p">])</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">5</span><span class="o">=</span><span class="s1">'<b>JustGageBar custom level for warning and critical level</b>'</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">6</span><span class="o">=</span><span class="n">JustGageBar</span><span class="p">(</span><span class="s2">"Normal"</span><span class="p">,</span> <span class="s2">"WarnCrit"</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="mi">80</span><span class="p">,</span><span class="n">percentColors</span><span class="p">,</span><span class="mi">10</span><span class="p">,</span><span class="mi">50</span><span class="p">)</span><span class="o">+</span><span class="s2">" "</span><span class="o">+</span><span class="n">JustGageBar</span><span class="p">(</span><span class="s2">"Warning"</span><span class="p">,</span> <span class="s2">"WarnCrit"</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="mi">80</span><span class="p">,</span><span class="n">percentColors</span><span class="p">,</span><span class="mi">10</span><span class="p">,</span><span class="mi">50</span><span class="p">)</span><span class="o">+</span><span class="s2">" "</span><span class="o">+</span><span class="n">JustGageBar</span><span class="p">(</span><span class="s2">"Critical"</span><span class="p">,</span> <span class="s2">"WarnCrit"</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span> <span class="mi">51</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="mi">80</span><span class="p">,</span><span class="n">percentColors</span><span class="p">,</span><span class="mi">10</span><span class="p">,</span><span class="mi">50</span><span class="p">)</span>
</pre></div>
</div>
<p>Here is the result:</p>
<div class="figure align-center" id="id4">
<a class="reference internal image-reference" href="_images/web002.png"><img alt="_images/web002.png" src="_images/web002.png" style="width: 400px;" /></a>
<p class="caption"><span class="caption-text">Show warning and critical and colors</span></p>
</div>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last">See details in <a class="reference external" href="24_web.html#status">JustGageBar definition in status definition</a></p>
</div>
</div>
<div class="section" id="visibility">
<h2>Visibility<a class="headerlink" href="#visibility" title="Permalink to this headline">¶</a></h2>
<p>Visibility parameter define if a row should be displayed or not. It could be usefull
for monitoring of an external disk which could be disconnected.</p>
<p>Here is an example of configuration : <code class="docutils literal"><span class="pre">/etc/rpimonitor/template/example.visibility.conf</span></code></p>
<p>In this example, the row is alternativelly dosplayed and hide depending on minute parity.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>########################################################################
# Example how to manage visibility of status information
# Page: 1
# Information Status Statistics
# - visibility - yes - no
# This proof of concept is behaving has follow:
# If minute number is odd the row is visible
# If minute number is even the row is hidden
# The parameter visibility should be a valid javascript formula returning
# - 0 to hide the row
# - anything else but 0 to show the row
########################################################################
dynamic.1.name=visibility
dynamic.1.source=date +"%M"
dynamic.1.regexp=(.*)
dynamic.1.postprocess=$1%2
dynamic.1.rrd=
web.status.1.content.1.title="Visibility"
web.status.1.content.1.icon=version.png
web.status.1.content.1.visibility=data.visibility
web.status.1.content.1.line.1='Visibility: <b>Control row visibility</b>'
</pre></div>
</div>
<p>Here is the result:</p>
<div class="figure align-center" id="id5">
<a class="reference internal image-reference" href="_images/visibility001.png"><img alt="_images/visibility001.png" src="_images/visibility001.png" style="width: 400px;" /></a>
<p class="caption"><span class="caption-text">Show visibility feature</span></p>
</div>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last">See details in <a class="reference external" href="24_web.html#status">Visibility definition in status definition</a></p>
</div>
</div>
<div class="section" id="interval">
<h2>Interval<a class="headerlink" href="#interval" title="Permalink to this headline">¶</a></h2>
<p>Interval parameter define when data should be extracted. By defaut an interval is 10 sec.
Sometime it is usefull to extract data less frequently. Setting <cite>interval</cite> to 3 will
extract data every 30sec.</p>
<p>Here is an example of configuration : <code class="docutils literal"><span class="pre">/etc/rpimonitor/template/example.interval.conf</span></code></p>
<p>In this example is showing interval set tj 1, 3 and 7</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1">########################################################################</span>
<span class="c1"># Example how to use interval for data extraction</span>
<span class="c1"># Page: 1</span>
<span class="c1"># Information Status Statistics</span>
<span class="c1"># - Show date with interval=1 -yes -no</span>
<span class="c1"># - Show date with interval=3 -yes -no</span>
<span class="c1"># - Show date with interval=7 -yes -no</span>
<span class="c1">########################################################################</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">1.</span><span class="n">name</span><span class="o">=</span><span class="n">interval1</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">1.</span><span class="n">source</span><span class="o">=</span><span class="n">date</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">1.</span><span class="n">regexp</span><span class="o">=</span><span class="p">(</span><span class="o">.*</span><span class="p">)</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">2.</span><span class="n">name</span><span class="o">=</span><span class="n">interval3</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">2.</span><span class="n">source</span><span class="o">=</span><span class="n">date</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">2.</span><span class="n">regexp</span><span class="o">=</span><span class="p">(</span><span class="o">.*</span><span class="p">)</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">2.</span><span class="n">interval</span><span class="o">=</span><span class="mi">3</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">3.</span><span class="n">name</span><span class="o">=</span><span class="n">interval7</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">3.</span><span class="n">source</span><span class="o">=</span><span class="n">date</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">3.</span><span class="n">regexp</span><span class="o">=</span><span class="p">(</span><span class="o">.*</span><span class="p">)</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">3.</span><span class="n">interval</span><span class="o">=</span><span class="mi">7</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">title</span><span class="o">=</span><span class="s2">"Interval"</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">icon</span><span class="o">=</span><span class="n">version</span><span class="o">.</span><span class="n">png</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">1</span><span class="o">=</span><span class="s1">'Interval=1 last update at <b>'</span><span class="o">+</span><span class="n">data</span><span class="o">.</span><span class="n">interval1</span><span class="o">+</span><span class="s1">'</b>'</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">2</span><span class="o">=</span><span class="s1">'Interval=3 last update at <b>'</span><span class="o">+</span><span class="n">data</span><span class="o">.</span><span class="n">interval3</span><span class="o">+</span><span class="s1">'</b>'</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">3</span><span class="o">=</span><span class="s1">'Interval=7 last update at <b>'</span><span class="o">+</span><span class="n">data</span><span class="o">.</span><span class="n">interval7</span><span class="o">+</span><span class="s1">'</b>'</span>
</pre></div>
</div>
<p>Here is the result:</p>
<div class="figure align-center">
<img alt="_images/interval001.png" src="_images/interval001.png" />
</div>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last">See details in <a class="reference external" href="24_web.html#status">Interval definition in status definition</a></p>
</div>
</div>
<div class="section" id="alerts">
<h2>Alerts<a class="headerlink" href="#alerts" title="Permalink to this headline">¶</a></h2>
<p><strong>RPi-Monitor</strong> is embedding a mechanism of alerts. The idea is to execute a
script when a KPI reach a limit. To avoid executing this script to frequently,
some timer have to be configured.
The file <code class="docutils literal"><span class="pre">example.alert.conf</span></code> show how to configure alerts.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1">########################################################################</span>
<span class="c1"># Example how to use Alerts</span>
<span class="c1">#</span>
<span class="c1"># Page: 1</span>
<span class="c1"># Information Status Statistics</span>
<span class="c1"># - example static data - yes -yes</span>
<span class="c1">#</span>
<span class="c1"># Alert too hot if test_alert > 50</span>
<span class="c1"># Alert too cold if test_alert < 10</span>
<span class="c1">################################################################################</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">1.</span><span class="n">name</span><span class="o">=</span><span class="n">test_alert</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">1.</span><span class="n">source</span><span class="o">=/</span><span class="n">tmp</span><span class="o">/</span><span class="n">test_alert</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">1.</span><span class="n">regexp</span><span class="o">=</span><span class="p">(</span>\<span class="n">S</span><span class="o">+</span><span class="p">)</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">1.</span><span class="n">default</span><span class="o">=</span><span class="mi">37</span>
<span class="n">dynamic</span><span class="o">.</span><span class="mf">1.</span><span class="n">rrd</span><span class="o">=</span><span class="n">GAUGE</span>
<span class="n">web</span><span class="o">.</span><span class="n">statistics</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">title</span><span class="o">=</span><span class="s2">"Test alerts"</span>
<span class="n">web</span><span class="o">.</span><span class="n">statistics</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">graph</span><span class="o">.</span><span class="mi">1</span><span class="o">=</span><span class="n">test_alert</span>
<span class="n">web</span><span class="o">.</span><span class="n">statistics</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">ds_graph_options</span><span class="o">.</span><span class="n">soc_temp</span><span class="o">.</span><span class="n">label</span><span class="o">=</span><span class="n">test_alert</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_hot</span><span class="o">.</span><span class="n">active</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">uptime</span><span class="o">></span><span class="mi">120</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_hot</span><span class="o">.</span><span class="n">trigger</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">test_alert</span><span class="o">></span><span class="mi">50</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_hot</span><span class="o">.</span><span class="n">maxalertduration</span><span class="o">=</span><span class="mi">20</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_hot</span><span class="o">.</span><span class="n">cancelvalidation</span><span class="o">=</span><span class="mi">20</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_hot</span><span class="o">.</span><span class="n">resendperiod</span><span class="o">=</span><span class="mi">60</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_hot</span><span class="o">.</span><span class="n">raisecommand</span><span class="o">=</span><span class="n">echo</span> <span class="s1">'Too hot alert raised data.test_alert>50'</span> <span class="o">></span> <span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">test_alert</span><span class="o">.</span><span class="n">hot</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_hot</span><span class="o">.</span><span class="n">cancelcommand</span><span class="o">=</span><span class="n">echo</span> <span class="s2">""</span> <span class="o">></span> <span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">test_alert</span><span class="o">.</span><span class="n">hot</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_cold</span><span class="o">.</span><span class="n">active</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">uptime</span><span class="o">></span><span class="mi">120</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_cold</span><span class="o">.</span><span class="n">trigger</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">test_alert</span><span class="o"><</span><span class="mi">10</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_cold</span><span class="o">.</span><span class="n">maxalertduration</span><span class="o">=</span><span class="mi">20</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_cold</span><span class="o">.</span><span class="n">cancelvalidation</span><span class="o">=</span><span class="mi">20</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_cold</span><span class="o">.</span><span class="n">resendperiod</span><span class="o">=</span><span class="mi">60</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_cold</span><span class="o">.</span><span class="n">raisecommand</span><span class="o">=</span><span class="n">echo</span> <span class="s1">'Too cold alert raised raised data.test_alert<10'</span> <span class="o">></span> <span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">test_alert</span><span class="o">.</span><span class="n">cold</span>
<span class="n">alert</span><span class="o">.</span><span class="n">too_cold</span><span class="o">.</span><span class="n">cancelcommand</span><span class="o">=</span><span class="n">echo</span> <span class="s2">""</span> <span class="o">></span> <span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">test_alert</span><span class="o">.</span><span class="n">cold</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">title</span><span class="o">=</span><span class="s2">"Alerts"</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">icon</span><span class="o">=</span><span class="n">daemons</span><span class="o">.</span><span class="n">png</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">1</span><span class="o">=</span><span class="s2">"Test temperature: "</span><span class="o">+</span><span class="n">data</span><span class="o">.</span><span class="n">test_alert</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">2</span><span class="o">=</span><span class="s2">"Too hot: "</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">alert</span><span class="o">.</span><span class="n">too_hot</span><span class="o">.</span><span class="n">alertstate</span><span class="p">,</span><span class="s2">"==0"</span><span class="p">,</span><span class="s2">"Everything is OK"</span><span class="p">,</span><span class="s2">"success"</span><span class="p">)</span><span class="o">+</span><span class="s2">" "</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">alert</span><span class="o">.</span><span class="n">too_hot</span><span class="o">.</span><span class="n">alertstate</span><span class="p">,</span><span class="s2">"==1"</span><span class="p">,</span><span class="s2">"Houston we have a problem: "</span><span class="o">+</span><span class="n">data</span><span class="o">.</span><span class="n">test_alert</span><span class="o">+</span><span class="s2">">50"</span><span class="p">,</span><span class="s2">"warning"</span><span class="p">)</span><span class="o">+</span><span class="s2">" "</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">alert</span><span class="o">.</span><span class="n">too_hot</span><span class="o">.</span><span class="n">lastsendalertdate</span><span class="p">,</span><span class="s2">"!=0"</span><span class="p">,</span><span class="s2">"Alert is on going"</span><span class="p">,</span><span class="s2">"danger"</span><span class="p">)</span>
<span class="n">web</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="mf">1.</span><span class="n">content</span><span class="o">.</span><span class="mf">1.</span><span class="n">line</span><span class="o">.</span><span class="mi">3</span><span class="o">=</span><span class="s2">"Too cold: "</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">alert</span><span class="o">.</span><span class="n">too_cold</span><span class="o">.</span><span class="n">alertstate</span><span class="p">,</span><span class="s2">"==0"</span><span class="p">,</span><span class="s2">"Everything is OK"</span><span class="p">,</span><span class="s2">"success"</span><span class="p">)</span><span class="o">+</span><span class="s2">" "</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">alert</span><span class="o">.</span><span class="n">too_cold</span><span class="o">.</span><span class="n">alertstate</span><span class="p">,</span><span class="s2">"==1"</span><span class="p">,</span><span class="s2">"Houston we have a problem: "</span><span class="o">+</span><span class="n">data</span><span class="o">.</span><span class="n">test_alert</span><span class="o">+</span><span class="s2">"<10"</span><span class="p">,</span><span class="s2">"warning"</span><span class="p">)</span><span class="o">+</span><span class="s2">" "</span><span class="o">+</span><span class="n">Label</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">alert</span><span class="o">.</span><span class="n">too_cold</span><span class="o">.</span><span class="n">lastsendalertdate</span><span class="p">,</span><span class="s2">"!=0"</span><span class="p">,</span><span class="s2">"Alert is on going"</span><span class="p">,</span><span class="s2">"danger"</span><span class="p">)</span>
</pre></div>
</div>
<p>The first part defines dynamic data and how <strong>RPi-Monitor</strong> should do to extract
information from the file <code class="docutils literal"><span class="pre">/tmp/alert_test</span></code>.</p>
<p>These data are added in statistics page (<code class="docutils literal"><span class="pre">web.statistics.1.[...]</span></code>) to graphs the temperature.</p>
<p>Then we configure 2 alerts <code class="docutils literal"><span class="pre">too_hot</span></code> and <code class="docutils literal"><span class="pre">too_cold</span></code>. Let’s see how <code class="docutils literal"><span class="pre">too_hot</span></code> is configured</p>
<p>The alert will be evaluated only when it will become active, when <code class="docutils literal"><span class="pre">active</span></code> parameter will be evaluate to <code class="docutils literal"><span class="pre">true</span></code>.
In this example 120 seconds after computer starts: <code class="docutils literal"><span class="pre">alert.too_hot.active=data.uptime>120</span></code>.</p>
<p>When the alert is active, the trigger is evaluated. In this example, when test
if the value of <code class="docutils literal"><span class="pre">test_alert</span></code> is greater than 50: <code class="docutils literal"><span class="pre">alert.too_hot.trigger=data.test_alert>50</span></code>.</p>
<p>When the trigger returns <code class="docutils literal"><span class="pre">true</span></code> during <code class="docutils literal"><span class="pre">maxalertduration</span></code> seconds (20 seconds), the command
<code class="docutils literal"><span class="pre">commandTooHot</span></code> is executed.
If the trigger is still true after <code class="docutils literal"><span class="pre">resendperiod</span></code> seconds after (60 seconds), the command
<code class="docutils literal"><span class="pre">raisecommand</span></code> is executed again.</p>
<p>When the trigger become <code class="docutils literal"><span class="pre">false</span></code> during <code class="docutils literal"><span class="pre">cancelvalidation</span></code> seconds (20 seconds), the command
<code class="docutils literal"><span class="pre">cancelcommand</span></code> is executed.</p>
<p>Into the example file, you can see how these data are used to display label on status page.
You will see that limit exceed is immediately detected and see alert send after the defined delay.</p>
<p>To simulate a temperature monitoring and see how this configuration can raise and clear alerts, execute
the following commands to generate data:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>while ( true ); do echo $(( ( RANDOM % 100 ) - 20 )) > /tmp/test_alert; sleep 90; done
</pre></div>
</div>
<p>Execute the following command to see alerts</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">watch</span> <span class="s1">'grep ".*" /tmp/test_alert.*'</span>
</pre></div>
</div>
<p>Open the status page and check the auto update option to see the example running in real time as shown bellow:</p>
<div class="figure align-center">
<img alt="_images/alertanimation001.gif" src="_images/alertanimation001.gif" />
</div>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last">See details in <a class="reference external" href="26_alert.html">Alert definition in status definition</a></p>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="30_index.html" class="btn btn-neutral float-right" title="Usages" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="26_alert.html" class="btn btn-neutral" title="Alert configuration" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2018, Xavier Berger.
Last updated on Mar 18, 2018.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-6853682829194266"
data-ad-slot="2876944524"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enableSticky();
});
</script>
</body>
</html>