Skip to content

Commit f8404a0

Browse files
committed
Merge branch 'dev'
2 parents fb529b1 + 89e5c82 commit f8404a0

File tree

9 files changed

+87
-27
lines changed

9 files changed

+87
-27
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
pg_version: ['10', '11', '12', '13', '14']
3030

3131
steps:
32-
- name: Checkout Mamonsu repo
32+
- name: Checkout mamonsu repo
3333
uses: actions/checkout@v1
3434

3535
- name: Install docker-compose
@@ -67,7 +67,7 @@ jobs:
6767
- name: Install prequisites
6868
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/tests.sh --os="${{ matrix.docker_os }}" --pg-version="${{ matrix.pg_version }}"
6969

70-
- name: Build and install Mamonsu
70+
- name: Build and install mamonsu
7171
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/mamonsu_build.sh --os="${{ matrix.docker_os }}" --pg-version="${{ matrix.pg_version }}"
7272

7373
- name: Test MAMONSU BOOTSTRAP
@@ -85,5 +85,8 @@ jobs:
8585
- name: Test MAMONSU ZABBIX CLI
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

88-
- name: Test Mamonsu metrics on master
88+
- name: Test mamonsu metrics on master
8989
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 }}"
90+
91+
- name: Test Mamonsu removal
92+
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/mamonsu_removal.sh --os="${{ matrix.docker_os }}"

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
pg_version: '9.6'
3434

3535
steps:
36-
- name: Checkout Mamonsu repo
36+
- name: Checkout mamonsu repo
3737
uses: actions/checkout@v1
3838

3939
- name: Install docker-compose
@@ -71,7 +71,7 @@ jobs:
7171
- name: Install prequisites
7272
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/tests.sh --os="${{ matrix.docker_os }}" --pg-version="${{ matrix.pg_version }}"
7373

74-
- name: Build and install Mamonsu
74+
- name: Build and install mamonsu
7575
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/mamonsu_build.sh --os="${{ matrix.docker_os }}" --pg-version="${{ matrix.pg_version }}"
7676

7777
- name: Test MAMONSU BOOTSTRAP
@@ -89,5 +89,8 @@ jobs:
8989
- name: Test MAMONSU ZABBIX CLI
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

92-
- name: Test Mamonsu metrics on master
92+
- name: Test mamonsu metrics on master
9393
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 }}"
94+
95+
- name: Test Mamonsu removal
96+
run: docker exec $( echo "${{ matrix.docker_os }}" | sed 's/://' | sed 's/\.//' ) bash /mamonsu/github-actions-tests/mamonsu_removal.sh --os="${{ matrix.docker_os }}"

github-actions-tests/mamonsu_build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ done
2323

2424
echo && echo
2525
echo "================================================================================================================="
26-
echo "---> Install Mamonsu latest"
26+
echo "---> Install mamonsu latest"
2727
echo && echo
2828

2929
# clean install mamonsu
@@ -45,7 +45,7 @@ if [ "${OS%:*}" = "centos" ]; then
4545
systemctl daemon-reload
4646
systemctl restart mamonsu
4747
sleep 5
48-
echo && echo && echo "Mamonsu version:"
48+
echo && echo && echo "mamonsu version:"
4949
mamonsu --version
5050
echo && echo
5151

@@ -67,7 +67,7 @@ elif [ "${OS%:*}" = "ubuntu" ]; then
6767
cat /mamonsu/github-actions-tests/sources/agent_3.4.0.conf > /etc/mamonsu/agent.conf
6868
service mamonsu restart
6969
sleep 5
70-
echo && echo && echo "Mamonsu version:"
70+
echo && echo && echo "mamonsu version:"
7171
mamonsu --version
7272
echo && echo
7373

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
# default parameters:
4+
OS="centos:7"
5+
6+
for i in "$@"
7+
do
8+
case $i in
9+
--os=*)
10+
OS="${i#*=}"
11+
shift
12+
;;
13+
*)
14+
# unknown option
15+
;;
16+
esac
17+
done
18+
19+
echo && echo
20+
echo "================================================================================================================="
21+
echo "---> Remove mamonsu"
22+
echo && echo
23+
24+
if [ "${OS%:*}" = "centos" ]; then
25+
sudo yum erase mamonsu -y
26+
echo "---> mamonsu directories and files after removal:"
27+
sudo find / -name "mamonsu" 2>/dev/null
28+
elif [ "${OS%:*}" = "ubuntu" ]; then
29+
sudo apt-get purge mamonsu -y
30+
echo "---> mamonsu directories and files after removal:"
31+
sudo find / -name "mamonsu" 2>/dev/null
32+
fi

