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

#108 F003 check with template #142

Merged
merged 2 commits into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions pghrep/templates/F003.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Autovacuum info #

## Current values ##

### Master DB server is `{{.hosts.master}}` ###
Setting name | Value | Unit
-------------|-------|------
{{ range $key, $value := (index (index (index .results .hosts.master) "data") "settings") }}{{$key}}|{{ $value.setting}}|{{ $value.unit }}
{{ end }}
{{ if (index (index .results .hosts.master) "data").iotop }}
#### iotop information ####
Command: `{{ (index (index (index .results .hosts.master) "data") "iotop").cmd }}`

Result:
```
{{ (index (index (index .results .hosts.master) "data") "iotop").data }}
```
{{ end }}

{{ if gt (len .hosts.replicas) 0 }}
### Slave DB servers: ###
{{ range $skey, $host := .hosts.replicas }}
#### DB slave server: `{{ $host }}` ####
{{ if (index $.results $host) }}

Setting name | Value | Unit
-------------|-------|------
{{ range $key, $value := (index (index (index $.results $host) "data") "settings") }}{{$key}}|{{ $value.setting}}|{{ $value.unit }}
{{ end }}
{{ if (index (index $.results $host) "data").iotop }}
#### iotop information ####
Command: `{{ (index (index (index $.results $host) "data") "iotop").cmd }}`

Result:
```
{{ (index (index (index $.results $host) "data") "iotop").data }}
```
{{ end }}
{{ else}}
No data
{{ end }}
{{ end }}
{{ end }}

{{/* ## Conclusions ##

{{.Conclusion}}

## Recommendations ##

{{.Recommended}}
*/}}
13 changes: 13 additions & 0 deletions resources/checks/F003_autovacuum_tuning.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
settings_sql="select json_object_agg(s.name, s) from pg_settings s where name like 'autovacuum%';"
settings=$(${CHECK_HOST_CMD} "${_PSQL} -f - " <<SQL
$settings_sql
SQL
)
#iotop_cmd="sudo iotop -o -d 5 -n 12 -k -b"
#iotop_result=$($iotop_cmd)
#iotop_data="{\"cmd\": \"$iotop_cmd\", \"data\": \"$iotop_result\"}"
#data="{\"settings\": $settings, \"iotop\": $iotop_data}"
data="{\"settings\": $settings}"
data=$(jq -n "$data")
echo "$data"