unoffical wafrn mirror
wafrn.net
atproto
social-network
activitypub
1{
2 "annotations": {
3 "list": [
4 {
5 "builtIn": 1,
6 "datasource": {
7 "type": "datasource",
8 "uid": "grafana"
9 },
10 "enable": true,
11 "hide": true,
12 "iconColor": "rgba(0, 211, 255, 1)",
13 "name": "Annotations & Alerts",
14 "type": "dashboard"
15 }
16 ]
17 },
18 "editable": true,
19 "fiscalYearStartMonth": 0,
20 "graphTooltip": 0,
21 "links": [],
22 "panels": [
23 {
24 "datasource": {
25 "type": "grafana-postgresql-datasource",
26 "uid": "pgwatch-metrics"
27 },
28 "description": "Please adjust the markers as needed! Also the default query assumes that all DBs are separate instances. If not so change the query to add some filters or groupings based on the wal.sys_id column for example or the configured_dbs.continuous_discovery_prefix if using the DB auto-discovery modes. The same applies also for the below \"top\" table panels.",
29 "fieldConfig": {
30 "defaults": {
31 "color": {
32 "mode": "thresholds"
33 },
34 "mappings": [],
35 "max": 10,
36 "min": 0,
37 "thresholds": {
38 "mode": "absolute",
39 "steps": [
40 {
41 "color": "dark-red",
42 "value": null
43 },
44 {
45 "color": "dark-green",
46 "value": 10
47 }
48 ]
49 }
50 },
51 "overrides": []
52 },
53 "gridPos": {
54 "h": 7,
55 "w": 8,
56 "x": 0,
57 "y": 0
58 },
59 "id": 2,
60 "options": {
61 "minVizHeight": 75,
62 "minVizWidth": 75,
63 "orientation": "auto",
64 "reduceOptions": {
65 "calcs": [
66 "last"
67 ],
68 "fields": "",
69 "values": false
70 },
71 "showThresholdLabels": true,
72 "showThresholdMarkers": true,
73 "sizing": "auto"
74 },
75 "pluginVersion": "10.4.1",
76 "targets": [
77 {
78 "datasource": {
79 "type": "grafana-postgresql-datasource",
80 "uid": "pgwatch-metrics"
81 },
82 "format": "time_series",
83 "group": [
84 {
85 "params": [
86 "dbname"
87 ],
88 "type": "column"
89 }
90 ],
91 "metricColumn": "dbname",
92 "rawQuery": true,
93 "rawSql": "SELECT\n 0 AS \"time\",\n count(distinct dbname)\nFROM wal\nWHERE\n $__timeFilter(\"time\")\n AND (data->'in_recovery_int')::int = 0",
94 "refId": "A",
95 "select": [
96 [
97 {
98 "params": [
99 "value"
100 ],
101 "type": "column"
102 },
103 {
104 "params": [
105 "avg"
106 ],
107 "type": "aggregate"
108 },
109 {
110 "params": [
111 "value"
112 ],
113 "type": "alias"
114 }
115 ]
116 ],
117 "table": "db_stats",
118 "timeColumn": "\"time\"",
119 "timeColumnType": "timestamptz",
120 "where": [
121 {
122 "name": "$__timeFilter",
123 "params": [],
124 "type": "macro"
125 }
126 ]
127 }
128 ],
129 "title": "Monitored primary DB-s ",
130 "type": "gauge"
131 },
132 {
133 "datasource": {
134 "type": "grafana-postgresql-datasource",
135 "uid": "pgwatch-metrics"
136 },
137 "description": "Please adjust the markers as needed! Also the default query assumes that all DBs are separate instances. If not so change the query to add some filters or groupings based on the wal.sys_id column for example or the configured_dbs.continuous_discovery_prefix if using the DB auto-discovery modes. The same applies also for the below \"top\" table panels.",
138 "fieldConfig": {
139 "defaults": {
140 "color": {
141 "mode": "thresholds"
142 },
143 "mappings": [],
144 "max": 10,
145 "min": 0,
146 "thresholds": {
147 "mode": "absolute",
148 "steps": [
149 {
150 "color": "dark-red",
151 "value": null
152 },
153 {
154 "color": "dark-orange",
155 "value": 9
156 },
157 {
158 "color": "dark-green",
159 "value": 10
160 }
161 ]
162 }
163 },
164 "overrides": []
165 },
166 "gridPos": {
167 "h": 7,
168 "w": 8,
169 "x": 8,
170 "y": 0
171 },
172 "id": 3,
173 "options": {
174 "minVizHeight": 75,
175 "minVizWidth": 75,
176 "orientation": "auto",
177 "reduceOptions": {
178 "calcs": [
179 "last"
180 ],
181 "fields": "",
182 "values": false
183 },
184 "showThresholdLabels": true,
185 "showThresholdMarkers": true,
186 "sizing": "auto"
187 },
188 "pluginVersion": "10.4.1",
189 "targets": [
190 {
191 "datasource": {
192 "type": "grafana-postgresql-datasource",
193 "uid": "pgwatch-metrics"
194 },
195 "format": "time_series",
196 "group": [
197 {
198 "params": [
199 "dbname"
200 ],
201 "type": "column"
202 }
203 ],
204 "metricColumn": "dbname",
205 "rawQuery": true,
206 "rawSql": "SELECT\n 0 AS \"time\",\n count(distinct dbname)\nFROM\n wal\nWHERE\n $__timeFilter(\"time\")\n AND (data->'in_recovery_int')::int = 1",
207 "refId": "A",
208 "select": [
209 [
210 {
211 "params": [
212 "value"
213 ],
214 "type": "column"
215 },
216 {
217 "params": [
218 "avg"
219 ],
220 "type": "aggregate"
221 },
222 {
223 "params": [
224 "value"
225 ],
226 "type": "alias"
227 }
228 ]
229 ],
230 "table": "db_stats",
231 "timeColumn": "\"time\"",
232 "timeColumnType": "timestamptz",
233 "where": [
234 {
235 "name": "$__timeFilter",
236 "params": [],
237 "type": "macro"
238 }
239 ]
240 }
241 ],
242 "title": "Monitored replica DB-s",
243 "type": "gauge"
244 },
245 {
246 "datasource": {
247 "type": "grafana-postgresql-datasource",
248 "uid": "pgwatch-metrics"
249 },
250 "description": "Configured to be monitored but no recent data",
251 "fieldConfig": {
252 "defaults": {
253 "color": {
254 "mode": "thresholds"
255 },
256 "custom": {
257 "align": "auto",
258 "cellOptions": {
259 "type": "auto"
260 },
261 "inspect": false
262 },
263 "mappings": [],
264 "thresholds": {
265 "mode": "absolute",
266 "steps": [
267 {
268 "color": "green",
269 "value": null
270 },
271 {
272 "color": "red",
273 "value": 80
274 }
275 ]
276 }
277 },
278 "overrides": [
279 {
280 "matcher": {
281 "id": "byName",
282 "options": "last_seen"
283 },
284 "properties": [
285 {
286 "id": "unit",
287 "value": "dtdurations"
288 },
289 {
290 "id": "custom.cellOptions",
291 "value": {
292 "type": "color-background"
293 }
294 },
295 {
296 "id": "custom.align"
297 },
298 {
299 "id": "thresholds",
300 "value": {
301 "mode": "absolute",
302 "steps": [
303 {
304 "color": "#FA6400",
305 "value": null
306 },
307 {
308 "color": "#E02F44",
309 "value": 600
310 },
311 {
312 "color": "#C4162A",
313 "value": 3600
314 }
315 ]
316 }
317 }
318 ]
319 },
320 {
321 "matcher": {
322 "id": "byName",
323 "options": "last_seen_uptime"
324 },
325 "properties": [
326 {
327 "id": "unit",
328 "value": "dtdurations"
329 },
330 {
331 "id": "custom.align"
332 }
333 ]
334 },
335 {
336 "matcher": {
337 "id": "byName",
338 "options": "dbname"
339 },
340 "properties": [
341 {
342 "id": "unit",
343 "value": "short"
344 },
345 {
346 "id": "decimals",
347 "value": 2
348 },
349 {
350 "id": "links",
351 "value": [
352 {
353 "targetBlank": true,
354 "title": "Go to Overview dash",
355 "url": "/d/db-overview?var-dbname=${__value.text}"
356 }
357 ]
358 },
359 {
360 "id": "custom.align"
361 }
362 ]
363 }
364 ]
365 },
366 "gridPos": {
367 "h": 7,
368 "w": 8,
369 "x": 16,
370 "y": 0
371 },
372 "id": 5,
373 "options": {
374 "cellHeight": "sm",
375 "footer": {
376 "countRows": false,
377 "fields": "",
378 "reducer": [
379 "sum"
380 ],
381 "show": false
382 },
383 "showHeader": true
384 },
385 "pluginVersion": "10.4.1",
386 "targets": [
387 {
388 "datasource": {
389 "type": "grafana-postgresql-datasource",
390 "uid": "pgwatch-metrics"
391 },
392 "format": "table",
393 "group": [],
394 "metricColumn": "none",
395 "rawQuery": true,
396 "rawSql": "SELECT\n dbname,\n (SELECT case when data->>'in_recovery_int' = '0' then 'primary' else 'replica' end from wal where time > now() - '15min'::interval and dbname = c.dbname order by time desc limit 1) as last_role,\n (SELECT (extract(epoch from now() - time))::int from db_stats where dbname = c.dbname order by time desc limit 1) as last_seen,\n (SELECT (data->'postmaster_uptime_s')::int from db_stats where dbname = c.dbname order by time desc limit 1) as last_seen_uptime\nFROM\n (select dbname, max(time) from configured_dbs where time between now() - '15min'::interval and now() group by dbname) c /* 10min ping interval hardcoded in collector */\nWHERE\n NOT EXISTS (\n select dbname from db_stats where $__timeFilter(\"time\") and dbname = c.dbname union \n select dbname from pgbouncer_stats where $__timeFilter(\"time\") and dbname = c.dbname \n)",
397 "refId": "A",
398 "select": [
399 [
400 {
401 "params": [
402 "value"
403 ],
404 "type": "column"
405 }
406 ]
407 ],
408 "timeColumn": "time",
409 "where": [
410 {
411 "name": "$__timeFilter",
412 "params": [],
413 "type": "macro"
414 }
415 ]
416 }
417 ],
418 "title": "Offline nodes",
419 "transformations": [
420 {
421 "id": "merge",
422 "options": {
423 "reducers": []
424 }
425 }
426 ],
427 "type": "table"
428 },
429 {
430 "datasource": {
431 "type": "grafana-postgresql-datasource",
432 "uid": "pgwatch-metrics"
433 },
434 "description": "Last $__interval average. 2 /5 % threshold defaults.",
435 "fieldConfig": {
436 "defaults": {
437 "color": {
438 "mode": "thresholds"
439 },
440 "custom": {
441 "align": "auto",
442 "cellOptions": {
443 "type": "auto"
444 },
445 "filterable": false,
446 "inspect": false
447 },
448 "mappings": [],
449 "thresholds": {
450 "mode": "absolute",
451 "steps": [
452 {
453 "color": "green",
454 "value": null
455 },
456 {
457 "color": "red",
458 "value": 80
459 }
460 ]
461 }
462 },
463 "overrides": [
464 {
465 "matcher": {
466 "id": "byName",
467 "options": "rollback_ratio"
468 },
469 "properties": [
470 {
471 "id": "unit",
472 "value": "none"
473 },
474 {
475 "id": "decimals",
476 "value": 1
477 },
478 {
479 "id": "custom.cellOptions",
480 "value": {
481 "type": "color-text"
482 }
483 },
484 {
485 "id": "custom.align"
486 },
487 {
488 "id": "thresholds",
489 "value": {
490 "mode": "absolute",
491 "steps": [
492 {
493 "color": "rgba(50, 172, 45, 0.97)",
494 "value": null
495 },
496 {
497 "color": "rgba(237, 129, 40, 0.89)",
498 "value": 2
499 },
500 {
501 "color": "rgba(245, 54, 54, 0.9)",
502 "value": 5
503 }
504 ]
505 }
506 }
507 ]
508 },
509 {
510 "matcher": {
511 "id": "byName",
512 "options": "dbname"
513 },
514 "properties": [
515 {
516 "id": "unit",
517 "value": "short"
518 },
519 {
520 "id": "decimals",
521 "value": 2
522 },
523 {
524 "id": "links",
525 "value": [
526 {
527 "targetBlank": true,
528 "title": "Go to 'Overview' dash",
529 "url": "/d/db-overview?var-dbname=${__value.text}"
530 }
531 ]
532 },
533 {
534 "id": "custom.align"
535 }
536 ]
537 }
538 ]
539 },
540 "gridPos": {
541 "h": 5,
542 "w": 8,
543 "x": 0,
544 "y": 7
545 },
546 "id": 7,
547 "options": {
548 "cellHeight": "sm",
549 "footer": {
550 "countRows": false,
551 "enablePagination": false,
552 "fields": "",
553 "reducer": [
554 "sum"
555 ],
556 "show": false
557 },
558 "showHeader": true
559 },
560 "pluginVersion": "10.4.1",
561 "targets": [
562 {
563 "datasource": {
564 "type": "grafana-postgresql-datasource",
565 "uid": "pgwatch-metrics"
566 },
567 "format": "table",
568 "group": [],
569 "metricColumn": "none",
570 "rawQuery": true,
571 "rawSql": "select * from (\nselect\n dbname,\n avg((roll-roll_lag)::numeric / ((roll-roll_lag) + (comm-comm_lag)))*100 as \"rollback_ratio\"\nfrom (\n select\n dbname,\n time,\n (data->>'xact_rollback')::int8 as roll, lag((data->>'xact_rollback')::int8) over w as roll_lag,\n (data->>'xact_commit')::int8 as comm, lag((data->>'xact_commit')::int8) over w as comm_lag\n FROM\n db_stats\n WHERE\n $__timeFilter(\"time\")\n window w as (partition by dbname order by time)\n) x\nWHERE comm > comm_lag or roll > roll_lag\nGROUP BY 1\n) y\nWHERE rollback_ratio > 0\nORDER BY 2 DESC\nLIMIT $top_limit\n",
572 "refId": "A",
573 "select": [
574 [
575 {
576 "params": [
577 "value"
578 ],
579 "type": "column"
580 }
581 ]
582 ],
583 "timeColumn": "time",
584 "where": [
585 {
586 "name": "$__timeFilter",
587 "params": [],
588 "type": "macro"
589 }
590 ]
591 }
592 ],
593 "title": "Top $top_limit by TX rollback %",
594 "transformations": [
595 {
596 "id": "merge",
597 "options": {
598 "reducers": []
599 }
600 }
601 ],
602 "type": "table"
603 },
604 {
605 "datasource": {
606 "type": "grafana-postgresql-datasource",
607 "uid": "pgwatch-metrics"
608 },
609 "description": "Includes \"idle in transaction\" TX. 5 / 10 min default thresholds",
610 "fieldConfig": {
611 "defaults": {
612 "color": {
613 "mode": "thresholds"
614 },
615 "custom": {
616 "align": "auto",
617 "cellOptions": {
618 "type": "auto"
619 },
620 "inspect": false
621 },
622 "mappings": [],
623 "thresholds": {
624 "mode": "absolute",
625 "steps": [
626 {
627 "color": "green",
628 "value": null
629 },
630 {
631 "color": "red",
632 "value": 80
633 }
634 ]
635 }
636 },
637 "overrides": [
638 {
639 "matcher": {
640 "id": "byName",
641 "options": "longest_tx_seconds"
642 },
643 "properties": [
644 {
645 "id": "unit",
646 "value": "dtdurations"
647 },
648 {
649 "id": "decimals",
650 "value": 1
651 },
652 {
653 "id": "custom.cellOptions",
654 "value": {
655 "type": "color-text"
656 }
657 },
658 {
659 "id": "custom.align"
660 },
661 {
662 "id": "thresholds",
663 "value": {
664 "mode": "absolute",
665 "steps": [
666 {
667 "color": "rgba(50, 172, 45, 0.97)",
668 "value": null
669 },
670 {
671 "color": "rgba(237, 129, 40, 0.89)",
672 "value": 300
673 },
674 {
675 "color": "rgba(245, 54, 54, 0.9)",
676 "value": 600
677 }
678 ]
679 }
680 }
681 ]
682 },
683 {
684 "matcher": {
685 "id": "byName",
686 "options": "dbname"
687 },
688 "properties": [
689 {
690 "id": "unit",
691 "value": "short"
692 },
693 {
694 "id": "decimals",
695 "value": 2
696 },
697 {
698 "id": "links",
699 "value": [
700 {
701 "targetBlank": true,
702 "title": "Go to 'Overview' dash",
703 "url": "/d/db-overview?var-dbname=${__value.text}"
704 }
705 ]
706 },
707 {
708 "id": "custom.align"
709 }
710 ]
711 }
712 ]
713 },
714 "gridPos": {
715 "h": 5,
716 "w": 8,
717 "x": 8,
718 "y": 7
719 },
720 "id": 10,
721 "options": {
722 "cellHeight": "sm",
723 "footer": {
724 "countRows": false,
725 "fields": "",
726 "reducer": [
727 "sum"
728 ],
729 "show": false
730 },
731 "showHeader": true
732 },
733 "pluginVersion": "10.4.1",
734 "targets": [
735 {
736 "datasource": {
737 "type": "grafana-postgresql-datasource",
738 "uid": "pgwatch-metrics"
739 },
740 "format": "table",
741 "group": [],
742 "metricColumn": "none",
743 "rawQuery": true,
744 "rawSql": "SELECT * FROM (\nSELECT\n dbname,\n max((data->'longest_tx_seconds')::int) AS longest_tx_seconds\nFROM\n backends\nWHERE\n $__timeFilter(\"time\")\nGROUP BY\n dbname\n) x\nWHERE longest_tx_seconds > 0\nORDER BY 2 DESC\nLIMIT $top_limit",
745 "refId": "A",
746 "select": [
747 [
748 {
749 "params": [
750 "value"
751 ],
752 "type": "column"
753 }
754 ]
755 ],
756 "timeColumn": "time",
757 "where": [
758 {
759 "name": "$__timeFilter",
760 "params": [],
761 "type": "macro"
762 }
763 ]
764 }
765 ],
766 "title": "Top $top_limit by longest TX time",
767 "transformations": [
768 {
769 "id": "merge",
770 "options": {
771 "reducers": []
772 }
773 }
774 ],
775 "type": "table"
776 },
777 {
778 "datasource": {
779 "type": "grafana-postgresql-datasource",
780 "uid": "pgwatch-metrics"
781 },
782 "description": "Assumes get_stat_activity() helper for non-privileged monitoring users",
783 "fieldConfig": {
784 "defaults": {
785 "color": {
786 "mode": "thresholds"
787 },
788 "custom": {
789 "align": "auto",
790 "cellOptions": {
791 "type": "auto"
792 },
793 "inspect": false
794 },
795 "mappings": [],
796 "thresholds": {
797 "mode": "absolute",
798 "steps": [
799 {
800 "color": "green",
801 "value": null
802 },
803 {
804 "color": "red",
805 "value": 80
806 }
807 ]
808 }
809 },
810 "overrides": [
811 {
812 "matcher": {
813 "id": "byName",
814 "options": "dbname"
815 },
816 "properties": [
817 {
818 "id": "unit",
819 "value": "short"
820 },
821 {
822 "id": "decimals",
823 "value": 2
824 },
825 {
826 "id": "links",
827 "value": [
828 {
829 "targetBlank": false,
830 "title": "Go to Overview dash",
831 "url": "/d/db-overview?var-dbname=${__value.text}"
832 }
833 ]
834 },
835 {
836 "id": "custom.align"
837 }
838 ]
839 },
840 {
841 "matcher": {
842 "id": "byName",
843 "options": "waiting"
844 },
845 "properties": [
846 {
847 "id": "unit",
848 "value": "short"
849 },
850 {
851 "id": "custom.cellOptions",
852 "value": {
853 "type": "color-text"
854 }
855 },
856 {
857 "id": "custom.align"
858 },
859 {
860 "id": "thresholds",
861 "value": {
862 "mode": "absolute",
863 "steps": [
864 {
865 "color": "rgba(50, 172, 45, 0.97)",
866 "value": null
867 },
868 {
869 "color": "rgba(237, 129, 40, 0.89)",
870 "value": 1
871 },
872 {
873 "color": "rgba(245, 54, 54, 0.9)",
874 "value": 5
875 }
876 ]
877 }
878 }
879 ]
880 }
881 ]
882 },
883 "gridPos": {
884 "h": 5,
885 "w": 8,
886 "x": 16,
887 "y": 7
888 },
889 "id": 6,
890 "options": {
891 "cellHeight": "sm",
892 "footer": {
893 "countRows": false,
894 "fields": "",
895 "reducer": [
896 "sum"
897 ],
898 "show": false
899 },
900 "showHeader": true
901 },
902 "pluginVersion": "10.4.1",
903 "targets": [
904 {
905 "datasource": {
906 "type": "grafana-postgresql-datasource",
907 "uid": "pgwatch-metrics"
908 },
909 "format": "table",
910 "group": [],
911 "metricColumn": "none",
912 "rawQuery": true,
913 "rawSql": "SELECT\n dbname,\n max((data->'waiting')::int) AS \"waiting\"\nFROM\n backends\nWHERE\n $__timeFilter(\"time\")\n AND (data->'waiting')::int > 0\nGROUP BY\n 1\nORDER BY\n 2 DESC NULLS LAST\nLIMIT\n $top_limit",
914 "refId": "A",
915 "select": [
916 [
917 {
918 "params": [
919 "value"
920 ],
921 "type": "column"
922 }
923 ]
924 ],
925 "timeColumn": "time",
926 "where": [
927 {
928 "name": "$__timeFilter",
929 "params": [],
930 "type": "macro"
931 }
932 ]
933 }
934 ],
935 "title": "Top $top_limit by blocked sessions",
936 "transformations": [
937 {
938 "id": "merge",
939 "options": {
940 "reducers": []
941 }
942 }
943 ],
944 "type": "table"
945 },
946 {
947 "datasource": {
948 "type": "grafana-postgresql-datasource",
949 "uid": "pgwatch-metrics"
950 },
951 "description": "Assumes get_stat_activity() helper for non-privileged monitoring users",
952 "fieldConfig": {
953 "defaults": {
954 "color": {
955 "mode": "thresholds"
956 },
957 "custom": {
958 "align": "auto",
959 "cellOptions": {
960 "type": "auto"
961 },
962 "inspect": false
963 },
964 "mappings": [],
965 "thresholds": {
966 "mode": "absolute",
967 "steps": [
968 {
969 "color": "green",
970 "value": null
971 },
972 {
973 "color": "red",
974 "value": 80
975 }
976 ]
977 }
978 },
979 "overrides": [
980 {
981 "matcher": {
982 "id": "byName",
983 "options": "dbname"
984 },
985 "properties": [
986 {
987 "id": "unit",
988 "value": "short"
989 },
990 {
991 "id": "decimals",
992 "value": 2
993 },
994 {
995 "id": "links",
996 "value": [
997 {
998 "targetBlank": false,
999 "title": "Go to Overview dash",
1000 "url": "/d/db-overview?var-dbname=${__value.text}"
1001 }
1002 ]
1003 },
1004 {
1005 "id": "custom.align"
1006 }
1007 ]
1008 },
1009 {
1010 "matcher": {
1011 "id": "byName",
1012 "options": "waiting"
1013 },
1014 "properties": [
1015 {
1016 "id": "unit",
1017 "value": "short"
1018 },
1019 {
1020 "id": "custom.cellOptions",
1021 "value": {
1022 "type": "color-text"
1023 }
1024 },
1025 {
1026 "id": "custom.align"
1027 },
1028 {
1029 "id": "thresholds",
1030 "value": {
1031 "mode": "absolute",
1032 "steps": [
1033 {
1034 "color": "rgba(50, 172, 45, 0.97)",
1035 "value": null
1036 },
1037 {
1038 "color": "rgba(237, 129, 40, 0.89)",
1039 "value": 1
1040 },
1041 {
1042 "color": "rgba(245, 54, 54, 0.9)",
1043 "value": 5
1044 }
1045 ]
1046 }
1047 }
1048 ]
1049 }
1050 ]
1051 },
1052 "gridPos": {
1053 "h": 5,
1054 "w": 8,
1055 "x": 0,
1056 "y": 12
1057 },
1058 "id": 14,
1059 "options": {
1060 "cellHeight": "sm",
1061 "footer": {
1062 "countRows": false,
1063 "fields": "",
1064 "reducer": [
1065 "sum"
1066 ],
1067 "show": false
1068 },
1069 "showHeader": true
1070 },
1071 "pluginVersion": "10.4.1",
1072 "targets": [
1073 {
1074 "datasource": {
1075 "type": "grafana-postgresql-datasource",
1076 "uid": "pgwatch-metrics"
1077 },
1078 "format": "table",
1079 "group": [],
1080 "metricColumn": "none",
1081 "rawQuery": true,
1082 "rawSql": "SELECT\n dbname,\n round(100 * instance_total::numeric / max_connections, 1) AS \"pct_used\",\n instance_total AS used_connections,\n max_connections\nFROM\n (\n select\n distinct on (dbname)\n dbname,\n (data->'max_connections')::int as max_connections,\n (data->'instance_total')::int as instance_total\n FROM\n backends\n WHERE\n $__timeFilter(time)\n order by dbname, time desc\n ) x\nORDER BY\n 2 DESC NULLS LAST\nLIMIT\n $top_limit",
1083 "refId": "A",
1084 "select": [
1085 [
1086 {
1087 "params": [
1088 "value"
1089 ],
1090 "type": "column"
1091 }
1092 ]
1093 ],
1094 "timeColumn": "time",
1095 "where": [
1096 {
1097 "name": "$__timeFilter",
1098 "params": [],
1099 "type": "macro"
1100 }
1101 ]
1102 }
1103 ],
1104 "title": "Top $top_limit by used connections",
1105 "transformations": [
1106 {
1107 "id": "merge",
1108 "options": {
1109 "reducers": []
1110 }
1111 }
1112 ],
1113 "type": "table"
1114 },
1115 {
1116 "datasource": {
1117 "type": "grafana-postgresql-datasource",
1118 "uid": "pgwatch-metrics"
1119 },
1120 "description": "100 MB / 1 GB default threshold",
1121 "fieldConfig": {
1122 "defaults": {
1123 "color": {
1124 "mode": "thresholds"
1125 },
1126 "custom": {
1127 "align": "auto",
1128 "cellOptions": {
1129 "type": "auto"
1130 },
1131 "inspect": false
1132 },
1133 "mappings": [],
1134 "thresholds": {
1135 "mode": "absolute",
1136 "steps": [
1137 {
1138 "color": "green",
1139 "value": null
1140 },
1141 {
1142 "color": "red",
1143 "value": 80
1144 }
1145 ]
1146 }
1147 },
1148 "overrides": [
1149 {
1150 "matcher": {
1151 "id": "byName",
1152 "options": "temp_bytes_per_minute"
1153 },
1154 "properties": [
1155 {
1156 "id": "unit",
1157 "value": "bytes"
1158 },
1159 {
1160 "id": "custom.cellOptions",
1161 "value": {
1162 "type": "color-text"
1163 }
1164 },
1165 {
1166 "id": "custom.align"
1167 },
1168 {
1169 "id": "thresholds",
1170 "value": {
1171 "mode": "absolute",
1172 "steps": [
1173 {
1174 "color": "rgba(50, 172, 45, 0.97)",
1175 "value": null
1176 },
1177 {
1178 "color": "rgba(237, 129, 40, 0.89)",
1179 "value": 100000000
1180 },
1181 {
1182 "color": "rgba(245, 54, 54, 0.9)",
1183 "value": 1000000000
1184 }
1185 ]
1186 }
1187 }
1188 ]
1189 },
1190 {
1191 "matcher": {
1192 "id": "byName",
1193 "options": "dbname"
1194 },
1195 "properties": [
1196 {
1197 "id": "displayName",
1198 "value": "Go to 'Overview' dash"
1199 },
1200 {
1201 "id": "unit",
1202 "value": "short"
1203 },
1204 {
1205 "id": "decimals",
1206 "value": 2
1207 },
1208 {
1209 "id": "links",
1210 "value": [
1211 {
1212 "targetBlank": true,
1213 "title": "Go to 'Overview' dash",
1214 "url": "/d/db-overview?var-dbname=${__value.text}"
1215 }
1216 ]
1217 },
1218 {
1219 "id": "custom.align"
1220 }
1221 ]
1222 }
1223 ]
1224 },
1225 "gridPos": {
1226 "h": 5,
1227 "w": 8,
1228 "x": 8,
1229 "y": 12
1230 },
1231 "id": 9,
1232 "options": {
1233 "cellHeight": "sm",
1234 "footer": {
1235 "countRows": false,
1236 "fields": "",
1237 "reducer": [
1238 "sum"
1239 ],
1240 "show": false
1241 },
1242 "showHeader": true
1243 },
1244 "pluginVersion": "10.4.1",
1245 "targets": [
1246 {
1247 "datasource": {
1248 "type": "grafana-postgresql-datasource",
1249 "uid": "pgwatch-metrics"
1250 },
1251 "format": "table",
1252 "group": [],
1253 "metricColumn": "none",
1254 "rawQuery": true,
1255 "rawSql": "select * from (\nselect\n dbname,\n avg((tb-tb_lag) / (etime - lag_etime))*60 as \"temp_bytes_per_minute\"\nfrom (\n select\n dbname,\n (data->>'temp_bytes')::int8 as tb, lag((data->>'temp_bytes')::int8) over w as tb_lag,\n (extract(epoch from time))::int8 as etime,\n (lag(extract(epoch from time)) over w)::int8 as lag_etime\n from db_stats\n where $__timeFilter(time)\n window w as (partition by dbname order by time)\n) x\nwhere\n tb >= tb_lag and etime > lag_etime\ngroup by\n dbname\n) y\nwhere temp_bytes_per_minute > 0\norder by 2 desc\nlimit $top_limit",
1256 "refId": "A",
1257 "select": [
1258 [
1259 {
1260 "params": [
1261 "value"
1262 ],
1263 "type": "column"
1264 }
1265 ]
1266 ],
1267 "timeColumn": "time",
1268 "where": [
1269 {
1270 "name": "$__timeFilter",
1271 "params": [],
1272 "type": "macro"
1273 }
1274 ]
1275 }
1276 ],
1277 "title": "Top $top_limit by temp. files",
1278 "transformations": [
1279 {
1280 "id": "merge",
1281 "options": {
1282 "reducers": []
1283 }
1284 }
1285 ],
1286 "type": "table"
1287 },
1288 {
1289 "datasource": {
1290 "type": "grafana-postgresql-datasource",
1291 "uid": "pgwatch-metrics"
1292 },
1293 "description": "1 / 16 MB default thresholds",
1294 "fieldConfig": {
1295 "defaults": {
1296 "color": {
1297 "mode": "thresholds"
1298 },
1299 "custom": {
1300 "align": "auto",
1301 "cellOptions": {
1302 "type": "auto"
1303 },
1304 "inspect": false
1305 },
1306 "mappings": [],
1307 "thresholds": {
1308 "mode": "absolute",
1309 "steps": [
1310 {
1311 "color": "green",
1312 "value": null
1313 },
1314 {
1315 "color": "red",
1316 "value": 80
1317 }
1318 ]
1319 }
1320 },
1321 "overrides": [
1322 {
1323 "matcher": {
1324 "id": "byName",
1325 "options": "replay_lag_b"
1326 },
1327 "properties": [
1328 {
1329 "id": "unit",
1330 "value": "bytes"
1331 },
1332 {
1333 "id": "custom.cellOptions",
1334 "value": {
1335 "type": "color-text"
1336 }
1337 },
1338 {
1339 "id": "custom.align"
1340 },
1341 {
1342 "id": "thresholds",
1343 "value": {
1344 "mode": "absolute",
1345 "steps": [
1346 {
1347 "color": "rgba(50, 172, 45, 0.97)",
1348 "value": null
1349 },
1350 {
1351 "color": "rgba(237, 129, 40, 0.89)",
1352 "value": 1000000
1353 },
1354 {
1355 "color": "rgba(245, 54, 54, 0.9)",
1356 "value": 16000000
1357 }
1358 ]
1359 }
1360 }
1361 ]
1362 },
1363 {
1364 "matcher": {
1365 "id": "byName",
1366 "options": "dbname"
1367 },
1368 "properties": [
1369 {
1370 "id": "unit",
1371 "value": "short"
1372 },
1373 {
1374 "id": "decimals",
1375 "value": 2
1376 },
1377 {
1378 "id": "links",
1379 "value": [
1380 {
1381 "targetBlank": true,
1382 "title": "Go to 'Replication' dash",
1383 "url": "/d/replication?var-dbname=${__value.text}"
1384 }
1385 ]
1386 },
1387 {
1388 "id": "custom.align"
1389 }
1390 ]
1391 }
1392 ]
1393 },
1394 "gridPos": {
1395 "h": 5,
1396 "w": 8,
1397 "x": 16,
1398 "y": 12
1399 },
1400 "id": 8,
1401 "options": {
1402 "cellHeight": "sm",
1403 "footer": {
1404 "countRows": false,
1405 "fields": "",
1406 "reducer": [
1407 "sum"
1408 ],
1409 "show": false
1410 },
1411 "showHeader": true
1412 },
1413 "pluginVersion": "10.4.1",
1414 "targets": [
1415 {
1416 "datasource": {
1417 "type": "grafana-postgresql-datasource",
1418 "uid": "pgwatch-metrics"
1419 },
1420 "format": "table",
1421 "group": [],
1422 "metricColumn": "none",
1423 "rawQuery": true,
1424 "rawSql": "select * from (\nselect \n dbname,\n max((data->'replay_lag_b')::int8) as replay_lag_b\nfrom\n replication\nwhere\n (data->'replay_lag_b')::int8 > 0\ngroup by\n dbname\n) x\norder by 2 desc\nlimit $top_limit",
1425 "refId": "A",
1426 "select": [
1427 [
1428 {
1429 "params": [
1430 "value"
1431 ],
1432 "type": "column"
1433 }
1434 ]
1435 ],
1436 "timeColumn": "time",
1437 "where": [
1438 {
1439 "name": "$__timeFilter",
1440 "params": [],
1441 "type": "macro"
1442 }
1443 ]
1444 }
1445 ],
1446 "title": "Top $top_limit by replication lag",
1447 "transformations": [
1448 {
1449 "id": "merge",
1450 "options": {
1451 "reducers": []
1452 }
1453 }
1454 ],
1455 "type": "table"
1456 },
1457 {
1458 "datasource": {
1459 "type": "grafana-postgresql-datasource",
1460 "uid": "pgwatch-metrics"
1461 },
1462 "description": "Assumes \"psutil_disk\" helper. 10 / 5% default warning thresholds",
1463 "fieldConfig": {
1464 "defaults": {
1465 "color": {
1466 "mode": "thresholds"
1467 },
1468 "custom": {
1469 "align": "auto",
1470 "cellOptions": {
1471 "type": "auto"
1472 },
1473 "inspect": false
1474 },
1475 "mappings": [],
1476 "thresholds": {
1477 "mode": "absolute",
1478 "steps": [
1479 {
1480 "color": "green",
1481 "value": null
1482 },
1483 {
1484 "color": "red",
1485 "value": 80
1486 }
1487 ]
1488 }
1489 },
1490 "overrides": [
1491 {
1492 "matcher": {
1493 "id": "byName",
1494 "options": "used_percent"
1495 },
1496 "properties": [
1497 {
1498 "id": "unit",
1499 "value": "short"
1500 },
1501 {
1502 "id": "decimals",
1503 "value": 1
1504 },
1505 {
1506 "id": "custom.cellOptions",
1507 "value": {
1508 "type": "color-text"
1509 }
1510 },
1511 {
1512 "id": "custom.align"
1513 },
1514 {
1515 "id": "thresholds",
1516 "value": {
1517 "mode": "absolute",
1518 "steps": [
1519 {
1520 "color": "rgba(50, 172, 45, 0.97)",
1521 "value": null
1522 },
1523 {
1524 "color": "rgba(237, 129, 40, 0.89)",
1525 "value": 80
1526 },
1527 {
1528 "color": "rgba(245, 54, 54, 0.9)",
1529 "value": 90
1530 }
1531 ]
1532 }
1533 }
1534 ]
1535 },
1536 {
1537 "matcher": {
1538 "id": "byName",
1539 "options": "dbname"
1540 },
1541 "properties": [
1542 {
1543 "id": "unit",
1544 "value": "short"
1545 },
1546 {
1547 "id": "decimals",
1548 "value": 2
1549 },
1550 {
1551 "id": "links",
1552 "value": [
1553 {
1554 "targetBlank": true,
1555 "title": "Go to 'System Stats' dash",
1556 "url": "/d/system-stats?var-dbname=${__value.text}"
1557 }
1558 ]
1559 },
1560 {
1561 "id": "custom.align"
1562 }
1563 ]
1564 }
1565 ]
1566 },
1567 "gridPos": {
1568 "h": 5,
1569 "w": 8,
1570 "x": 0,
1571 "y": 17
1572 },
1573 "id": 11,
1574 "options": {
1575 "cellHeight": "sm",
1576 "footer": {
1577 "countRows": false,
1578 "fields": "",
1579 "reducer": [
1580 "sum"
1581 ],
1582 "show": false
1583 },
1584 "showHeader": true
1585 },
1586 "pluginVersion": "10.4.1",
1587 "targets": [
1588 {
1589 "datasource": {
1590 "type": "grafana-postgresql-datasource",
1591 "uid": "pgwatch-metrics"
1592 },
1593 "format": "table",
1594 "group": [],
1595 "metricColumn": "none",
1596 "rawQuery": true,
1597 "rawSql": "select * from (\nselect \n dbname,\n max((data->'percent')::float) as used_percent\nfrom\n psutil_disk\nwhere\n $__timeFilter(\"time\")\n and (data->'percent')::float > 0\ngroup by\n dbname\n) x\norder by 2 desc nulls last\nlimit $top_limit",
1598 "refId": "A",
1599 "select": [
1600 [
1601 {
1602 "params": [
1603 "value"
1604 ],
1605 "type": "column"
1606 }
1607 ]
1608 ],
1609 "timeColumn": "time",
1610 "where": [
1611 {
1612 "name": "$__timeFilter",
1613 "params": [],
1614 "type": "macro"
1615 }
1616 ]
1617 }
1618 ],
1619 "title": "Lowest $top_limit by free disk %",
1620 "transformations": [
1621 {
1622 "id": "merge",
1623 "options": {
1624 "reducers": []
1625 }
1626 }
1627 ],
1628 "type": "table"
1629 },
1630 {
1631 "datasource": {
1632 "type": "grafana-postgresql-datasource",
1633 "uid": "pgwatch-metrics"
1634 },
1635 "description": "Assumes \"psutil_cpu\" helpers are installed and configured",
1636 "fieldConfig": {
1637 "defaults": {
1638 "color": {
1639 "mode": "thresholds"
1640 },
1641 "custom": {
1642 "align": "auto",
1643 "cellOptions": {
1644 "type": "auto"
1645 },
1646 "inspect": false
1647 },
1648 "mappings": [],
1649 "thresholds": {
1650 "mode": "absolute",
1651 "steps": [
1652 {
1653 "color": "green",
1654 "value": null
1655 },
1656 {
1657 "color": "red",
1658 "value": 80
1659 }
1660 ]
1661 }
1662 },
1663 "overrides": [
1664 {
1665 "matcher": {
1666 "id": "byName",
1667 "options": "dbname"
1668 },
1669 "properties": [
1670 {
1671 "id": "unit",
1672 "value": "short"
1673 },
1674 {
1675 "id": "decimals",
1676 "value": 2
1677 },
1678 {
1679 "id": "links",
1680 "value": [
1681 {
1682 "targetBlank": false,
1683 "title": "Go to Overview dash",
1684 "url": "/d/db-overview?var-dbname=${__value.text}"
1685 }
1686 ]
1687 },
1688 {
1689 "id": "custom.align"
1690 }
1691 ]
1692 },
1693 {
1694 "matcher": {
1695 "id": "byName",
1696 "options": "cpu_utilization"
1697 },
1698 "properties": [
1699 {
1700 "id": "unit",
1701 "value": "percent"
1702 },
1703 {
1704 "id": "decimals",
1705 "value": 1
1706 },
1707 {
1708 "id": "custom.cellOptions",
1709 "value": {
1710 "type": "color-text"
1711 }
1712 },
1713 {
1714 "id": "custom.align"
1715 },
1716 {
1717 "id": "thresholds",
1718 "value": {
1719 "mode": "absolute",
1720 "steps": [
1721 {
1722 "color": "rgba(50, 172, 45, 0.97)",
1723 "value": null
1724 },
1725 {
1726 "color": "rgba(237, 129, 40, 0.89)",
1727 "value": 30
1728 },
1729 {
1730 "color": "rgba(245, 54, 54, 0.9)",
1731 "value": 60
1732 }
1733 ]
1734 }
1735 }
1736 ]
1737 }
1738 ]
1739 },
1740 "gridPos": {
1741 "h": 5,
1742 "w": 8,
1743 "x": 8,
1744 "y": 17
1745 },
1746 "id": 15,
1747 "options": {
1748 "cellHeight": "sm",
1749 "footer": {
1750 "countRows": false,
1751 "fields": "",
1752 "reducer": [
1753 "sum"
1754 ],
1755 "show": false
1756 },
1757 "showHeader": true
1758 },
1759 "pluginVersion": "10.4.1",
1760 "targets": [
1761 {
1762 "datasource": {
1763 "type": "grafana-postgresql-datasource",
1764 "uid": "pgwatch-metrics"
1765 },
1766 "format": "table",
1767 "group": [],
1768 "metricColumn": "none",
1769 "rawQuery": true,
1770 "rawSql": "SELECT\n dbname,\n round(max((data->'cpu_utilization')::numeric), 1) AS \"cpu_utilization\"\nFROM\n psutil_cpu\nWHERE\n $__timeFilter(\"time\")\nGROUP BY\n 1\nORDER BY\n 2 DESC NULLS LAST\nLIMIT\n $top_limit",
1771 "refId": "A",
1772 "select": [
1773 [
1774 {
1775 "params": [
1776 "value"
1777 ],
1778 "type": "column"
1779 }
1780 ]
1781 ],
1782 "timeColumn": "time",
1783 "where": [
1784 {
1785 "name": "$__timeFilter",
1786 "params": [],
1787 "type": "macro"
1788 }
1789 ]
1790 }
1791 ],
1792 "title": "Top $top_limit by CPU utilization %",
1793 "transformations": [
1794 {
1795 "id": "merge",
1796 "options": {
1797 "reducers": []
1798 }
1799 }
1800 ],
1801 "type": "table"
1802 },
1803 {
1804 "datasource": {
1805 "type": "grafana-postgresql-datasource",
1806 "uid": "pgwatch-metrics"
1807 },
1808 "description": "Needs \"get_wal_size\" helper for unprivileged monitoring users",
1809 "fieldConfig": {
1810 "defaults": {
1811 "color": {
1812 "mode": "thresholds"
1813 },
1814 "custom": {
1815 "align": "auto",
1816 "cellOptions": {
1817 "type": "auto"
1818 },
1819 "inspect": false
1820 },
1821 "mappings": [],
1822 "thresholds": {
1823 "mode": "absolute",
1824 "steps": [
1825 {
1826 "color": "green",
1827 "value": null
1828 },
1829 {
1830 "color": "red",
1831 "value": 80
1832 }
1833 ]
1834 }
1835 },
1836 "overrides": [
1837 {
1838 "matcher": {
1839 "id": "byName",
1840 "options": "dbname"
1841 },
1842 "properties": [
1843 {
1844 "id": "unit",
1845 "value": "short"
1846 },
1847 {
1848 "id": "decimals",
1849 "value": 2
1850 },
1851 {
1852 "id": "links",
1853 "value": [
1854 {
1855 "targetBlank": false,
1856 "title": "Go to Overview dash",
1857 "url": "/d/db-overview?var-dbname=${__value.text}"
1858 }
1859 ]
1860 },
1861 {
1862 "id": "custom.align"
1863 }
1864 ]
1865 },
1866 {
1867 "matcher": {
1868 "id": "byName",
1869 "options": "wal_size"
1870 },
1871 "properties": [
1872 {
1873 "id": "unit",
1874 "value": "bytes"
1875 },
1876 {
1877 "id": "decimals",
1878 "value": 1
1879 },
1880 {
1881 "id": "custom.align"
1882 }
1883 ]
1884 }
1885 ]
1886 },
1887 "gridPos": {
1888 "h": 5,
1889 "w": 8,
1890 "x": 16,
1891 "y": 17
1892 },
1893 "id": 16,
1894 "options": {
1895 "cellHeight": "sm",
1896 "footer": {
1897 "countRows": false,
1898 "fields": "",
1899 "reducer": [
1900 "sum"
1901 ],
1902 "show": false
1903 },
1904 "showHeader": true
1905 },
1906 "pluginVersion": "10.4.1",
1907 "targets": [
1908 {
1909 "datasource": {
1910 "type": "grafana-postgresql-datasource",
1911 "uid": "pgwatch-metrics"
1912 },
1913 "format": "table",
1914 "group": [],
1915 "metricColumn": "none",
1916 "rawQuery": true,
1917 "rawSql": "SELECT\n dbname,\n max((data->'wal_size_b')::int8) as wal_size\nFROM\n wal_size\nWHERE\n $__timeFilter(\"time\")\nGROUP BY\n 1\nORDER BY\n 2 DESC NULLS LAST\nLIMIT\n $top_limit",
1918 "refId": "A",
1919 "select": [
1920 [
1921 {
1922 "params": [
1923 "value"
1924 ],
1925 "type": "column"
1926 }
1927 ]
1928 ],
1929 "timeColumn": "time",
1930 "where": [
1931 {
1932 "name": "$__timeFilter",
1933 "params": [],
1934 "type": "macro"
1935 }
1936 ]
1937 }
1938 ],
1939 "title": "Top $top_limit by WAL folder size",
1940 "transformations": [
1941 {
1942 "id": "merge",
1943 "options": {
1944 "reducers": []
1945 }
1946 }
1947 ],
1948 "type": "table"
1949 },
1950 {
1951 "datasource": {
1952 "type": "grafana-postgresql-datasource",
1953 "uid": "pgwatch-metrics"
1954 },
1955 "gridPos": {
1956 "h": 8,
1957 "w": 24,
1958 "x": 0,
1959 "y": 22
1960 },
1961 "id": 13,
1962 "options": {
1963 "code": {
1964 "language": "plaintext",
1965 "showLineNumbers": false,
1966 "showMiniMap": false
1967 },
1968 "content": "<h2>Brought to you by</h2><div style=\"padding: 25px;\"><a href=\"https://www.cybertec-postgresql.com/en/\"><img src=\"https://www.cybertec-postgresql.com/wp-content/uploads/2025/02/cybertec-logo-white-blue.svg\" alt=\"Cybertec – The PostgreSQL Database Company\"></a></div>",
1969 "mode": "html"
1970 },
1971 "pluginVersion": "10.4.1",
1972 "targets": [
1973 {
1974 "datasource": {
1975 "type": "grafana-postgresql-datasource",
1976 "uid": "pgwatch-metrics"
1977 },
1978 "refId": "A"
1979 }
1980 ],
1981 "transparent": true,
1982 "type": "text"
1983 }
1984 ],
1985 "refresh": "1m",
1986 "schemaVersion": 39,
1987 "tags": [
1988 "pgwatch"
1989 ],
1990 "templating": {
1991 "list": [
1992 {
1993 "current": {
1994 "selected": false,
1995 "text": "3",
1996 "value": "3"
1997 },
1998 "hide": 0,
1999 "includeAll": false,
2000 "multi": false,
2001 "name": "top_limit",
2002 "options": [
2003 {
2004 "selected": false,
2005 "text": "1",
2006 "value": "1"
2007 },
2008 {
2009 "selected": true,
2010 "text": "3",
2011 "value": "3"
2012 },
2013 {
2014 "selected": false,
2015 "text": "5",
2016 "value": "5"
2017 },
2018 {
2019 "selected": false,
2020 "text": "10",
2021 "value": "10"
2022 }
2023 ],
2024 "query": "1,3,5,10",
2025 "skipUrlSync": false,
2026 "type": "custom"
2027 }
2028 ]
2029 },
2030 "time": {
2031 "from": "now-5m",
2032 "to": "now"
2033 },
2034 "timepicker": {
2035 "refresh_intervals": [
2036 "5s",
2037 "10s",
2038 "30s",
2039 "1m",
2040 "5m",
2041 "15m",
2042 "30m",
2043 "1h",
2044 "2h",
2045 "1d"
2046 ]
2047 },
2048 "timezone": "",
2049 "title": "Global Health",
2050 "uid": "global-health",
2051 "version": 1,
2052 "weekStart": ""
2053}