十分意外镜像站用户增长速度如此之快,面对日均五万左右的用户量,服务器频繁出现各种性能问题。在故障排查的过程中,我意识到服务器需要一套成熟、完整、可靠的日志监控及预警方案。

先前长期使用 goaccess 静态分析Nginx的日志,具有滞后性。只能用于单纯的分析总结一段时间内的网站流量状况,而无法做到实时监看服务状态和运行数据。

既然是开源镜像站,那么我们就需要把目光投向开源社区。

较为流行的ELK

目前市面上最流行的日志处理方案莫过于“ELK”系统,“ELK”是Elasticsearch、Logstash和Kibana的组合的合称。

Elasticsearch 是一个搜索和分析引擎。Logstash 是服务器端数据处理管道,能够同时从多个来源采集数据,转换数据,然后将数据发送到诸如 Elasticsearch 等“存储库”中。Kibana 则可以让用户在 Elasticsearch 中使用图形和图表对数据进行可视化。

InfluxDB&Telegraf

通过自己的初步了解以及咨询使用者的使用体验,我认为ELK在使用体验和性能上都不适合我(其实是单纯的不喜欢Java)。而一个朋友推荐我去尝试一下 InfluxDB+Telegraf 的组合。

服务器的性能日志从本质上来说,属于时序大数据,我们打开数据库排名网站DB-Engines Ranking,左侧选择时序数据库(Time Series DBMS),可以看到 InfluxDB 在排名上一骑绝尘。

image.png

安装直接跟着官方文档即可,下面我将英文文档翻译一下给大家参考:

使用 systemd 将 InfluxDB 安装为服务

  1. 使用以下命令从InfluxData 下载页面使用 URL 下载并安装适当的.deb或文件:.rpm

    1
    2
    3
    4
    5
    6
    7
    # Ubuntu/Debian
    wget https://dl.influxdata.com/influxdb/releases/influxdb2-2.6.0-xxx.deb
    sudo dpkg -i influxdb2-2.6.0-xxx.deb

    # Red Hat/CentOS/Fedora
    wget https://dl.influxdata.com/influxdb/releases/influxdb2-2.6.0-xxx.rpm
    sudo yum localinstall influxdb2-2.6.0-xxx.rpm

    使用.rpm包下载的确切文件名(例如,influxdb2-2.6.0-amd64.rpm)。

  2. 启动 InfluxDB 服务:

    1
    sudo service influxdb start

    安装 InfluxDB 包会创建一个服务文件,/lib/systemd/system/influxdb.service 用于在启动时将 InfluxDB 作为后台服务启动。

  3. 重新启动系统并验证服务是否正常运行:

    1
    2
    3
    4
    $  sudo service influxdb status
    ● influxdb.service - InfluxDB is an open-source, distributed, time series database
    Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enable>
    Active: active (running)

有关 InfluxDB 在作为服务运行时在磁盘上存储数据的位置的信息,请参阅文件系统布局

要自定义 InfluxDB 配置,请使用 命令行标志(参数)、环境变量或 InfluxDB 配置文件。有关详细信息,请参阅 InfluxDB配置选项

将参数传递给 systemd

  1. 添加一行或多行命令,如下所示,包含influxdto的参数/etc/default/influxdb2

    1
    2
    ARG1="--http-bind-address :8087"
    ARG2="<another argument here>"
  2. 编辑/lib/systemd/system/influxdb.service文件如下:

    1
    ExecStart=/usr/bin/influxd $ARG1 $ARG2

启动 InfluxDB

如果 InfluxDB 作为 systemd 服务安装,则 systemd 管理influxd守护进程,不需要进一步的操作。如果二进制文件是手动下载并添加到系统中的,请使用以下命令$PATH启动守护进程:

1
influxd

进入8086端口配置好后,就可以在DashBoard里查阅可视化数据了。

image.png

Grafana

InfluxDB毕竟是一个数据库,在可视化方便并不擅长。因此我在另外一台机器上调用InfluxDB的数据源制作可视化面板。

image.png

面板主要包含了Nginx启动状态、内存利用、储存利用、CPU、DiskIO、网络状态和缓存命中率等。

