Skip to content

Commit d7bd074

Browse files
committed
cicd:
- added missed lists of metrics depending on PG version; - added metrics preparation scriprs;
1 parent 3213862 commit d7bd074

File tree

7 files changed

+291
-4
lines changed

7 files changed

+291
-4
lines changed

.github/workflows/mamonsu-tests-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ jobs:
8686
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/tools/zabbix_cli.sh --zbx-address="${{ steps.zabbix_address.outputs.zabbix_address }}" --zbx-version="${{ matrix.zabbix_version }}"
8787

8888
- name: Test Mamonsu metrics on master
89-
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/metrics.sh --pg-version="${{ matrix.pg_version }}"
89+
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/metrics.sh --pg-version="${{ matrix.pg_version }}" --os="${{ matrix.docker_os }}"

.github/workflows/mamonsu-tests-master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ jobs:
9090
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/tools/zabbix_cli.sh --zbx-address="${{ steps.zabbix_address.outputs.zabbix_address }}" --zbx-version="${{ matrix.zabbix_version }}"
9191

9292
- name: Test Mamonsu metrics on master
93-
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/metrics.sh --pg-version="${{ matrix.pg_version }}"
93+
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/metrics.sh --pg-version="${{ matrix.pg_version }}" --os="${{ matrix.docker_os }}"

github-actions-tests/metrics.sh

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ PG_VERSION="14"
88
for i in "$@"
99
do
1010
case $i in
11+
--os=*)
12+
OS="${i#*=}"
13+
shift
14+
;;
1115
--pg-version=*)
1216
PG_VERSION="${i#*=}"
1317
shift
@@ -18,17 +22,46 @@ case $i in
1822
esac
1923
done
2024

25+
METRICS_FILE = "/mamonsu/github-actions-tests/sources/metrics-linux-${PG_VERSION}.txt"
26+
2127
echo && echo
2228
echo "================================================================================================================="
2329
echo "---> Test MAMONSU metrics"
2430
echo
2531

32+
# ======================================================================================================================
33+
# some PG preparations
34+
35+
PG_PATH=""
36+
if [ "${OS%:*}" = "centos" ]; then
37+
PACKAGE="postgresql${PG_VERSION//./}-server postgresql${PG_VERSION//./}-contrib"
38+
PG_PATH="/usr/pgsql-${PG_VERSION}/bin/"
39+
elif [ "${OS%:*}" = "ubuntu" ]; then
40+
PACKAGE="postgresql-${PG_VERSION} postgresql-contrib-${PG_VERSION}"
41+
PG_PATH="/usr/lib/postgresql/${PG_VERSION}/bin/"
42+
fi
43+
44+
# archive_mode preps
45+
sudo -u postgres ${PG_PATH}psql -c "DO
46+
\$do\$
47+
DECLARE
48+
func_name varchar;
49+
BEGIN
50+
SELECT proname INTO func_name FROM pg_proc WHERE proname LIKE 'pg_switch_%';
51+
EXECUTE FORMAT('SELECT %s();', func_name);
52+
END
53+
\$do\$;"
54+
55+
# wait for Cache Hit Ratio metric
56+
sleep 120
57+
58+
# read metric for specific version
2659
while read metric; do
2760
GREP=$( mamonsu agent metric-get ${metric} | grep "pgsql\|sys\|mamonsu" )
2861
if [ -z "$GREP" ]; then
2962
echo "---> ERROR: Cannot found metric $metric"
3063
# exit 11
3164
fi
32-
done </mamonsu/github-actions-tests/sources/metrics-linux-${PG_VERSION}.txt
65+
done <${METRICS_FILE}
3366

3467
echo && echo

github-actions-tests/pg_install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ sudo chmod 700 /pg${PG_VERSION}/data_slave_physical
6767

