From f9caafcb86d78c1614d828f2814b3eee6909a235 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 20 Jul 2024 12:09:40 +0800 Subject: [PATCH] update --- plugins/zabbix/versions/6.0/opensuse.sh | 46 +++++++++++++++++++++ plugins/zabbix/versions/6.0/ubuntu.sh | 53 +++++++++++++++++++++++++ plugins/zabbix/versions/7.0/alma.sh | 2 +- plugins/zabbix/versions/7.0/centos.sh | 2 +- plugins/zabbix/versions/7.0/rocky.sh | 2 +- 5 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 plugins/zabbix/versions/6.0/opensuse.sh create mode 100644 plugins/zabbix/versions/6.0/ubuntu.sh diff --git a/plugins/zabbix/versions/6.0/opensuse.sh b/plugins/zabbix/versions/6.0/opensuse.sh new file mode 100644 index 000000000..748fc705d --- /dev/null +++ b/plugins/zabbix/versions/6.0/opensuse.sh @@ -0,0 +1,46 @@ +#!/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() +{ + yum install -y glibc-langpack-zh + + mkdir -p $serverPath/source/zabbix + + ZABBIX_NAME=zabbix-release-6.0-4.sles${SYS_VERSION_ID:0:2}.noarch.rpm + + rpm -Uvh https://repo.zabbix.com/zabbix/6.0/sles/${SYS_VERSION_ID:0:2}/x86_64/${ZABBIX_NAME} + echo "rpm -Uvh https://repo.zabbix.com/zabbix/6.0/sles/${SYS_VERSION_ID:0:2}/x86_64/${ZABBIX_NAME}" + + # cd $serverPath/source/zabbix && rpm -Uvh ${ZABBIX_NAME} + zypper install -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy + zypper install -y zabbix-agent +} + +Uninstall_App() +{ + zypper remove -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy + zypper remove -y zabbix-agent + rm -rf /etc/zabbix + echo "卸载成功" +} + +action=${1} +if [ "${1}" == 'install' ];then + Install_App +else + Uninstall_App +fi diff --git a/plugins/zabbix/versions/6.0/ubuntu.sh b/plugins/zabbix/versions/6.0/ubuntu.sh new file mode 100644 index 000000000..16458b4b7 --- /dev/null +++ b/plugins/zabbix/versions/6.0/ubuntu.sh @@ -0,0 +1,53 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH +export DEBIAN_FRONTEND=noninteractive + +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-2+ubuntu${SYS_VERSION_ID}_all.deb + echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/${ZABBIX_NAME}" + if [ ! -f $serverPath/source/zabbix/${ZABBIX_NAME} ];then + wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/${ZABBIX_NAME} + fi + + # apt-get -f install + # dpkg --configure -a + + cd $serverPath/source/zabbix && dpkg -i ${ZABBIX_NAME} + apt update -y + + apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-sql-scripts zabbix-get + apt install -y zabbix-agent +} + +Uninstall_App() +{ + apt remove -y zabbix-server-mysql zabbix-frontend-php zabbix-sql-scripts zabbix-get + apt remove -y zabbix-agent + rm -rf /etc/zabbix + + # dpkg --configure -a + echo "卸载成功" +} + +action=${1} +if [ "${1}" == 'install' ];then + Install_App +else + Uninstall_App +fi diff --git a/plugins/zabbix/versions/7.0/alma.sh b/plugins/zabbix/versions/7.0/alma.sh index d7a71113a..dd1cc523c 100644 --- a/plugins/zabbix/versions/7.0/alma.sh +++ b/plugins/zabbix/versions/7.0/alma.sh @@ -24,7 +24,7 @@ Install_App() rpm -Uvh https://repo.zabbix.com/zabbix/7.0/alma/${SYS_VERSION_ID:0:1}/x86_64/${ZABBIX_NAME} - cd $serverPath/source/zabbix && rpm -Uvh ${ZABBIX_NAME} + # cd $serverPath/source/zabbix && rpm -Uvh ${ZABBIX_NAME} dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy dnf install -y zabbix-agent } diff --git a/plugins/zabbix/versions/7.0/centos.sh b/plugins/zabbix/versions/7.0/centos.sh index 612e8ccfb..db9c4a3b0 100644 --- a/plugins/zabbix/versions/7.0/centos.sh +++ b/plugins/zabbix/versions/7.0/centos.sh @@ -24,7 +24,7 @@ Install_App() rpm -Uvh https://repo.zabbix.com/zabbix/7.0/centos/${SYS_VERSION_ID}/x86_64/${ZABBIX_NAME} - cd $serverPath/source/zabbix && rpm -Uvh ${ZABBIX_NAME} + # cd $serverPath/source/zabbix && rpm -Uvh ${ZABBIX_NAME} dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy zabbix-agent # dnf module switch-to zabbix-web-1:7.0.4 diff --git a/plugins/zabbix/versions/7.0/rocky.sh b/plugins/zabbix/versions/7.0/rocky.sh index a48eba2b6..8bc6c05a9 100644 --- a/plugins/zabbix/versions/7.0/rocky.sh +++ b/plugins/zabbix/versions/7.0/rocky.sh @@ -24,7 +24,7 @@ Install_App() rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rocky/${SYS_VERSION_ID:0:1}/x86_64/${ZABBIX_NAME} - cd $serverPath/source/zabbix && rpm -Uvh ${ZABBIX_NAME} + # cd $serverPath/source/zabbix && rpm -Uvh ${ZABBIX_NAME} dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy dnf install -y zabbix-agent }