Updated
This commit is contained in:
parent
ab448fe067
commit
2db14c7fc5
57
apps/zabbix/zabbix.sh
Executable file
57
apps/zabbix/zabbix.sh
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#### Variables
|
||||||
|
APT_UPDATE="apt -y update"
|
||||||
|
APT_INST="apt -y install"
|
||||||
|
APT_PURGE="apt -y purge"
|
||||||
|
APT_REMOVE="apt -y autoremove"
|
||||||
|
|
||||||
|
PKG_INSTALL="zabbix-agent2"
|
||||||
|
|
||||||
|
#### Functions
|
||||||
|
check_root() {
|
||||||
|
if [ "$EUID" -ne 0 ]; then
|
||||||
|
echo "Must be root to run $0"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
choice() {
|
||||||
|
echo -ne "[y/n]"
|
||||||
|
while true; do
|
||||||
|
read -rN1 input
|
||||||
|
case $input in
|
||||||
|
[yY][eE][sS] | [yY])
|
||||||
|
return 0
|
||||||
|
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
[nN][oO] | [nN])
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
#### Main
|
||||||
|
|
||||||
|
check_root
|
||||||
|
|
||||||
|
echo -e "\nUpdate apt"
|
||||||
|
echo "$APT_UPDATE"
|
||||||
|
$APT_UPDATE
|
||||||
|
|
||||||
|
echo -ne "\nYou want to install Zabbix 6.4 ($PKG_INSTALL)? "
|
||||||
|
|
||||||
|
if choice 2>/dev/null; then
|
||||||
|
echo -ne "\nAdd repository for Zabbix 6.4\n"
|
||||||
|
$APT_INST apt-transport-https wget
|
||||||
|
sudo install -d -m 0755 /etc/apt/keyrings
|
||||||
|
wget -q https://repo.zabbix.com/zabbix-official-repo.key -O- | tee /etc/apt/keyrings/zabbix-official-repo.asc > /dev/null
|
||||||
|
echo "deb [signed-by=/etc/apt/keyrings/zabbix-official-repo.asc] https://repo.zabbix.com/zabbix/6.4/debian bookworm main" | sudo tee -a /etc/apt/sources.list.d/zabbix.list > /dev/null
|
||||||
|
$APT_UPDATE
|
||||||
|
echo -ne "\n$APT_INST $PKG_INSTALL\n"
|
||||||
|
$APT_INST $PKG_INSTALL
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -ne "\n\n"
|
Loading…
x
Reference in New Issue
Block a user