Simple Linux Panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mdserver-web/plugins/zabbix/versions/7.0/debian.sh

58 lines
1.5 KiB

10 months ago
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
10 months ago
sysArch=`arch`
10 months ago
debian_suffix=
10 months ago
if [ "$sysArch" == "aarch64" ];then
10 months ago
debian_suffix="-arm64"
fi
10 months ago
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
10 months ago
# 检查是否通
# zabbix_get -s 127.0.0.1 -k agent.ping
10 months ago
Install_App()
{
10 months ago
mkdir -p $serverPath/source/zabbix
10 months ago
10 months ago
ZABBIX_NAME=zabbix-release_7.0-2+debian${SYS_VERSION_ID}_all.deb
10 months ago
echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/debian${debian_suffix}/pool/main/z/zabbix-release/${ZABBIX_NAME}"
10 months ago
if [ ! -f $serverPath/source/zabbix/${ZABBIX_NAME} ];then
10 months ago
wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/debian${debian_suffix}/pool/main/z/zabbix-release/${ZABBIX_NAME}
10 months ago
fi
10 months ago
10 months ago
# apt-get -f install
# dpkg --configure -a
10 months ago
10 months ago
cd $serverPath/source/zabbix && dpkg -i ${ZABBIX_NAME}
10 months ago
apt update -y
10 months ago
10 months ago
apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-sql-scripts zabbix-get
apt install -y zabbix-agent
10 months ago
}
Uninstall_App()
{
10 months ago
apt remove -y zabbix-server-mysql zabbix-frontend-php zabbix-sql-scripts zabbix-get
apt remove -y zabbix-agent
10 months ago
rm -rf /etc/zabbix
10 months ago
# dpkg --configure -a
10 months ago
echo "卸载成功"
10 months ago
}
action=${1}
if [ "${1}" == 'install' ];then
Install_App
else
Uninstall_App
fi