6868
# create master-slave cluster
6969
sudo -u postgres ${PG_PATH}initdb -D /pg${PG_VERSION}/data_master/
70+
sudo -u postgres echo "shared_preload_libraries='pg_stat_statements'" >> /pg${PG_VERSION}/data_master/postgresql.conf
7071
sudo -u postgres echo "archive_mode=on" >> /pg${PG_VERSION}/data_master/postgresql.conf
7172
sudo -u postgres echo "archive_command='cp %p /pg"${PG_VERSION}"/wals/%f'" >> /pg${PG_VERSION}/data_master/postgresql.conf
7273
sudo -u postgres echo "wal_level=replica" >> /pg${PG_VERSION}/data_master/postgresql.conf
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
mamonsu.memory.rss[max]
2+
mamonsu.plugin.errors[]
3+
mamonsu.plugin.keepalive[]
4+
pgsql.archive_command[archived_files]
5+
pgsql.archive_command[count_files_to_archive]
6+
pgsql.archive_command[failed_trying_to_archive]
7+
pgsql.archive_command[size_files_to_archive]
8+
pgsql.autovacumm.count[]
9+
pgsql.bgwriter[buffers_alloc]
10+
pgsql.bgwriter[buffers_backend]
11+
pgsql.bgwriter[buffers_backend_fsync]
12+
pgsql.bgwriter[buffers_checkpoint]
13+
pgsql.bgwriter[buffers_clean]
14+
pgsql.bgwriter[maxwritten_clean]
15+
pgsql.blocks[hit]
16+
pgsql.blocks[read]
17+
pgsql.buffers[dirty]
18+
pgsql.buffers[size]
19+
pgsql.buffers[twice_used]
20+
pgsql.cache[hit]
21+
pgsql.checkpoint[checkpoint_sync_time]
22+
pgsql.checkpoint[count_timed]
23+
pgsql.checkpoint[count_wal]
24+
pgsql.checkpoint[write_time]
25+
pgsql.connections[active]
26+
pgsql.connections[disabled]
27+
pgsql.connections[fastpath_function_call]
28+
pgsql.connections[idle]
29+
pgsql.connections[idle_in_transaction]
30+
pgsql.connections[idle_in_transaction_aborted]
31+
pgsql.connections[max_connections]
32+
pgsql.connections[other]
33+
pgsql.connections[total]
34+
pgsql.connections[waiting]
35+
pgsql.database.discovery[]
36+
pgsql.database.bloating_tables[mamonsu_test_db]
37+
pgsql.database.bloating_tables[postgres]
38+
pgsql.database.invalid_indexes[mamonsu_test_db]
39+
pgsql.database.invalid_indexes[postgres]
40+
pgsql.database.max_age[mamonsu_test_db]
41+
pgsql.database.max_age[postgres]
42+
pgsql.database.size[mamonsu_test_db]
43+
pgsql.database.size[postgres]
44+
pgsql.events[conflicts]
45+
pgsql.events[deadlocks]
46+
pgsql.events[xact_rollback]
47+
pgsql.memory_leak_diagnostic.count_diff[]
48+
pgsql.memory_leak_diagnostic.msg_text[]
49+
pgsql.oldest[transaction_time]
50+
pgsql.oldest[xid_age]
51+
pgsql.ping[]
52+
pgsql.pg_locks[accessexclusive]
53+
pgsql.pg_locks[accessshare]
54+
pgsql.pg_locks[exclusive]
55+
pgsql.pg_locks[rowexclusive]
56+
pgsql.pg_locks[rowshare]
57+
pgsql.pg_locks[share]
58+
pgsql.pg_locks[sharerowexclusive]
59+
pgsql.pg_locks[shareupdateexclusive]
60+
pgsql.prepared.count
61+
pgsql.prepared.oldest
62+
pgsql.relation.size[]
63+
pgsql.relation.size[mamonsu_test_db.mamonsu.config]
64+
pgsql.relation.size[postgres.pg_catalog.pg_class]
65+
pgsql.replication.non_active_slots[]
66+
pgsql.replication_lag[sec]
67+
pgsql.replication_lag[sec]
68+
pgsql.stat[dirty_bytes]
69+
pgsql.stat[other_time]
70+
pgsql.stat[read_bytes]
71+
pgsql.stat[read_time]
72+
pgsql.stat[wal_bytes]
73+
pgsql.stat[wal_fpi]
74+
pgsql.stat[wal_records]
75+
pgsql.stat[write_bytes]
76+
pgsql.stat[write_time]
77+
pgsql.stat_info[dealloc]
78+
pgsql.stat_info[stats_reset]
79+
pgsql.temp[bytes]
80+
pgsql.temp[files]
81+
pgsql.transactions[committed]
82+
pgsql.tuples[deleted]
83+
pgsql.tuples[fetched]
84+
pgsql.tuples[inserted]
85+
pgsql.tuples[returned]
86+
pgsql.tuples[updated]
87+
pgsql.uptime[]
88+
pgsql.wal.count[]
89+
pgsql.wal.write[]
90+
system.cpu[idle]
91+
system.cpu[iowait]
92+
system.cpu[irq]
93+
system.cpu[nice]
94+
system.cpu[softirq]
95+
system.cpu[system]
96+
system.cpu[user]
97+
system.disk.discovery[]
98+
system.disk.all_read[]
99+
system.disk.all_write[]
100+
system.disk.all_read_b[]
101+
system.disk.all_write_b[]
102+
system.la[1]
103+
system.memory[active]
104+
system.memory[apps]
105+
system.memory[available]
106+
system.memory[buffers]
107+
system.memory[cached]
108+
system.memory[committed]
109+
system.memory[inactive]
110+
system.memory[mapped]
111+
system.memory[page_tables]
112+
system.memory[slab]
113+
system.memory[swap]
114+
system.memory[swap_cache]
115+
system.memory[vmalloc_used]
116+
system.memory[unused]
117+
system.net.discovery[]
118+
system.open_files[]
119+
system.processes[blocked]
120+
system.processes[forkrate]
121+
system.processes[running]
122+
system.vfs.discovery[]
123+
system.vfs.free[/]
124+
system.vfs.percent_free[/]
125+
system.vfs.percent_inode_free[/]
126+
system.vfs.used[/]
127+
system.up_time[]
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
mamonsu.memory.rss[max]
2+
mamonsu.plugin.errors[]
3+
mamonsu.plugin.keepalive[]
4+
pgsql.archive_command[archived_files]
5+
pgsql.archive_command[count_files_to_archive]
6+
pgsql.archive_command[failed_trying_to_archive]
7+
pgsql.archive_command[size_files_to_archive]
8+
pgsql.autovacumm.count[]
9+
pgsql.bgwriter[buffers_alloc]
10+
pgsql.bgwriter[buffers_backend]
11+
pgsql.bgwriter[buffers_backend_fsync]
12+
pgsql.bgwriter[buffers_checkpoint]
13+
pgsql.bgwriter[buffers_clean]
14+
pgsql.bgwriter[maxwritten_clean]
15+
pgsql.blocks[hit]
16+
pgsql.blocks[read]
17+
pgsql.buffers[dirty]
18+
pgsql.buffers[size]
19+
pgsql.buffers[twice_used]
20+
pgsql.cache[hit]
21+
pgsql.checkpoint[checkpoint_sync_time]
22+
pgsql.checkpoint[count_timed]
23+
pgsql.checkpoint[count_wal]
24+
pgsql.checkpoint[write_time]
25+
pgsql.connections[active]
26+
pgsql.connections[disabled]
27+
pgsql.connections[fastpath_function_call]
28+
pgsql.connections[idle]
29+
pgsql.connections[idle_in_transaction]
30+
pgsql.connections[idle_in_transaction_aborted]
31+
pgsql.connections[max_connections]
32+
pgsql.connections[other]
33+
pgsql.connections[total]
34+
pgsql.connections[waiting]
35+
pgsql.database.discovery[]
36+
pgsql.database.bloating_tables[mamonsu_test_db]
37+
pgsql.database.bloating_tables[postgres]
38+
pgsql.database.invalid_indexes[mamonsu_test_db]
39+
pgsql.database.invalid_indexes[postgres]
40+
pgsql.database.max_age[mamonsu_test_db]
41+
pgsql.database.max_age[postgres]
42+
pgsql.database.size[mamonsu_test_db]
43+
pgsql.database.size[postgres]
44+
pgsql.events[conflicts]
45+
pgsql.events[deadlocks]
46+
pgsql.events[xact_rollback]
47+
pgsql.memory_leak_diagnostic.count_diff[]
48+
pgsql.memory_leak_diagnostic.msg_text[]
49+
pgsql.oldest[transaction_time]
50+
pgsql.oldest[xid_age]
51+
pgsql.ping[]
52+
pgsql.pg_locks[accessexclusive]
53+
pgsql.pg_locks[accessshare]
54+
pgsql.pg_locks[exclusive]
55+
pgsql.pg_locks[rowexclusive]
56+
pgsql.pg_locks[rowshare]
57+
pgsql.pg_locks[share]
58+
pgsql.pg_locks[sharerowexclusive]
59+
pgsql.pg_locks[shareupdateexclusive]
60+
pgsql.prepared.count
61+
pgsql.prepared.oldest
62+
pgsql.relation.size[]
63+
pgsql.relation.size[mamonsu_test_db.mamonsu.config]
64+
pgsql.relation.size[postgres.pg_catalog.pg_class]
65+
pgsql.replication.non_active_slots[]
66+
pgsql.replication_lag[sec]
67+
pgsql.replication_lag[sec]
68+
pgsql.stat[dirty_bytes]
69+
pgsql.stat[other_time]
70+
pgsql.stat[read_bytes]
71+
pgsql.stat[read_time]
72+
pgsql.stat[wal_bytes]
73+
pgsql.stat[wal_fpi]
74+
pgsql.stat[wal_records]
75+
pgsql.stat[write_bytes]
76+
pgsql.stat[write_time]
77+
pgsql.stat_info[dealloc]
78+
pgsql.stat_info[stats_reset]
79+
pgsql.temp[bytes]
80+
pgsql.temp[files]
81+
pgsql.transactions[committed]
82+
pgsql.tuples[deleted]
83+
pgsql.tuples[fetched]
84+
pgsql.tuples[inserted]
85+
pgsql.tuples[returned]
86+
pgsql.tuples[updated]
87+
pgsql.uptime[]
88+
pgsql.wal.count[]
89+
pgsql.wal.write[]
90+
system.cpu[idle]
91+
system.cpu[iowait]
92+
system.cpu[irq]
93+
system.cpu[nice]
94+
system.cpu[softirq]
95+
system.cpu[system]
96+
system.cpu[user]
97+
system.disk.discovery[]
98+
system.disk.all_read[]
99+
system.disk.all_write[]
100+
system.disk.all_read_b[]
101+
system.disk.all_write_b[]
102+
system.la[1]
103+
system.memory[active]
104+
system.memory[apps]
105+
system.memory[available]
106+
system.memory[buffers]
107+
system.memory[cached]
108+
system.memory[committed]
109+
system.memory[inactive]
110+
system.memory[mapped]
111+
system.memory[page_tables]
112+
system.memory[slab]
113+
system.memory[swap]
114+
system.memory[swap_cache]
115+
system.memory[vmalloc_used]
116+
system.memory[unused]
117+
system.net.discovery[]
118+
system.open_files[]
119+
system.processes[blocked]
120+
system.processes[forkrate]
121+
system.processes[running]
122+
system.vfs.discovery[]
123+
system.vfs.free[/]
124+
system.vfs.percent_free[/]
125+
system.vfs.percent_inode_free[/]
126+
system.vfs.used[/]
127+
system.up_time[]

github-actions-tests/sources/metrics-linux-9.6.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pgsql.connections[idle]
2929
pgsql.connections[idle_in_transaction]
3030
pgsql.connections[idle_in_transaction_aborted]
3131
pgsql.connections[max_connections]
32-
pgsql.connections[other]
3332
pgsql.connections[total]
3433
pgsql.connections[waiting]
3534
pgsql.database.discovery[]

0 commit comments

Comments
 (0)