mirror of https://github.com/midoks/mdserver-web
parent
bf77d84227
commit
b06dd84f6b
@ -0,0 +1,45 @@ |
|||||||
|
#!/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` |
||||||
|
install_tmp=${rootPath}/tmp/mw_install.pl |
||||||
|
|
||||||
|
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` |
||||||
|
|
||||||
|
# 检查是否通 |
||||||
|
# zabbix_get -s 127.0.0.1 -k agent.ping |
||||||
|
Install_App() |
||||||
|
{ |
||||||
|
mkdir -p $serverPath/source/zabbix |
||||||
|
|
||||||
|
ZABBIX_NAME=zabbix-release-7.0-4.el${SYS_VERSION_ID}.noarch.rpm |
||||||
|
|
||||||
|
rpm -Uvh https://repo.zabbix.com/zabbix/7.0/centos/${SYS_VERSION_ID}/x86_64/zabbix-release-7.0-4.el9.noarch.rpm |
||||||
|
echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/centos/${SYS_VERSION_ID}/x86_64/${ZABBIX_NAME}" |
||||||
|
if [ ! -f $serverPath/source/zabbix/${ZABBIX_NAME} ];then |
||||||
|
wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/centos/${SYS_VERSION_ID}/x86_64/${ZABBIX_NAME} |
||||||
|
fi |
||||||
|
|
||||||
|
cd $serverPath/source/zabbix && rpm -Uvh ${ZABBIX_NAME} |
||||||
|
dnf install zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy zabbix-agent zabbix-get |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_App() |
||||||
|
{ |
||||||
|
dnf remove -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy zabbix-agent zabbix-get |
||||||
|
rm -rf /etc/zabbix |
||||||
|
echo "卸载成功" |
||||||
|
} |
||||||
|
|
||||||
|
action=${1} |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_App |
||||||
|
else |
||||||
|
Uninstall_App |
||||||
|
fi |
Loading…
Reference in new issue