From b06dd84f6b11b51f2c8f0c3a439fc963c8c692e8 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Wed, 17 Jul 2024 19:38:37 +0800 Subject: [PATCH] Create centos.sh --- plugins/zabbix/versions/7.0/centos.sh | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 plugins/zabbix/versions/7.0/centos.sh diff --git a/plugins/zabbix/versions/7.0/centos.sh b/plugins/zabbix/versions/7.0/centos.sh new file mode 100644 index 000000000..901d07a51 --- /dev/null +++ b/plugins/zabbix/versions/7.0/centos.sh @@ -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