Skip to content

Commit b4f0fcb

Browse files
MickLesktremor021
andauthored
Zabbix: various bugfixes agent1/agent2 (#8294)
* Zabbix: various bugfixes agent1/agent2 * Update zabbix.sh --------- Co-authored-by: Slaviša Arežina <[email protected]>
1 parent b39672f commit b4f0fcb

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

ct/zabbix.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ function update_script() {
4242
fi
4343

4444
msg_info "Stopping Services"
45-
systemctl stop zabbix-server $AGENT_SERVICE
45+
$STD systemctl stop zabbix-server
46+
if systemctl list-unit-files | grep -q zabbix-agent2; then
47+
$STD systemctl stop zabbix-agent2
48+
else
49+
$STD systemctl stop zabbix-agent
50+
fi
4651
msg_ok "Stopped Services"
4752

4853
msg_info "Updating Zabbix"
@@ -83,14 +88,22 @@ function update_script() {
8388
msg_ok "Updated Zabbix"
8489

8590
msg_info "Starting Services"
86-
systemctl start zabbix-server $AGENT_SERVICE
91+
$STD systemctl start zabbix-server
92+
if systemctl list-unit-files | grep -q zabbix-agent2; then
93+
$STD systemctl start zabbix-agent2
94+
else
95+
$STD systemctl start zabbix-agent
96+
fi
8797
systemctl restart apache2
8898
msg_ok "Started Services"
8999

90100
msg_info "Cleaning Up"
91101
rm -rf /tmp/zabbix-release_latest+debian13_all.deb
102+
$STD apt -y autoremove
103+
$STD apt -y autoclean
104+
$STD apt -y clean
92105
msg_ok "Cleaned"
93-
msg_ok "Updated Successfully"
106+
msg_ok "Updated Successfully!"
94107
exit
95108
}
96109

install/zabbix-install.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,14 @@ fi
102102
msg_ok "Configured Fping"
103103

104104
msg_info "Starting Services"
105-
systemctl restart zabbix-server zabbix-agent2 apache2
106-
systemctl enable -q --now zabbix-server zabbix-agent2 apache2
105+
if [ "$AGENT_PKG" = "zabbix-agent2" ]; then
106+
AGENT_SERVICE="zabbix-agent2"
107+
else
108+
AGENT_SERVICE="zabbix-agent"
109+
fi
110+
111+
systemctl restart zabbix-server
112+
systemctl enable -q --now zabbix-server $AGENT_SERVICE apache2
107113
msg_ok "Started Services"
108114

109115
motd_ssh

0 commit comments

Comments
 (0)