mamonsu/plugins/system/linux/memory.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,37 @@ def graphs(self, template, dashboard=False):
8484
all_items = []
8585
free_used_items = []
8686
for item in self.Items:
87-
all_items.append({
88-
"key": self.right_type(self.key, item[0]),
89-
"color": item[3]
90-
})
91-
if item[0] in ["cached", "available", "used", "total"]:
92-
free_used_items.append({
87+
if item[0] != "total":
88+
all_items.append({
9389
"key": self.right_type(self.key, item[0]),
94-
"color": item[3],
95-
"drawtype": item[4]
90+
"color": item[3]
9691
})
92+
# manually build Free/Used graph items to manage the order of graph filled regions
93+
# used - User-Space
94+
free_used_items.append({
95+
"key": self.right_type(self.key, self.Items[13][0]),
96+
"color": self.Items[13][3],
97+
"drawtype": self.Items[13][4]
98+
})
99+
# cached
100+
free_used_items.append({
101+
"key": self.right_type(self.key, self.Items[3][0]),
102+
"color": self.Items[3][3],
103+
"drawtype": self.Items[3][4]
104+
})
105+
# available
106+
free_used_items.append({
107+
"key": self.right_type(self.key, self.Items[1][0]),
108+
"color": self.Items[1][3],
109+
"drawtype": self.Items[1][4]
110+
})
111+
# total
112+
free_used_items.append({
113+
"key": self.right_type(self.key, self.Items[11][0]),
114+
"color": self.Items[11][3],
115+
"drawtype": self.Items[11][4]
116+
})
117+
97118
graphs = [
98119
{
99120
"name": self.graph_name_detailed,
@@ -104,7 +125,7 @@ def graphs(self, template, dashboard=False):
104125
{
105126
"name": self.graph_name_free_used,
106127
"height": 400,
107-
"type": 1,
128+
"type": 0,
108129
"items": free_used_items
109130
}
110131
]

packaging/debian/init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ COMMAND="/usr/bin/$NAME -d -a /etc/mamonsu/plugins -c $CONFIG -p $PIDFILE"
2727
RUNAS=mamonsu
2828

2929
[ ! -d $PIDDIR ] && mkdir -p $PIDDIR
30-
chown $RUNAS $PIDDIR
30+
chown -R $RUNAS $PIDDIR
3131

3232
start() {
3333
if [ -f $PIDFILE ] && kill -0 $(cat $PIDFILE); then

packaging/debian/postinst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ if [ "$1" = "configure" ]; then
1414
fi
1515

1616
mkdir -p /var/run/mamonsu
17-
chown mamonsu:mamonsu /var/run/mamonsu
1817

1918
mkdir -p /etc/mamonsu/plugins
2019
touch /etc/mamonsu/plugins/__init__.py
21-
[ -f /etc/mamonsu/agent.conf ] || cp /usr/share/mamonsu/example_linux.conf /etc/mamonsu/agent.conf && chown mamonsu:mamonsu /etc/mamonsu/agent.conf
20+
[ -f /etc/mamonsu/agent.conf ] || cp /usr/share/mamonsu/example_linux.conf /etc/mamonsu/agent.conf
2221

23-
chown mamonsu:mamonsu /var/log/mamonsu
24-
chown mamonsu:mamonsu /var/lib/mamonsu
22+
chown -R mamonsu:mamonsu /var/run/mamonsu
23+
chown -R mamonsu:mamonsu /var/log/mamonsu
24+
chown -R mamonsu:mamonsu /var/lib/mamonsu
25+
chown -R mamonsu:mamonsu /etc/mamonsu
2526

2627
fi
2728

packaging/rpm/SOURCES/mamonsu.init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ COMMAND="/usr/bin/$NAME -d -a /etc/mamonsu/plugins -c $CONFIG -p $PIDFILE"
2727
RUNAS=mamonsu
2828

2929
[ ! -d $PIDDIR ] && mkdir -p $PIDDIR
30-
chown $RUNAS $PIDDIR
30+
chown -R $RUNAS $PIDDIR
3131

3232
start() {
3333
if [ -f $PIDFILE ] && kill -0 $(cat $PIDFILE); then

packaging/rpm/SPECS/mamonsu.spec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,20 @@ getent passwd mamonsu > /dev/null || \
5757
-c "mamonsu monitoring user" mamonsu
5858

5959
mkdir -p /var/run/mamonsu
60-
chown mamonsu.mamonsu /var/run/mamonsu
60+
chown -R mamonsu.mamonsu /var/run/mamonsu
6161

6262
mkdir -p /etc/mamonsu/plugins
6363
touch /etc/mamonsu/plugins/__init__.py
6464

6565
mkdir -p /var/log/mamonsu
66-
chown mamonsu.mamonsu /var/log/mamonsu
66+
chown -R mamonsu.mamonsu /var/log/mamonsu
6767

6868
%preun
6969
/sbin/service mamonsu stop >/dev/null 2>&1
7070
/sbin/chkconfig --del mamonsu
7171

7272
%post
73-
chown mamonsu.mamonsu /etc/mamonsu/agent.conf
73+
chown -R mamonsu.mamonsu /etc/mamonsu
7474

7575
%changelog
7676
* Mon Feb 21 2022 Alexandra Kuznetsova <[email protected]> - 3.4.0-1

0 commit comments

Comments
 (0)