下面是面板的JSON以供参考

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
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 1,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"0": {
"index": 0,
"text": "DOWN"
}
},
"type": "value"
},
{
"options": {
"from": 1,
"result": {
"index": 1,
"text": "UP"
},
"to": 9999999
},
"type": "range"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 3,
"x": 0,
"y": 0
},
"id": 21,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "9.2.4",
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"query": "from(bucket: \"qlu\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"nginx\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"active\")\r\n |> filter(fn: (r) => r[\"host\"] == \"i-30g60b69\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")",
"refId": "A"
}
],
"title": "Nginx UP/DOWN",
"type": "stat"
},
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
"mappings": [],
"min": 0,
"unit": "decbytes"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "cached i-30g60b69"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "light-blue",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "free i-30g60b69"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "light-green",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "used i-30g60b69"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "red",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "buffered i-30g60b69"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "yellow",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 6,
"x": 3,
"y": 0
},
"id": 10,
"options": {
"displayLabels": [
"value"
],
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true,
"values": [
"value"
]
},
"pieType": "donut",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"tooltip": {
"mode": "single",
"sort": "desc"
}
},
"pluginVersion": "9.2.4",
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"query": "from(bucket: \"qlu\")\r\n |> range(start: v.timeRangeStart)\r\n |> filter(fn: (r) => r._measurement == \"mem\")\r\n |> filter(fn: (r) => r._field == \"used\" or r._field == \"cached\" or r._field == \"free\" or r._field == \"buffered\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")",
"refId": "A"
}
],
"title": "Memory Usage",
"transformations": [],
"type": "piechart"
},
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "percent"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 3,
"x": 9,
"y": 0
},
"id": 12,
"options": {
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true
},
"pluginVersion": "9.2.4",
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"query": "from(bucket: \"qlu\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"disk\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"used_percent\")\r\n |> filter(fn: (r) => r[\"device\"] == \"vdc\")\r\n |> filter(fn: (r) => r[\"fstype\"] == \"ext4\")\r\n |> filter(fn: (r) => r[\"host\"] == \"i-30g60b69\")\r\n |> filter(fn: (r) => r[\"mode\"] == \"rw\")\r\n |> filter(fn: (r) => r[\"path\"] == \"/mnt/vos-6izqwyw8\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")",
"refId": "A"
}
],
"title": "Disk Usage",
"type": "gauge"
},
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 31,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "normal"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 0
},
"id": 19,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"query": "from(bucket: \"qlu\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"nginx\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"waiting\" or r[\"_field\"] == \"writing\")\r\n |> filter(fn: (r) => r[\"host\"] == \"i-30g60b69\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")",
"refId": "A"
}
],
"title": "TCP Socket",
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 79,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "normal"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 6,
"x": 0,
"y": 8
},
"id": 18,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"query": "from(bucket: \"qlu\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"cpu\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"usage_iowait\" or r[\"_field\"] == \"usage_irq\" or r[\"_field\"] == \"usage_steal\" or r[\"_field\"] == \"usage_user\" or r[\"_field\"] == \"usage_system\" or r[\"_field\"] == \"usage_softirq\" or r[\"_field\"] == \"usage_nice\" or r[\"_field\"] == \"usage_guest_nice\" or r[\"_field\"] == \"usage_guest\")\r\n |> filter(fn: (r) => r[\"host\"] == \"i-30g60b69\")\r\n |> filter(fn: (r) => r[\"cpu\"] == \"cpu-total\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")",
"refId": "A"
}
],
"title": "CPU*",
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisGridShow": false,
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 50,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"linearThreshold": 1,
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "Bps"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 6,
"x": 6,
"y": 8
},
"id": 6,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"query": "from(bucket: \"qlu\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"diskio\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"read_bytes\" or r[\"_field\"] == \"write_bytes\")\r\n |> filter(fn: (r) => r[\"host\"] == \"i-30g60b69\")\r\n |> filter(fn: (r) => r[\"name\"] == \"vdc\")\r\n |> derivative(unit: 1s, nonNegative: false)\r\n |> yield(name: \"derivative\")",
"refId": "A"
}
],
"title": "Disk IO",
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 21,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "bytes"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 8
},
"id": 14,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"query": "from(bucket: \"qlu\")\r\n |> range(start: v.timeRangeStart)\r\n |> filter(fn: (r) => r._measurement == \"net\")\r\n |> filter(fn: (r) => r._field == \"bytes_recv\" or r._field == \"bytes_sent\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\r\n |> derivative(unit: 1s, nonNegative: false)\r\n |> yield(name: \"derivative\")",
"refId": "A"
}
],
"title": "IPv4 Traffic",
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 50,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "decbytes"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 16
},
"id": 23,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"query": "from(bucket: \"qlu\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"mem\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"cached\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")",
"refId": "A"
}
],
"title": "Memory Cached",
"type": "timeseries"
},
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": -1,
"drawStyle": "bars",
"fillOpacity": 86,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 0,
"pointSize": 4,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "percentunit"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 16
},
"id": 25,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"query": "from(bucket: \"qlu\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"diskio\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"read_bytes\")\r\n |> filter(fn: (r) => r[\"host\"] == \"i-30g60b69\")\r\n |> filter(fn: (r) => r[\"name\"] == \"vdc\")\r\n |> derivative(unit: 10s, nonNegative: false)\r\n |> yield(name: \"derivative\")",
"refId": "A"
},
{
"datasource": {
"type": "influxdb",
"uid": "8-KvbZO4k"
},
"hide": false,
"query": "from(bucket: \"qlu\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"net\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"bytes_sent\")\r\n |> filter(fn: (r) => r[\"host\"] == \"i-30g60b69\")\r\n |> filter(fn: (r) => r[\"interface\"] == \"eth0\")\r\n |> derivative(unit: 10s, nonNegative: false)\r\n |> yield(name: \"derivative\")",
"refId": "B"
}
],
"title": "Cache Hit Rate",
"transformations": [
{
"id": "calculateField",
"options": {
"alias": "REC",
"binary": {
"left": "bytes_sent {host=\"i-30g60b69\", interface=\"eth0\", name=\"net\"}",
"operator": "-",
"reducer": "sum",
"right": "read_bytes {host=\"i-30g60b69\", name=\"diskio\"}"
},
"mode": "binary",
"reduce": {
"reducer": "sum"
},
"replaceFields": false
}
},
{
"id": "calculateField",
"options": {
"alias": "Cache Hit Rate",
"binary": {
"left": "REC",
"operator": "/",
"reducer": "sum",
"right": "bytes_sent {host=\"i-30g60b69\", interface=\"eth0\", name=\"net\"}"
},
"mode": "binary",
"reduce": {
"reducer": "sum"
},
"replaceFields": true
}
}
],
"type": "timeseries"
}
],
"refresh": "5s",
"schemaVersion": 37,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "QLU_Mirrors",
"uid": "z38bN0O4z",
"version": 15,
"weekStart": ""
}