Skip to content
This repository was archived by the owner on Jul 6, 2021. It is now read-only.

Commit 6f37089

Browse files
authored
Merge pull request #142 from postgres-ai/108-dmius-f003
#108 F003 check with template
2 parents 881ed12 + 0537f49 commit 6f37089

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

pghrep/templates/F003.tpl

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Autovacuum info #
2+
3+
## Current values ##
4+
5+
### Master DB server is `{{.hosts.master}}` ###
6+
Setting name | Value | Unit
7+
-------------|-------|------
8+
{{ range $key, $value := (index (index (index .results .hosts.master) "data") "settings") }}{{$key}}|{{ $value.setting}}|{{ $value.unit }}
9+
{{ end }}
10+
{{ if (index (index .results .hosts.master) "data").iotop }}
11+
#### iotop information ####
12+
Command: `{{ (index (index (index .results .hosts.master) "data") "iotop").cmd }}`
13+
14+
Result:
15+
```
16+
{{ (index (index (index .results .hosts.master) "data") "iotop").data }}
17+
```
18+
{{ end }}
19+
20+
{{ if gt (len .hosts.replicas) 0 }}
21+
### Slave DB servers: ###
22+
{{ range $skey, $host := .hosts.replicas }}
23+
#### DB slave server: `{{ $host }}` ####
24+
{{ if (index $.results $host) }}
25+
26+
Setting name | Value | Unit
27+
-------------|-------|------
28+
{{ range $key, $value := (index (index (index $.results $host) "data") "settings") }}{{$key}}|{{ $value.setting}}|{{ $value.unit }}
29+
{{ end }}
30+
{{ if (index (index $.results $host) "data").iotop }}
31+
#### iotop information ####
32+
Command: `{{ (index (index (index $.results $host) "data") "iotop").cmd }}`
33+
34+
Result:
35+
```
36+
{{ (index (index (index $.results $host) "data") "iotop").data }}
37+
```
38+
{{ end }}
39+
{{ else}}
40+
No data
41+
{{ end }}
42+
{{ end }}
43+
{{ end }}
44+
45+
{{/* ## Conclusions ##
46+
47+
{{.Conclusion}}
48+
49+
## Recommendations ##
50+
51+
{{.Recommended}}
52+
*/}}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
settings_sql="select json_object_agg(s.name, s) from pg_settings s where name like 'autovacuum%';"
2+
settings=$(${CHECK_HOST_CMD} "${_PSQL} -f - " <<SQL
3+
$settings_sql
4+
SQL
5+
)
6+
#iotop_cmd="sudo iotop -o -d 5 -n 12 -k -b"
7+
#iotop_result=$($iotop_cmd)
8+
#iotop_data="{\"cmd\": \"$iotop_cmd\", \"data\": \"$iotop_result\"}"
9+
#data="{\"settings\": $settings, \"iotop\": $iotop_data}"
10+
data="{\"settings\": $settings}"
11+
data=$(jq -n "$data")
12+
echo "$data"
13+

0 commit comments

Comments
 (0)