diff --git a/class/core/site_api.py b/class/core/site_api.py index ca3983da26..d26cd34e6d 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -2533,7 +2533,9 @@ def setSecurity(self, sid, name, fix, domains, status, none=''): def getPhpVersion(self): phpVersions = ('00', '52', '53', '54', '55', - '56', '70', '71', '72', '73', '74', '80', '81', '82', '83') + '56', '70', '71', '72', '73', + '74', '80', '81', '82', '83', + '84') data = [] for val in phpVersions: tmp = {} @@ -2667,10 +2669,8 @@ def add(self, webname, port, ps, path, version): return mw.returnJson(False, '不要以网站根目录创建站点!') siteMenu = json.loads(webname) - self.siteName = self.toPunycode( - siteMenu['domain'].strip().split(':')[0]).strip() - self.sitePath = self.toPunycodePath( - self.getPath(path.replace(' ', ''))) + self.siteName = self.toPunycode(siteMenu['domain'].strip().split(':')[0]).strip() + self.sitePath = self.toPunycodePath(self.getPath(path.replace(' ', ''))) self.sitePort = port.strip().replace(' ', '') self.phpVersion = version diff --git a/plugins/clean/index.py b/plugins/clean/index.py index 465107933b..54e8ed9e30 100755 --- a/plugins/clean/index.py +++ b/plugins/clean/index.py @@ -125,6 +125,7 @@ def initConf(): "/var/log/secure", "/var/log/lastlog", "/var/log/cron", + "/www/wwwlogs", "/www/server/rsyncd", "/www/server/sphinx/index", "/www/server/mongodb/logs", diff --git a/plugins/mysql-yum/index.py b/plugins/mysql-yum/index.py index 63640f949d..16646fe528 100755 --- a/plugins/mysql-yum/index.py +++ b/plugins/mysql-yum/index.py @@ -3461,23 +3461,17 @@ def fullSync(version=''): def installPreInspection(version): + cmd = "cat /etc/*-release | grep PRETTY_NAME |awk -F = '{print $2}' | awk -F '\"' '{print $2}'| awk '{print $1}'" + sys = mw.execShell(cmd) - - - sys = mw.execShell( - "cat /etc/*-release | grep PRETTY_NAME |awk -F = '{print $2}' | awk -F '\"' '{print $2}'| awk '{print $1}'") - - if sys[1] != '': - return '不支持改系统' - - sys_id = mw.execShell( - "cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F '\"' '{print $2}'") + cmd = "cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F '\"' '{print $2}'" + sys_id = mw.execShell(cmd) sysName = sys[0].strip().lower() sysId = sys_id[0].strip() - if not sysName in ('centos',): - return '仅支持centos' + if not sysName in ['centos','almalinux','rocky','opensuse']: + return '仅支持centos,almalinux,rocky,opensuse' if (sysName == 'centos' and version == '5.7' and not sysId in('7',)): return 'mysql5.7 仅支持centos7' diff --git a/plugins/mysql-yum/install.sh b/plugins/mysql-yum/install.sh index 507847f028..9a1edcaafe 100755 --- a/plugins/mysql-yum/install.sh +++ b/plugins/mysql-yum/install.sh @@ -8,7 +8,7 @@ rootPath=$(dirname "$rootPath") serverPath=$(dirname "$rootPath") -# cd /www/server/mdserver-web/plugins/mysql-yum && bash install.sh install 8.4 +# cd /www/server/mdserver-web/plugins/mysql-yum && bash install.sh install 8.0 # cd /www/server/mdserver-web/plugins/mysql-yum && bash install.sh uninstall 8.0 # cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-yum/index.py start 8.0 # cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-yum/index.py get_master_status 8.4 diff --git a/plugins/mysql-yum/versions/5.7/install.sh b/plugins/mysql-yum/versions/5.7/install.sh index c8f20de79d..17e5203b99 100755 --- a/plugins/mysql-yum/versions/5.7/install.sh +++ b/plugins/mysql-yum/versions/5.7/install.sh @@ -39,11 +39,11 @@ if [ "$OSNAME" == "centos" ];then OS_SIGN=1.el${VERSION_ID} elif [ "$OSNAME" == "fedora" ]; then OS_SIGN=10.fc${VERSION_ID} -elif [ "$OSNAME" == "suse" ]; then - OS_SIGN=1.sl${VERSION_ID} +elif [ "$OSNAME" == "opensuse" ]; then + OS_SIGN=1.sl${VERSION_ID:0:2} fi -MYSQL_VER=5.7.39 +MYSQL_VER=5.7.44 SUFFIX_NAME=${MYSQL_VER}-${OS_SIGN}.${ARCH} YUM_INSTALL() @@ -74,6 +74,37 @@ rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div ####### } +ZYPPER_INSTALL() +{ +zypper install -y libstdc++6 + +mkdir -p /var/run/mysqld +chown mysql -R /var/run/mysqld +####### +mkdir -p $myDir + +wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar +echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar" +cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar + +mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin + +rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div + +####### +} + YUM_UNINSTALL() { ### YUM卸载 START ######## @@ -94,6 +125,11 @@ Install_mysql() if [ "$isYum" != "" ];then YUM_INSTALL fi + + isZypper=`which zypper` + if [ "$isZypper" != "" ];then + ZYPPER_INSTALL + fi rm -rf $myDir echo '5.7' > $serverPath/mysql-yum/version.pl @@ -102,10 +138,7 @@ Install_mysql() Uninstall_mysql() { - isYum=`which yum` - if [ "$isYum" != "" ];then - YUM_UNINSTALL - fi + YUM_UNINSTALL rm -rf $serverPath/mysql-yum echo '卸载完成' > $install_tmp } diff --git a/plugins/mysql-yum/versions/8.0/install.sh b/plugins/mysql-yum/versions/8.0/install.sh index 7f19d812e8..04c211d1df 100755 --- a/plugins/mysql-yum/versions/8.0/install.sh +++ b/plugins/mysql-yum/versions/8.0/install.sh @@ -35,11 +35,11 @@ if [ "$OSNAME" == "centos" ];then OS_SIGN=1.el${VERSION_ID} elif [ "$OSNAME" == "fedora" ]; then OS_SIGN=10.fc${VERSION_ID} -elif [ "$OSNAME" == "suse" ]; then - OS_SIGN=1.sl${VERSION_ID} +elif [ "$OSNAME" == "opensuse" ]; then + OS_SIGN=1.sl${VERSION_ID:0:2} fi -MYSQL_VER=8.0.30 +MYSQL_VER=8.0.37 SUFFIX_NAME=${MYSQL_VER}-${OS_SIGN}.${ARCH} YUM_INSTALL() @@ -71,6 +71,37 @@ rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div ####### } +ZYPPER_INSTALL() +{ +zypper install -y libstdc++6 + +mkdir -p /var/run/mysqld +chown mysql -R /var/run/mysqld +####### +mkdir -p $myDir + +wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar +echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar" +cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar + +mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin + +rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div + +####### +} + YUM_UNINSTALL() { ### YUM卸载 START ######## @@ -94,6 +125,11 @@ Install_mysql() YUM_INSTALL fi + isZypper=`which zypper` + if [ "$isZypper" != "" ];then + ZYPPER_INSTALL + fi + rm -rf $myDir echo '8.0' > $serverPath/mysql-yum/version.pl @@ -102,10 +138,7 @@ Install_mysql() Uninstall_mysql() { - isYum=`which yum` - if [ "$isYum" != "" ];then - YUM_UNINSTALL - fi + YUM_UNINSTALL rm -rf $serverPath/mysql-yum echo '卸载完成' } diff --git a/plugins/mysql-yum/versions/8.2/install.sh b/plugins/mysql-yum/versions/8.2/install.sh index f8da5e7c95..d8477b191a 100755 --- a/plugins/mysql-yum/versions/8.2/install.sh +++ b/plugins/mysql-yum/versions/8.2/install.sh @@ -35,8 +35,8 @@ if [ "$OSNAME" == "centos" ];then OS_SIGN=1.el${VERSION_ID} elif [ "$OSNAME" == "fedora" ]; then OS_SIGN=10.fc${VERSION_ID} -elif [ "$OSNAME" == "suse" ]; then - OS_SIGN=1.sl${VERSION_ID} +elif [ "$OSNAME" == "opensuse" ]; then + OS_SIGN=1.sl${VERSION_ID:0:2} fi MYSQL_VER=8.2.0 @@ -72,6 +72,37 @@ rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div ####### } +ZYPPER_INSTALL() +{ +zypper install -y libstdc++6 + +mkdir -p /var/run/mysqld +chown mysql -R /var/run/mysqld +####### +mkdir -p $myDir + +wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar +echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar" +cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar + +mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin + +rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div + +####### +} + YUM_UNINSTALL() { ### YUM卸载 START ######## @@ -96,6 +127,11 @@ Install_mysql() YUM_INSTALL fi + isZypper=`which zypper` + if [ "$isZypper" != "" ];then + ZYPPER_INSTALL + fi + rm -rf $myDir echo '8.2' > $serverPath/mysql-yum/version.pl @@ -104,10 +140,7 @@ Install_mysql() Uninstall_mysql() { - isYum=`which yum` - if [ "$isYum" != "" ];then - YUM_UNINSTALL - fi + YUM_UNINSTALL rm -rf $serverPath/mysql-yum echo '卸载完成' } diff --git a/plugins/mysql-yum/versions/8.3/install.sh b/plugins/mysql-yum/versions/8.3/install.sh index 845496554c..c3a676aab9 100755 --- a/plugins/mysql-yum/versions/8.3/install.sh +++ b/plugins/mysql-yum/versions/8.3/install.sh @@ -35,8 +35,8 @@ if [ "$OSNAME" == "centos" ];then OS_SIGN=1.el${VERSION_ID} elif [ "$OSNAME" == "fedora" ]; then OS_SIGN=10.fc${VERSION_ID} -elif [ "$OSNAME" == "suse" ]; then - OS_SIGN=1.sl${VERSION_ID} +elif [ "$OSNAME" == "opensuse" ]; then + OS_SIGN=1.sl${VERSION_ID:0:2} fi MYSQL_VER=8.3.0 @@ -72,6 +72,37 @@ rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div ####### } +ZYPPER_INSTALL() +{ +zypper install -y libstdc++6 + +mkdir -p /var/run/mysqld +chown mysql -R /var/run/mysqld +####### +mkdir -p $myDir + +wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar +echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar" +cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar + +mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin + +rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div + +####### +} + YUM_UNINSTALL() { ### YUM卸载 START ######## @@ -96,6 +127,11 @@ Install_mysql() YUM_INSTALL fi + isZypper=`which zypper` + if [ "$isZypper" != "" ];then + ZYPPER_INSTALL + fi + rm -rf $myDir echo '8.3' > $serverPath/mysql-yum/version.pl @@ -104,10 +140,7 @@ Install_mysql() Uninstall_mysql() { - isYum=`which yum` - if [ "$isYum" != "" ];then - YUM_UNINSTALL - fi + YUM_UNINSTALL rm -rf $serverPath/mysql-yum echo '卸载完成' } diff --git a/plugins/mysql-yum/versions/8.4/install.sh b/plugins/mysql-yum/versions/8.4/install.sh index bc968ba355..ad97de8e50 100755 --- a/plugins/mysql-yum/versions/8.4/install.sh +++ b/plugins/mysql-yum/versions/8.4/install.sh @@ -35,8 +35,8 @@ if [ "$OSNAME" == "centos" ];then OS_SIGN=1.el${VERSION_ID} elif [ "$OSNAME" == "fedora" ]; then OS_SIGN=10.fc${VERSION_ID} -elif [ "$OSNAME" == "suse" ]; then - OS_SIGN=1.sl${VERSION_ID} +elif [ "$OSNAME" == "opensuse" ]; then + OS_SIGN=1.sl${VERSION_ID:0:2} fi MYSQL_VER=8.4.0 @@ -52,7 +52,6 @@ chown mysql -R /var/run/mysqld mkdir -p $myDir # https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar - # https://cdn.mysql.com/archives/mysql-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-${SUFFIX_NAME}.rpm-bundle.tar @@ -76,6 +75,37 @@ rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div ####### } +ZYPPER_INSTALL() +{ +zypper install -y libstdc++6 + +mkdir -p /var/run/mysqld +chown mysql -R /var/run/mysqld +####### +mkdir -p $myDir + +wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar +echo "wget --no-check-certificate -O $myDir/mysql-${SUFFIX_NAME}.rpm-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.rpm-bundle.tar" +cd ${myDir} && tar vxf mysql-${SUFFIX_NAME}.rpm-bundle.tar + +mkdir -p ${serverPath}/mysql-yum/bin && cd ${serverPath}/mysql-yum/bin + +rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-client-${SUFFIX_NAME}.x86_64.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-common-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-debuginfo-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-devel-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-embedded-compat-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-icu-data-files-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-libs-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-libs-compat-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-server-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-server-debug-${SUFFIX_NAME}.rpm | cpio -div +rpm2cpio ${myDir}/mysql-community-test-${SUFFIX_NAME}.rpm | cpio -div + +####### +} + YUM_UNINSTALL() { ### YUM卸载 START ######## @@ -99,6 +129,11 @@ Install_mysql() YUM_INSTALL fi + isZypper=`which zypper` + if [ "$isZypper" != "" ];then + ZYPPER_INSTALL + fi + rm -rf $myDir echo '8.4' > $serverPath/mysql-yum/version.pl @@ -107,10 +142,7 @@ Install_mysql() Uninstall_mysql() { - isYum=`which yum` - if [ "$isYum" != "" ];then - YUM_UNINSTALL - fi + YUM_UNINSTALL rm -rf $serverPath/mysql-yum echo '卸载完成' } diff --git a/plugins/mysql/versions/8.0/install.sh b/plugins/mysql/versions/8.0/install.sh index 515ea45da8..c76faa71d0 100755 --- a/plugins/mysql/versions/8.0/install.sh +++ b/plugins/mysql/versions/8.0/install.sh @@ -56,7 +56,7 @@ fi VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` -VERSION=8.0.34 +VERSION=8.0.37 Install_mysql() { mkdir -p ${mysqlDir} @@ -104,7 +104,7 @@ Install_mysql() fi #检测文件是否损坏. - md5_mysql_ok=c8cfab52fbde1cca55accb3113c235eb + md5_mysql_ok=e0cb61cbf6e1144c452368c4535ae931 if [ -f ${mysqlDir}/mysql-boost-${VERSION}.tar.gz ];then md5_mysql=`md5sum ${mysqlDir}/mysql-boost-${VERSION}.tar.gz | awk '{print $1}'` if [ "${md5_mysql_ok}" == "${md5_mysql}" ]; then diff --git a/plugins/php-apt/install.sh b/plugins/php-apt/install.sh index 3e447feeda..2784c20d59 100755 --- a/plugins/php-apt/install.sh +++ b/plugins/php-apt/install.sh @@ -102,6 +102,7 @@ if [ "${action}" == "install" ] && [ -d ${serverPath}/php-apt/${type} ];then cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${apt_ver} install intl cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${apt_ver} install xml cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${apt_ver} install mcrypt + cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${apt_ver} install bcmath cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${apt_ver} install mysqlnd cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${apt_ver} install mysql cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${apt_ver} install gettext diff --git a/plugins/php-yum/index.py b/plugins/php-yum/index.py index c74110e9d7..93c8f674f2 100755 --- a/plugins/php-yum/index.py +++ b/plugins/php-yum/index.py @@ -278,6 +278,9 @@ def initdUinstall(version): def fpmLog(version): + f = '/var/opt/remi/php' + version + '/log/php-fpm.log' + if os.path.exists(f): + return f return '/var/opt/remi/php' + version + '/log/php-fpm/error.log' @@ -836,23 +839,22 @@ def opcacheBlacklistFile(): return op_bl def installPreInspection(version): - try: - cmd = "cat /etc/*-release | grep PRETTY_NAME |awk -F = '{print $2}' | awk -F '\"' '{print $2}'| awk '{print $1}'" - sys = mw.execShell(cmd) - if sys[1] != '': - return '不支持该系统' + + cmd = "cat /etc/*-release | grep PRETTY_NAME |awk -F = '{print $2}' | awk -F '\"' '{print $2}'| awk '{print $1}'" + sys = mw.execShell(cmd) + if sys[1] != '': + return '不支持该系统' - cmd = "cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F '\"' '{print $2}'" - sys_id = mw.execShell(cmd) + cmd = "cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F '\"' '{print $2}'" + sys_id = mw.execShell(cmd) - sysName = sys[0].strip().lower() - sysId = sys_id[0].strip() + sysName = sys[0].strip().lower() + sysId = sys_id[0].strip() + + if not sysName in ['centos','almalinux','fedora','rocky']: + return '暂时仅支持centos,almalinux,fedora,rocky' + return 'ok' - if not sysName in ('centos'): - return '暂时仅支持centos' - return 'ok' - except Exception as e: - return str(e) if __name__ == "__main__": diff --git a/plugins/php-yum/install.sh b/plugins/php-yum/install.sh index 6eaa9e933a..65581a9000 100755 --- a/plugins/php-yum/install.sh +++ b/plugins/php-yum/install.sh @@ -22,24 +22,30 @@ action=$1 type=$2 if [ "${2}" == "" ];then - echo '缺少安装脚本...' > $install_tmp + echo '缺少安装脚本...' exit 0 fi if [ ! -d $curPath/versions/$2 ];then - echo '缺少安装脚本2...' > $install_tmp + echo '缺少安装脚本2...' exit 0 fi # cd /www/server/mdserver-web/plugins/php-yum/versions && bash common.sh 83 install opcache - #获取信息和版本 # bash /www/server/mdserver-web/scripts/getos.sh bash ${rootPath}/scripts/getos.sh OSNAME=`cat ${rootPath}/data/osname.pl` VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` +if [ "$OSNAME" == "alma" ];then + rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-${VERSION_ID}.rpm +fi + +if [ "$OSNAME" == "rocky" ];then + rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-${VERSION_ID}.rpm +fi if [ "$OSNAME" == "centos" ];then rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-${VERSION_ID}.rpm @@ -82,6 +88,7 @@ if [ "${action}" == "install" ] && [ -d ${serverPath}/php-yum/${type} ];then cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install exif cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install intl cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install mcrypt + cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install bcmath cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install openssl cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install gettext cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install redis @@ -89,6 +96,8 @@ if [ "${action}" == "install" ] && [ -d ${serverPath}/php-yum/${type} ];then cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install mbstring cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install mongodb cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install zip + cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install simplexml + echo "install PHP-YUM[${type}] extend end" #初始化 diff --git a/plugins/php-yum/versions/phplib.conf b/plugins/php-yum/versions/phplib.conf index d943f70fa9..c50c806256 100755 --- a/plugins/php-yum/versions/phplib.conf +++ b/plugins/php-yum/versions/phplib.conf @@ -152,24 +152,34 @@ "73", "74", "80", - "81" + "81", + "82", + "83", + "84" ], "type": "通用扩展", "msg": "加密软件!", "shell": "mcrypt.sh", "check": "mcrypt" }, + { + "name": "bcmath", + "versions": [ + "74", + "80", + "81", + "82", + "83", + "84" + ], + "type": "通用扩展", + "msg": "高精度计算!", + "shell": "bcmath.sh", + "check": "bcmath" + }, { "name": "fileinfo", "versions": [ - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -184,14 +194,6 @@ { "name": "simplexml", "versions": [ - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -206,14 +208,6 @@ { "name": "exif", "versions": [ - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -242,15 +236,6 @@ { "name": "intl", "versions": [ - "52", - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -277,14 +262,6 @@ { "name": "memcached", "versions": [ - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -299,15 +276,6 @@ { "name": "redis", "versions": [ - "52", - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -333,13 +301,6 @@ { "name": "imagick-im7", "versions": [ - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -354,14 +315,6 @@ { "name": "xdebug", "versions": [ - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -376,15 +329,6 @@ { "name": "xhprof", "versions": [ - "52", - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -399,14 +343,6 @@ { "name": "Swoole", "versions": [ - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -432,14 +368,6 @@ { "name": "yaf", "versions": [ - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -454,14 +382,6 @@ { "name": "yar", "versions": [ - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -489,12 +409,6 @@ { "name": "mongodb", "versions": [ - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -509,10 +423,6 @@ { "name": "yac", "versions": [ - "70", - "71", - "72", - "73", "74", "80", "81", @@ -527,14 +437,6 @@ { "name": "solr", "versions": [ - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -549,14 +451,6 @@ { "name": "seaslog", "versions": [ - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -571,14 +465,6 @@ { "name": "mbstring", "versions": [ - "53", - "54", - "55", - "56", - "70", - "71", - "72", - "73", "74", "80", "81", @@ -593,10 +479,6 @@ { "name": "zip", "versions": [ - "70", - "71", - "72", - "73", "74", "80", "81", diff --git a/plugins/php/versions/82/install.sh b/plugins/php/versions/82/install.sh index 29beeda043..0d38a2d605 100755 --- a/plugins/php/versions/82/install.sh +++ b/plugins/php/versions/82/install.sh @@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; } -version=8.2.20 +version=8.2.21 PHP_VER=82 Install_php() { @@ -57,7 +57,7 @@ if [ ! -d $sourcePath/php/php${PHP_VER} ];then fi #检测文件是否损坏. - md5_file_ok=4474cc430febef6de7be958f2c37253e5524d5c5331a7e1765cd2d2234881e50 + md5_file_ok=8cc44d51bb2506399ec176f70fe110f0c9e1f7d852a5303a2cd1403402199707 if [ -f $sourcePath/php/php-${version}.tar.xz ];then md5_file=`sha256sum $sourcePath/php/php-${version}.tar.xz | awk '{print $1}'` if [ "${md5_file}" != "${md5_file_ok}" ]; then diff --git a/plugins/php/versions/83/install.sh b/plugins/php/versions/83/install.sh index 54cf11a47a..5e65b63b70 100755 --- a/plugins/php/versions/83/install.sh +++ b/plugins/php/versions/83/install.sh @@ -15,7 +15,7 @@ function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; } function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; } -version=8.3.8 +version=8.3.9 PHP_VER=83 Install_php() { @@ -56,7 +56,7 @@ if [ ! -d $sourcePath/php/php${PHP_VER} ];then fi #检测文件是否损坏. - md5_file_ok=aea358b56186f943c2bbd350c9005b9359133d47e954cfc561385319ae5bb8d7 + md5_file_ok=bf4d7b8ea60a356064f88485278bd6f941a230ec16f0fc401574ce1445ad6c77 if [ -f $sourcePath/php/php-${version}.tar.xz ];then md5_file=`sha256sum $sourcePath/php/php-${version}.tar.xz | awk '{print $1}'` if [ "${md5_file}" != "${md5_file_ok}" ]; then diff --git a/plugins/redis/info.json b/plugins/redis/info.json index 32ed20fb50..4793a12d70 100755 --- a/plugins/redis/info.json +++ b/plugins/redis/info.json @@ -4,13 +4,13 @@ "name": "redis", "title": "Redis", "shell": "install.sh", - "versions":["4.0.11","5.0.8","6.0.4","6.2.7","7.0.12","7.2.2"], - "updates":["4.0.11","5.0.8","6.0.4","6.2.7","7.0.12","7.2.2"], + "versions":["4.0.14","5.0.9","6.0.9","6.2.9","7.0.15","7.2.5"], + "updates":["4.0.14","5.0.9","6.0.9","6.2.9","7.0.15","7.2.5"], "tip": "soft", "checks": "server/redis", "path": "server/redis", "display": 1, - "author": "Zend", + "author": "redis", "date": "2017-04-01", "home": "https://redis.io", "type": 0, diff --git a/plugins/zabbix/conf/zabbix.conf.php b/plugins/zabbix/conf/zabbix.conf.php new file mode 100644 index 0000000000..882a340341 --- /dev/null +++ b/plugins/zabbix/conf/zabbix.conf.php @@ -0,0 +1,58 @@ + 'http://localhost:9200', +// 'text' => 'http://localhost:9200' +//]; +// Value types stored in Elasticsearch. +//$HISTORY['types'] = ['uint', 'text']; + +// Used for SAML authentication. +// Uncomment to override the default paths to SP private key, SP and IdP X.509 certificates, and to set extra settings. +//$SSO['SP_KEY'] = 'conf/certs/sp.key'; +//$SSO['SP_CERT'] = 'conf/certs/sp.crt'; +//$SSO['IDP_CERT'] = 'conf/certs/idp.crt'; +//$SSO['SETTINGS'] = []; + +// If set to false, support for HTTP authentication will be disabled. +// $ALLOW_HTTP_AUTH = true; diff --git a/plugins/zabbix/conf/zabbix.nginx.conf b/plugins/zabbix/conf/zabbix.nginx.conf new file mode 100644 index 0000000000..5a1e6eb459 --- /dev/null +++ b/plugins/zabbix/conf/zabbix.nginx.conf @@ -0,0 +1,45 @@ +server +{ + listen {$ZABBIX_PORT}; + server_name 127.0.0.1; + index index.php index.html index.htm default.php default.htm default.html; + root {$ZABBIX_ROOT}; + + #SSL-START + #error_page 404/404.html; + #SSL-END + + #301-START + + #PROXY-START + + #ERROR-PAGE-START + #error_page 404 /404.html; + #error_page 502 /502.html; + #ERROR-PAGE-END + + #PHP-INFO-START + include {$SERVER_PATH}/web_conf/php/conf/enable-{$PHP_VER}.conf; + #PHP-INFO-END + + #禁止访问的文件或目录 + location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md) + { + return 404; + } + + #一键申请SSL证书验证目录相关设置 + location ~ \.well-known{ + allow all; + } + + location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf|js|css)$ + { + expires 30d; + error_log /dev/null; + access_log /dev/null; + } + + access_log /www/wwwlogs/zabbix.log main; + error_log /www/wwwlogs/zabbix.error.log; +} \ No newline at end of file diff --git a/plugins/zabbix/conf/zabbix_agentd.conf b/plugins/zabbix/conf/zabbix_agentd.conf new file mode 100644 index 0000000000..9ffe32e8bf --- /dev/null +++ b/plugins/zabbix/conf/zabbix_agentd.conf @@ -0,0 +1,18 @@ +PidFile=/run/zabbix/zabbix_agentd.pid +LogFile=/var/log/zabbix/zabbix_agentd.log +LogFileSize=1 + +ListenIP=0.0.0.0 +ListenPort=10050 +EnableRemoteCommands=1 +Timeout=3 + +Server=127.0.0.1 +ServerActive=127.0.0.1 + +Hostname=Zabbix server +Include=/etc/zabbix/zabbix_agentd.d/*.conf + +# Include=/usr/local/etc/zabbix_agentd.userparams.conf +# Include=/usr/local/etc/zabbix_agentd.conf.d/ +# Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf diff --git a/plugins/zabbix/conf/zabbix_server.conf b/plugins/zabbix/conf/zabbix_server.conf new file mode 100644 index 0000000000..b0241a4220 --- /dev/null +++ b/plugins/zabbix/conf/zabbix_server.conf @@ -0,0 +1,13 @@ +LogFile=/var/log/zabbix/zabbix_server.log +LogFileSize=1 +PidFile=/run/zabbix/zabbix_server.pid +SocketDir=/run/zabbix +DBHost=127.0.0.1 +DBPort={$ZABBIX_DB_PORT} +DBName=zabbix +DBUser=zabbix +DBPassword={$ZABBIX_DB_PASS} +ListenPort=10051 +#EnableGlobalScripts=1 +SNMPTrapperFile=/var/log/snmptrap/snmptrap.log + diff --git a/plugins/zabbix/conf/zabbix_server.conf.6.bak b/plugins/zabbix/conf/zabbix_server.conf.6.bak new file mode 100644 index 0000000000..02d1eaa2e5 --- /dev/null +++ b/plugins/zabbix/conf/zabbix_server.conf.6.bak @@ -0,0 +1,991 @@ +# This is a configuration file for Zabbix server daemon +# To get more information about Zabbix, visit http://www.zabbix.com + +############ GENERAL PARAMETERS ################# + +### Option: ListenPort +# Listen port for trapper. +# +# Mandatory: no +# Range: 1024-32767 +# Default: +# ListenPort=10051 + +### Option: SourceIP +# Source IP address for outgoing connections. +# +# Mandatory: no +# Default: +# SourceIP= + +### Option: LogType +# Specifies where log messages are written to: +# system - syslog +# file - file specified with LogFile parameter +# console - standard output +# +# Mandatory: no +# Default: +# LogType=file + +### Option: LogFile +# Log file name for LogType 'file' parameter. +# +# Mandatory: yes, if LogType is set to file, otherwise no +# Default: +# LogFile= + +LogFile=/var/log/zabbixsrv/zabbix_server.log + +### Option: LogFileSize +# Maximum size of log file in MB. +# 0 - disable automatic log rotation. +# +# Mandatory: no +# Range: 0-1024 +# Default: +# LogFileSize=1 +LogFileSize=0 + +### Option: DebugLevel +# Specifies debug level: +# 0 - basic information about starting and stopping of Zabbix processes +# 1 - critical information +# 2 - error information +# 3 - warnings +# 4 - for debugging (produces lots of information) +# 5 - extended debugging (produces even more information) +# +# Mandatory: no +# Range: 0-5 +# Default: +# DebugLevel=3 + +### Option: PidFile +# Name of PID file. +# +# Mandatory: no +# Default: +# PidFile=/tmp/zabbix_server.pid +PidFile=/run/zabbixsrv/zabbix_server.pid + +### Option: SocketDir +# IPC socket directory. +# Directory to store IPC sockets used by internal Zabbix services. +# +# Mandatory: no +# Default: +# SocketDir=/tmp + +### Option: DBHost +# Database host name. +# If set to localhost, socket is used for MySQL. +# If set to empty string, socket is used for PostgreSQL. +# If set to empty string, the Net Service Name connection method is used to connect to Oracle database; also see +# the TNS_ADMIN environment variable to specify the directory where the tnsnames.ora file is located. +# +# Mandatory: no +# Default: +# DBHost=localhost + +### Option: DBName +# Database name. +# If the Net Service Name connection method is used to connect to Oracle database, specify the service name from +# the tnsnames.ora file or set to empty string; also see the TWO_TASK environment variable if DBName is set to +# empty string. +# +# Mandatory: yes +# Default: +# DBName= + +DBName=zabbix + +### Option: DBSchema +# Schema name. Used for PostgreSQL. +# +# Mandatory: no +# Default: +# DBSchema= + +### Option: DBUser +# Database user. +# +# Mandatory: no +# Default: +# DBUser= + +DBUser=zabbix + +### Option: DBPassword +# Database password. +# Comment this line if no password is used. +# +# Mandatory: no +# Default: +# DBPassword= + +### Option: DBSocket +# Path to MySQL socket. +# +# Mandatory: no +# Default: +DBSocket=/var/lib/mysql/mysql.sock + +### Option: DBPort +# Database port when not using local socket. +# If the Net Service Name connection method is used to connect to Oracle database, the port number from the +# tnsnames.ora file will be used. The port number set here will be ignored. +# +# Mandatory: no +# Range: 1024-65535 +# Default: +# DBPort= + +### Option: AllowUnsupportedDBVersions +# Allow server to work with unsupported database versions. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Default: +# AllowUnsupportedDBVersions=0 + +### Option: HistoryStorageURL +# History storage HTTP[S] URL. +# +# Mandatory: no +# Default: +# HistoryStorageURL= + +### Option: HistoryStorageTypes +# Comma separated list of value types to be sent to the history storage. +# +# Mandatory: no +# Default: +# HistoryStorageTypes=uint,dbl,str,log,text + +### Option: HistoryStorageDateIndex +# Enable preprocessing of history values in history storage to store values in different indices based on date. +# 0 - disable +# 1 - enable +# +# Mandatory: no +# Default: +# HistoryStorageDateIndex=0 + +### Option: ExportDir +# Directory for real time export of events, history and trends in newline delimited JSON format. +# If set, enables real time export. +# +# Mandatory: no +# Default: +# ExportDir= + +### Option: ExportFileSize +# Maximum size per export file in bytes. +# Only used for rotation if ExportDir is set. +# +# Mandatory: no +# Range: 1M-1G +# Default: +# ExportFileSize=1G + +### Option: ExportType +# List of comma delimited types of real time export - allows to control export entities by their +# type (events, history, trends) individually. +# Valid only if ExportDir is set. +# +# Mandatory: no +# Default: +# ExportType=events,history,trends + +############ ADVANCED PARAMETERS ################ + +### Option: StartPollers +# Number of pre-forked instances of pollers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartPollers=5 + +### Option: StartIPMIPollers +# Number of pre-forked instances of IPMI pollers. +# The IPMI manager process is automatically started when at least one IPMI poller is started. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartIPMIPollers=0 + +### Option: StartPreprocessors +# Number of pre-forked instances of preprocessing workers. +# The preprocessing manager process is automatically started when preprocessor worker is started. +# +# Mandatory: no +# Range: 1-1000 +# Default: +# StartPreprocessors=3 + +### Option: StartPollersUnreachable +# Number of pre-forked instances of pollers for unreachable hosts (including IPMI and Java). +# At least one poller for unreachable hosts must be running if regular, IPMI or Java pollers +# are started. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartPollersUnreachable=1 + +### Option: StartHistoryPollers +# Number of pre-forked instances of history pollers. +# Only required for calculated and internal checks. +# A database connection is required for each history poller instance. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartHistoryPollers=5 + +### Option: StartTrappers +# Number of pre-forked instances of trappers. +# Trappers accept incoming connections from Zabbix sender, active agents and active proxies. +# At least one trapper process must be running to display server availability and view queue +# in the frontend. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartTrappers=5 + +### Option: StartPingers +# Number of pre-forked instances of ICMP pingers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartPingers=1 + +### Option: StartDiscoverers +# Number of pre-forked instances of discoverers. +# +# Mandatory: no +# Range: 0-250 +# Default: +# StartDiscoverers=1 + +### Option: StartHTTPPollers +# Number of pre-forked instances of HTTP pollers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartHTTPPollers=1 + +### Option: StartTimers +# Number of pre-forked instances of timers. +# Timers process maintenance periods. +# Only the first timer process handles host maintenance updates. Problem suppression updates are shared +# between all timers. +# +# Mandatory: no +# Range: 1-1000 +# Default: +# StartTimers=1 + +### Option: StartEscalators +# Number of pre-forked instances of escalators. +# +# Mandatory: no +# Range: 1-100 +# Default: +# StartEscalators=1 + +### Option: StartAlerters +# Number of pre-forked instances of alerters. +# Alerters send the notifications created by action operations. +# +# Mandatory: no +# Range: 1-100 +# Default: +# StartAlerters=3 + +### Option: JavaGateway +# IP address (or hostname) of Zabbix Java gateway. +# Only required if Java pollers are started. +# +# Mandatory: no +# Default: +# JavaGateway= + +### Option: JavaGatewayPort +# Port that Zabbix Java gateway listens on. +# +# Mandatory: no +# Range: 1024-32767 +# Default: +# JavaGatewayPort=10052 + +### Option: StartJavaPollers +# Number of pre-forked instances of Java pollers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartJavaPollers=0 + +### Option: StartVMwareCollectors +# Number of pre-forked vmware collector instances. +# +# Mandatory: no +# Range: 0-250 +# Default: +# StartVMwareCollectors=0 + +### Option: VMwareFrequency +# How often Zabbix will connect to VMware service to obtain a new data. +# +# Mandatory: no +# Range: 10-86400 +# Default: +# VMwareFrequency=60 + +### Option: VMwarePerfFrequency +# How often Zabbix will connect to VMware service to obtain performance data. +# +# Mandatory: no +# Range: 10-86400 +# Default: +# VMwarePerfFrequency=60 + +### Option: VMwareCacheSize +# Size of VMware cache, in bytes. +# Shared memory size for storing VMware data. +# Only used if VMware collectors are started. +# +# Mandatory: no +# Range: 256K-2G +# Default: +# VMwareCacheSize=8M + +### Option: VMwareTimeout +# Specifies how many seconds vmware collector waits for response from VMware service. +# +# Mandatory: no +# Range: 1-300 +# Default: +# VMwareTimeout=10 + +### Option: SNMPTrapperFile +# Temporary file used for passing data from SNMP trap daemon to the server. +# Must be the same as in zabbix_trap_receiver.pl or SNMPTT configuration file. +# +# Mandatory: no +# Default: +# SNMPTrapperFile=/tmp/zabbix_traps.tmp + +### Option: StartSNMPTrapper +# If 1, SNMP trapper process is started. +# +# Mandatory: no +# Range: 0-1 +# Default: +# StartSNMPTrapper=0 + +### Option: ListenIP +# List of comma delimited IP addresses that the trapper should listen on. +# Trapper will listen on all network interfaces if this parameter is missing. +# +# Mandatory: no +# Default: +# ListenIP=0.0.0.0 + +### Option: HousekeepingFrequency +# How often Zabbix will perform housekeeping procedure (in hours). +# Housekeeping is removing outdated information from the database. +# To prevent Housekeeper from being overloaded, no more than 4 times HousekeepingFrequency +# hours of outdated information are deleted in one housekeeping cycle, for each item. +# To lower load on server startup housekeeping is postponed for 30 minutes after server start. +# With HousekeepingFrequency=0 the housekeeper can be only executed using the runtime control option. +# In this case the period of outdated information deleted in one housekeeping cycle is 4 times the +# period since the last housekeeping cycle, but not less than 4 hours and not greater than 4 days. +# +# Mandatory: no +# Range: 0-24 +# Default: +# HousekeepingFrequency=1 + +### Option: MaxHousekeeperDelete +# The table "housekeeper" contains "tasks" for housekeeping procedure in the format: +# [housekeeperid], [tablename], [field], [value]. +# No more than 'MaxHousekeeperDelete' rows (corresponding to [tablename], [field], [value]) +# will be deleted per one task in one housekeeping cycle. +# If set to 0 then no limit is used at all. In this case you must know what you are doing! +# +# Mandatory: no +# Range: 0-1000000 +# Default: +# MaxHousekeeperDelete=5000 + +### Option: CacheSize +# Size of configuration cache, in bytes. +# Shared memory size for storing host, item and trigger data. +# +# Mandatory: no +# Range: 128K-64G +# Default: +# CacheSize=32M + +### Option: CacheUpdateFrequency +# How often Zabbix will perform update of configuration cache, in seconds. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# CacheUpdateFrequency=60 + +### Option: StartDBSyncers +# Number of pre-forked instances of DB Syncers. +# +# Mandatory: no +# Range: 1-100 +# Default: +# StartDBSyncers=4 + +### Option: HistoryCacheSize +# Size of history cache, in bytes. +# Shared memory size for storing history data. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# HistoryCacheSize=16M + +### Option: HistoryIndexCacheSize +# Size of history index cache, in bytes. +# Shared memory size for indexing history cache. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# HistoryIndexCacheSize=4M + +### Option: TrendCacheSize +# Size of trend write cache, in bytes. +# Shared memory size for storing trends data. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# TrendCacheSize=4M + +### Option: TrendFunctionCacheSize +# Size of trend function cache, in bytes. +# Shared memory size for caching calculated trend function data. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# TrendFunctionCacheSize=4M + +### Option: ValueCacheSize +# Size of history value cache, in bytes. +# Shared memory size for caching item history data requests. +# Setting to 0 disables value cache. +# +# Mandatory: no +# Range: 0,128K-64G +# Default: +# ValueCacheSize=8M + +### Option: Timeout +# Specifies how long we wait for agent, SNMP device or external check (in seconds). +# +# Mandatory: no +# Range: 1-30 +# Default: +# Timeout=3 + +Timeout=4 + +### Option: TrapperTimeout +# Specifies how many seconds trapper may spend processing new data. +# +# Mandatory: no +# Range: 1-300 +# Default: +# TrapperTimeout=300 + +### Option: UnreachablePeriod +# After how many seconds of unreachability treat a host as unavailable. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# UnreachablePeriod=45 + +### Option: UnavailableDelay +# How often host is checked for availability during the unavailability period, in seconds. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# UnavailableDelay=60 + +### Option: UnreachableDelay +# How often host is checked for availability during the unreachability period, in seconds. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# UnreachableDelay=15 + +### Option: AlertScriptsPath +# Full path to location of custom alert scripts. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# AlertScriptsPath=/usr/share/zabbix/alertscripts +AlertScriptsPath=/var/lib/zabbixsrv/alertscripts + +### Option: ExternalScripts +# Full path to location of external scripts. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# ExternalScripts=/usr/share/zabbix/externalscripts +ExternalScripts=/var/lib/zabbixsrv/externalscripts + +### Option: FpingLocation +# Location of fping. +# Make sure that fping binary has root ownership and SUID flag set. +# +# Mandatory: no +# Default: +# FpingLocation=/usr/sbin/fping + +### Option: Fping6Location +# Location of fping6. +# Make sure that fping6 binary has root ownership and SUID flag set. +# Make empty if your fping utility is capable to process IPv6 addresses. +# +# Mandatory: no +# Default: +# Fping6Location=/usr/sbin/fping6 + +### Option: SSHKeyLocation +# Location of public and private keys for SSH checks and actions. +# +# Mandatory: no +# Default: +# SSHKeyLocation= + +### Option: LogSlowQueries +# How long a database query may take before being logged (in milliseconds). +# Only works if DebugLevel set to 3, 4 or 5. +# 0 - don't log slow queries. +# +# Mandatory: no +# Range: 1-3600000 +# Default: +# LogSlowQueries=0 + +LogSlowQueries=3000 + +### Option: TmpDir +# Temporary directory. +# +# Mandatory: no +# Default: +# TmpDir=/tmp +TmpDir=/var/lib/zabbixsrv/tmp + +### Option: StartProxyPollers +# Number of pre-forked instances of pollers for passive proxies. +# +# Mandatory: no +# Range: 0-250 +# Default: +# StartProxyPollers=1 + +### Option: ProxyConfigFrequency +# How often Zabbix Server sends configuration data to a Zabbix Proxy in seconds. +# This parameter is used only for proxies in the passive mode. +# +# Mandatory: no +# Range: 1-3600*24*7 +# Default: +# ProxyConfigFrequency=3600 + +### Option: ProxyDataFrequency +# How often Zabbix Server requests history data from a Zabbix Proxy in seconds. +# This parameter is used only for proxies in the passive mode. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# ProxyDataFrequency=1 + +### Option: StartLLDProcessors +# Number of pre-forked instances of low level discovery processors. +# +# Mandatory: no +# Range: 1-100 +# Default: +# StartLLDProcessors=2 + +### Option: AllowRoot +# Allow the server to run as 'root'. If disabled and the server is started by 'root', the server +# will try to switch to the user specified by the User configuration option instead. +# Has no effect if started under a regular user. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Default: +# AllowRoot=0 + +### Option: User +# Drop privileges to a specific, existing user on the system. +# Only has effect if run as 'root' and AllowRoot is disabled. +# +# Mandatory: no +# Default: +# User=zabbix + +### Option: Include +# You may include individual files or all files in a directory in the configuration file. +# Installing Zabbix will create include directory in /etc, unless modified during the compile time. +# +# Mandatory: no +# Default: +# Include= + +# Include=/etc/zabbix_server.general.conf +# Include=/etc/zabbix_server.conf.d/ +# Include=/etc/zabbix_server.conf.d/*.conf + +### Option: SSLCertLocation +# Location of SSL client certificates. +# This parameter is used only in web monitoring. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# SSLCertLocation=/usr/share/zabbix/ssl/certs + +### Option: SSLKeyLocation +# Location of private keys for SSL client certificates. +# This parameter is used only in web monitoring. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# SSLKeyLocation=/usr/share/zabbix/ssl/keys + +### Option: SSLCALocation +# Override the location of certificate authority (CA) files for SSL server certificate verification. +# If not set, system-wide directory will be used. +# This parameter is used in web monitoring, SMTP authentication, HTTP agent items and for communication with Vault. +# +# Mandatory: no +# Default: +# SSLCALocation= + +### Option: StatsAllowedIP +# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of external Zabbix instances. +# Stats request will be accepted only from the addresses listed here. If this parameter is not set no stats requests +# will be accepted. +# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally +# and '::/0' will allow any IPv4 or IPv6 address. +# '0.0.0.0/0' can be used to allow any IPv4 address. +# Example: StatsAllowedIP=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com +# +# Mandatory: no +# Default: +# StatsAllowedIP= +StatsAllowedIP=127.0.0.1 + +####### LOADABLE MODULES ####### + +### Option: LoadModulePath +# Full path to location of server modules. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# LoadModulePath=${libdir}/modules + +### Option: LoadModule +# Module to load at server startup. Modules are used to extend functionality of the server. +# Formats: +# LoadModule= +# LoadModule= +# LoadModule= +# Either the module must be located in directory specified by LoadModulePath or the path must precede the module name. +# If the preceding path is absolute (starts with '/') then LoadModulePath is ignored. +# It is allowed to include multiple LoadModule parameters. +# +# Mandatory: no +# Default: +# LoadModule= + +####### TLS-RELATED PARAMETERS ####### + +### Option: TLSCAFile +# Full pathname of a file containing the top-level CA(s) certificates for +# peer certificate verification. +# +# Mandatory: no +# Default: +# TLSCAFile= + +### Option: TLSCRLFile +# Full pathname of a file containing revoked certificates. +# +# Mandatory: no +# Default: +# TLSCRLFile= + +### Option: TLSCertFile +# Full pathname of a file containing the server certificate or certificate chain. +# +# Mandatory: no +# Default: +# TLSCertFile= + +### Option: TLSKeyFile +# Full pathname of a file containing the server private key. +# +# Mandatory: no +# Default: +# TLSKeyFile= + +####### For advanced users - TLS ciphersuite selection criteria ####### + +### Option: TLSCipherCert13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# +# Mandatory: no +# Default: +# TLSCipherCert13= + +### Option: TLSCipherCert +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128 +# +# Mandatory: no +# Default: +# TLSCipherCert= + +### Option: TLSCipherPSK13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example: +# TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherPSK13= + +### Option: TLSCipherPSK +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL +# Example for OpenSSL: +# kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherPSK= + +### Option: TLSCipherAll13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example: +# TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherAll13= + +### Option: TLSCipherAll +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128:kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherAll= + +### Option: DBTLSConnect +# Setting this option enforces to use TLS connection to database. +# required - connect using TLS +# verify_ca - connect using TLS and verify certificate +# verify_full - connect using TLS, verify certificate and verify that database identity specified by DBHost +# matches its certificate +# On MySQL starting from 5.7.11 and PostgreSQL following values are supported: "required", "verify_ca" and +# "verify_full". +# On MariaDB starting from version 10.2.6 "required" and "verify_full" values are supported. +# Default is not to set any option and behavior depends on database configuration +# +# Mandatory: no +# Default: +# DBTLSConnect= + +### Option: DBTLSCAFile +# Full pathname of a file containing the top-level CA(s) certificates for database certificate verification. +# Supported only for MySQL and PostgreSQL +# +# Mandatory: no +# (yes, if DBTLSConnect set to one of: verify_ca, verify_full) +# Default: +# DBTLSCAFile= + +### Option: DBTLSCertFile +# Full pathname of file containing Zabbix server certificate for authenticating to database. +# Supported only for MySQL and PostgreSQL +# +# Mandatory: no +# Default: +# DBTLSCertFile= + +### Option: DBTLSKeyFile +# Full pathname of file containing the private key for authenticating to database. +# Supported only for MySQL and PostgreSQL +# +# Mandatory: no +# Default: +# DBTLSKeyFile= + +### Option: DBTLSCipher +# The list of encryption ciphers that Zabbix server permits for TLS protocols up through TLSv1.2 +# Supported only for MySQL +# +# Mandatory no +# Default: +# DBTLSCipher= + +### Option: DBTLSCipher13 +# The list of encryption ciphersuites that Zabbix server permits for TLSv1.3 protocol +# Supported only for MySQL, starting from version 8.0.16 +# +# Mandatory no +# Default: +# DBTLSCipher13= + +### Option: VaultToken +# Vault authentication token that should have been generated exclusively for Zabbix server with read only permission +# to paths specified in Vault macros and read only permission to path specified in optional VaultDBPath +# configuration parameter. +# It is an error if VaultToken and VAULT_TOKEN environment variable are defined at the same time. +# +# Mandatory: no +# Default: +# VaultToken= + +### Option: VaultURL +# Vault server HTTP[S] URL. System-wide CA certificates directory will be used if SSLCALocation is not specified. +# +# Mandatory: no +# Default: +# VaultURL=https://127.0.0.1:8200 + +### Option: VaultDBPath +# Vault path from where credentials for database will be retrieved by keys 'password' and 'username'. +# Example: secret/zabbix/database +# This option can only be used if DBUser and DBPassword are not specified. +# +# Mandatory: no +# Default: +# VaultDBPath= + +### Option: StartReportWriters +# Number of pre-forked report writer instances. +# +# Mandatory: no +# Range: 0-100 +# Default: +# StartReportWriters=0 + +### Option: WebServiceURL +# URL to Zabbix web service, used to perform web related tasks. +# Example: http://localhost:10053/report +# +# Mandatory: no +# Default: +# WebServiceURL= + +### Option: ServiceManagerSyncFrequency +# How often Zabbix will synchronize configuration of a service manager (in seconds). +# +# Mandatory: no +# Range: 1-3600 +# Default: +# ServiceManagerSyncFrequency=60 + +### Option: ProblemHousekeepingFrequency +# How often Zabbix will delete problems for deleted triggers (in seconds). +# +# Mandatory: no +# Range: 1-3600 +# Default: +# ProblemHousekeepingFrequency=60 + +## Option: StartODBCPollers +# Number of pre-forked ODBC poller instances. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartODBCPollers=1 + +####### For advanced users - TCP-related fine-tuning parameters ####### + +## Option: ListenBacklog +# The maximum number of pending connections in the queue. This parameter is passed to +# listen() function as argument 'backlog' (see "man listen"). +# +# Mandatory: no +# Range: 0 - INT_MAX (depends on system, too large values may be silently truncated to implementation-specified maximum) +# Default: SOMAXCONN (hard-coded constant, depends on system) +# ListenBacklog= + + +####### High availability cluster parameters ####### + +## Option: HANodeName +# The high availability cluster node name. +# When empty, server is working in standalone mode; a node with empty name is registered with address for the frontend to connect to. +# +# Mandatory: no +# Default: +# HANodeName= + +## Option: NodeAddress +# IP or hostname with optional port to specify how frontend should connect to the server. +# Format:
[:] +# +# If IP or hostname is not set, then ListenIP value will be used. In case ListenIP is not set, localhost will be used. +# If port is not set, then ListenPort value will be used. In case ListenPort is not set, 10051 will be used. +# This option can be overridden by address specified in frontend configuration. +# +# Mandatory: no +# Default: +# NodeAddress=localhost:10051 diff --git a/plugins/zabbix/conf/zabbix_server.conf.bak b/plugins/zabbix/conf/zabbix_server.conf.bak new file mode 100644 index 0000000000..b33d1926cf --- /dev/null +++ b/plugins/zabbix/conf/zabbix_server.conf.bak @@ -0,0 +1,1130 @@ +# This is a configuration file for Zabbix server daemon +# To get more information about Zabbix, visit https://www.zabbix.com + +############ GENERAL PARAMETERS ################# + +### Option: ListenPort +# Listen port for trapper. +# +# Mandatory: no +# Range: 1024-32767 +# Default: +# ListenPort=10051 + +### Option: SourceIP +# Source IP address for outgoing connections. +# +# Mandatory: no +# Default: +# SourceIP= + +### Option: LogType +# Specifies where log messages are written to: +# system - syslog +# file - file specified with LogFile parameter +# console - standard output +# +# Mandatory: no +# Default: +# LogType=file + +### Option: LogFile +# Log file name for LogType 'file' parameter. +# +# Mandatory: yes, if LogType is set to file, otherwise no +# Default: +# LogFile= + +LogFile=/var/log/zabbix/zabbix_server.log + +### Option: LogFileSize +# Maximum size of log file in MB. +# 0 - disable automatic log rotation. +# +# Mandatory: no +# Range: 0-1024 +# Default: +# LogFileSize=1 + +LogFileSize=0 + +### Option: DebugLevel +# Specifies debug level: +# 0 - basic information about starting and stopping of Zabbix processes +# 1 - critical information +# 2 - error information +# 3 - warnings +# 4 - for debugging (produces lots of information) +# 5 - extended debugging (produces even more information) +# +# Mandatory: no +# Range: 0-5 +# Default: +# DebugLevel=3 + +### Option: PidFile +# Name of PID file. +# +# Mandatory: no +# Default: +# PidFile=/tmp/zabbix_server.pid + +PidFile=/run/zabbix/zabbix_server.pid + +### Option: SocketDir +# IPC socket directory. +# Directory to store IPC sockets used by internal Zabbix services. +# +# Mandatory: no +# Default: +# SocketDir=/tmp + +SocketDir=/run/zabbix + +### NOTE: Support for Oracle DB is deprecated since Zabbix 7.0 and will be removed in future versions. + +### Option: DBHost +# Database host name. +# If set to localhost, socket is used for MySQL. +# If set to empty string, socket is used for PostgreSQL. +# If set to empty string, the Net Service Name connection method is used to connect to Oracle database; also see +# the TNS_ADMIN environment variable to specify the directory where the tnsnames.ora file is located. +# +# Mandatory: no +# Default: +DBHost=127.0.0.1 + +### Option: DBName +# Database name. +# If the Net Service Name connection method is used to connect to Oracle database, specify the service name from +# the tnsnames.ora file or set to empty string; also see the TWO_TASK environment variable if DBName is set to +# empty string. +# +# Mandatory: yes +# Default: +# DBName= + +DBName=zabbix + +### Option: DBSchema +# Schema name. Used for PostgreSQL. +# +# Mandatory: no +# Default: +# DBSchema= + +### Option: DBUser +# Database user. +# +# Mandatory: no +# Default: +# DBUser= + +DBUser=zabbix + +### Option: DBPassword +# Database password. +# Comment this line if no password is used. +# +# Mandatory: no +# Default: +DBPassword=XXX + +### Option: DBSocket +# Path to MySQL socket. +# +# Mandatory: no +# Default: +# DBSocket= + +### Option: DBPort +# Database port when not using local socket. +# If the Net Service Name connection method is used to connect to Oracle database, the port number from the +# tnsnames.ora file will be used. The port number set here will be ignored. +# +# Mandatory: no +# Range: 1024-65535 +# Default: +# DBPort= + +### Option: AllowUnsupportedDBVersions +# Allow server to work with unsupported database versions. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Default: +# AllowUnsupportedDBVersions=0 + +### Option: HistoryStorageURL +# History storage HTTP[S] URL. +# +# Mandatory: no +# Default: +# HistoryStorageURL= + +### Option: HistoryStorageTypes +# Comma separated list of value types to be sent to the history storage. +# +# Mandatory: no +# Default: +# HistoryStorageTypes=uint,dbl,str,log,text + +### Option: HistoryStorageDateIndex +# Enable preprocessing of history values in history storage to store values in different indices based on date. +# 0 - disable +# 1 - enable +# +# Mandatory: no +# Default: +# HistoryStorageDateIndex=0 + +### Option: ExportDir +# Directory for real time export of events, history and trends in newline delimited JSON format. +# If set, enables real time export. +# +# Mandatory: no +# Default: +# ExportDir= + +### Option: ExportFileSize +# Maximum size per export file in bytes. +# Only used for rotation if ExportDir is set. +# +# Mandatory: no +# Range: 1M-1G +# Default: +# ExportFileSize=1G + +### Option: ExportType +# List of comma delimited types of real time export - allows to control export entities by their +# type (events, history, trends) individually. +# Valid only if ExportDir is set. +# +# Mandatory: no +# Default: +# ExportType=events,history,trends + +############ ADVANCED PARAMETERS ################ + +### Option: StartPollers +# Number of pre-forked instances of pollers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartPollers=5 + +### Option: StartAgentPollers +# Number of pre-forked instances of asynchronous Zabbix agent pollers. Also see MaxConcurrentChecksPerPoller. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartAgentPollers=1 + +### Option: StartHTTPAgentPollers +# Number of pre-forked instances of asynchronous HTTP agent pollers. Also see MaxConcurrentChecksPerPoller. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartHTTPAgentPollers=1 + +### Option: StartSNMPPollers +# Number of pre-forked instances of asynchronous SNMP pollers. Also see MaxConcurrentChecksPerPoller. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartSNMPPollers=1 + +### Option: MaxConcurrentChecksPerPoller +# Maximum number of asynchronous checks that can be executed at once by each HTTP agent poller or agent poller. +# +# Mandatory: no +# Range: 1-1000 +# Default: +# MaxConcurrentChecksPerPoller=1000 + +### Option: StartIPMIPollers +# Number of pre-forked instances of IPMI pollers. +# The IPMI manager process is automatically started when at least one IPMI poller is started. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartIPMIPollers=0 + + +### Option: StartPreprocessors +# Number of pre-started instances of preprocessing workers. +# +# Mandatory: no +# Range: 1-1000 +# Default: +# StartPreprocessors=3 + +### Option: StartConnectors +# Number of pre-forked instances of connector workers. +# The connector manager process is automatically started when connector worker is started. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartConnectors=0 + +### Option: StartPollersUnreachable +# Number of pre-forked instances of pollers for unreachable hosts (including IPMI and Java). +# At least one poller for unreachable hosts must be running if regular, IPMI or Java pollers +# are started. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartPollersUnreachable=1 + +### Option: StartHistoryPollers +# Number of pre-forked instances of history pollers. +# Only required for calculated checks. +# A database connection is required for each history poller instance. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartHistoryPollers=5 + +### Option: StartTrappers +# Number of pre-forked instances of trappers. +# Trappers accept incoming connections from Zabbix sender, active agents and active proxies. +# At least one trapper process must be running to display server availability and view queue +# in the frontend. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartTrappers=5 + +### Option: StartPingers +# Number of pre-forked instances of ICMP pingers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartPingers=1 + +### Option: StartDiscoverers +# Number of pre-started instances of discovery workers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartDiscoverers=5 + +### Option: StartHTTPPollers +# Number of pre-forked instances of HTTP pollers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartHTTPPollers=1 + +### Option: StartTimers +# Number of pre-forked instances of timers. +# Timers process maintenance periods. +# Only the first timer process handles host maintenance updates. Problem suppression updates are shared +# between all timers. +# +# Mandatory: no +# Range: 1-1000 +# Default: +# StartTimers=1 + +### Option: StartEscalators +# Number of pre-forked instances of escalators. +# +# Mandatory: no +# Range: 1-100 +# Default: +# StartEscalators=1 + +### Option: StartAlerters +# Number of pre-forked instances of alerters. +# Alerters send the notifications created by action operations. +# +# Mandatory: no +# Range: 1-100 +# Default: +# StartAlerters=3 + +### Option: JavaGateway +# IP address (or hostname) of Zabbix Java gateway. +# Only required if Java pollers are started. +# +# Mandatory: no +# Default: +# JavaGateway= + +### Option: JavaGatewayPort +# Port that Zabbix Java gateway listens on. +# +# Mandatory: no +# Range: 1024-32767 +# Default: +# JavaGatewayPort=10052 + +### Option: StartJavaPollers +# Number of pre-forked instances of Java pollers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartJavaPollers=0 + +### Option: StartVMwareCollectors +# Number of pre-forked vmware collector instances. +# +# Mandatory: no +# Range: 0-250 +# Default: +# StartVMwareCollectors=0 + +### Option: VMwareFrequency +# How often Zabbix will connect to VMware service to obtain a new data. +# +# Mandatory: no +# Range: 10-86400 +# Default: +# VMwareFrequency=60 + +### Option: VMwarePerfFrequency +# How often Zabbix will connect to VMware service to obtain performance data. +# +# Mandatory: no +# Range: 10-86400 +# Default: +# VMwarePerfFrequency=60 + +### Option: VMwareCacheSize +# Size of VMware cache, in bytes. +# Shared memory size for storing VMware data. +# Only used if VMware collectors are started. +# +# Mandatory: no +# Range: 256K-2G +# Default: +# VMwareCacheSize=8M + +### Option: VMwareTimeout +# Specifies how many seconds vmware collector waits for response from VMware service. +# +# Mandatory: no +# Range: 1-300 +# Default: +# VMwareTimeout=10 + +### Option: SNMPTrapperFile +# Temporary file used for passing data from SNMP trap daemon to the server. +# Must be the same as in zabbix_trap_receiver.pl or SNMPTT configuration file. +# +# Mandatory: no +# Default: +# SNMPTrapperFile=/tmp/zabbix_traps.tmp + +SNMPTrapperFile=/var/log/snmptrap/snmptrap.log + +### Option: StartSNMPTrapper +# If 1, SNMP trapper process is started. +# +# Mandatory: no +# Range: 0-1 +# Default: +# StartSNMPTrapper=0 + +### Option: ListenIP +# List of comma delimited IP addresses that the trapper should listen on. +# Trapper will listen on all network interfaces if this parameter is missing. +# +# Mandatory: no +# Default: +# ListenIP=0.0.0.0 + +### Option: HousekeepingFrequency +# How often Zabbix will perform housekeeping procedure (in hours). +# Housekeeping is removing outdated information from the database. +# To prevent Housekeeper from being overloaded, no more than 4 times HousekeepingFrequency +# hours of outdated information are deleted in one housekeeping cycle, for each item. +# To lower load on server startup housekeeping is postponed for 30 minutes after server start. +# With HousekeepingFrequency=0 the housekeeper can be only executed using the runtime control option. +# In this case the period of outdated information deleted in one housekeeping cycle is 4 times the +# period since the last housekeeping cycle, but not less than 4 hours and not greater than 4 days. +# +# Mandatory: no +# Range: 0-24 +# Default: +# HousekeepingFrequency=1 + +### Option: MaxHousekeeperDelete +# The table "housekeeper" contains "tasks" for housekeeping procedure in the format: +# [housekeeperid], [tablename], [field], [value]. +# No more than 'MaxHousekeeperDelete' rows (corresponding to [tablename], [field], [value]) +# will be deleted per one task in one housekeeping cycle. +# If set to 0 then no limit is used at all. In this case you must know what you are doing! +# +# Mandatory: no +# Range: 0-1000000 +# Default: +# MaxHousekeeperDelete=5000 + +### Option: CacheSize +# Size of configuration cache, in bytes. +# Shared memory size for storing host, item and trigger data. +# +# Mandatory: no +# Range: 128K-64G +# Default: +# CacheSize=32M + +### Option: CacheUpdateFrequency +# How often Zabbix will perform update of configuration cache, in seconds. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# CacheUpdateFrequency=10 + +### Option: StartDBSyncers +# Number of pre-forked instances of DB Syncers. +# +# Mandatory: no +# Range: 1-100 +# Default: +# StartDBSyncers=4 + +### Option: HistoryCacheSize +# Size of history cache, in bytes. +# Shared memory size for storing history data. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# HistoryCacheSize=16M + +### Option: HistoryIndexCacheSize +# Size of history index cache, in bytes. +# Shared memory size for indexing history cache. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# HistoryIndexCacheSize=4M + +### Option: TrendCacheSize +# Size of trend write cache, in bytes. +# Shared memory size for storing trends data. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# TrendCacheSize=4M + +### Option: TrendFunctionCacheSize +# Size of trend function cache, in bytes. +# Shared memory size for caching calculated trend function data. +# +# Mandatory: no +# Range: 128K-2G +# Default: +# TrendFunctionCacheSize=4M + +### Option: ValueCacheSize +# Size of history value cache, in bytes. +# Shared memory size for caching item history data requests. +# Setting to 0 disables value cache. +# +# Mandatory: no +# Range: 0,128K-64G +# Default: +# ValueCacheSize=8M + +### Option: Timeout +# Specifies timeout for communications (in seconds). +# +# Mandatory: no +# Range: 1-30 +# Default: +# Timeout=3 + +Timeout=4 + +### Option: TrapperTimeout +# Specifies how many seconds trapper may spend processing new data. +# +# Mandatory: no +# Range: 1-300 +# Default: +# TrapperTimeout=300 + +### Option: UnreachablePeriod +# After how many seconds of unreachability treat a host as unavailable. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# UnreachablePeriod=45 + +### Option: UnavailableDelay +# How often host is checked for availability during the unavailability period, in seconds. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# UnavailableDelay=60 + +### Option: UnreachableDelay +# How often host is checked for availability during the unreachability period, in seconds. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# UnreachableDelay=15 + +### Option: AlertScriptsPath +# Full path to location of custom alert scripts. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# AlertScriptsPath=/usr/lib/zabbix/alertscripts + +### Option: ExternalScripts +# Full path to location of external scripts. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# ExternalScripts=/usr/lib/zabbix/externalscripts + +### Option: FpingLocation +# Location of fping. +# Make sure that fping binary has root ownership and SUID flag set. +# +# Mandatory: no +# Default: +# FpingLocation=/usr/sbin/fping + +FpingLocation=/usr/bin/fping + +### Option: Fping6Location +# Location of fping6. +# Make sure that fping6 binary has root ownership and SUID flag set. +# Make empty if your fping utility is capable to process IPv6 addresses. +# +# Mandatory: no +# Default: +# Fping6Location=/usr/sbin/fping6 + +Fping6Location=/usr/bin/fping6 + +### Option: SSHKeyLocation +# Location of public and private keys for SSH checks and actions. +# +# Mandatory: no +# Default: +# SSHKeyLocation= + +### Option: LogSlowQueries +# How long a database query may take before being logged (in milliseconds). +# Only works if DebugLevel set to 3, 4 or 5. +# 0 - don't log slow queries. +# +# Mandatory: no +# Range: 1-3600000 +# Default: +# LogSlowQueries=0 + +LogSlowQueries=3000 + +### Option: TmpDir +# Temporary directory. +# +# Mandatory: no +# Default: +# TmpDir=/tmp + +### Option: StartProxyPollers +# Number of pre-forked instances of pollers for passive proxies. +# +# Mandatory: no +# Range: 0-250 +# Default: +# StartProxyPollers=1 + +### Option: ProxyConfigFrequency +# How often Zabbix Server sends configuration data to a Zabbix Proxy in seconds. +# This parameter is used only for proxies in the passive mode. +# +# Mandatory: no +# Range: 1-3600*24*7 +# Default: +# ProxyConfigFrequency=10 + +### Option: ProxyDataFrequency +# How often Zabbix Server requests history data from a Zabbix Proxy in seconds. +# This parameter is used only for proxies in the passive mode. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# ProxyDataFrequency=1 + +### Option: StartLLDProcessors +# Number of pre-forked instances of low level discovery processors. +# +# Mandatory: no +# Range: 1-100 +# Default: +# StartLLDProcessors=2 + +### Option: AllowRoot +# Allow the server to run as 'root'. If disabled and the server is started by 'root', the server +# will try to switch to the user specified by the User configuration option instead. +# Has no effect if started under a regular user. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Default: +# AllowRoot=0 + +### Option: User +# Drop privileges to a specific, existing user on the system. +# Only has effect if run as 'root' and AllowRoot is disabled. +# +# Mandatory: no +# Default: +# User=zabbix + +### Option: Include +# You may include individual files or all files in a directory in the configuration file. +# Installing Zabbix will create include directory in /usr/local/etc, unless modified during the compile time. +# +# Mandatory: no +# Default: +# Include= + +# Include=/usr/local/etc/zabbix_server.general.conf +# Include=/usr/local/etc/zabbix_server.conf.d/ +# Include=/usr/local/etc/zabbix_server.conf.d/*.conf + +### Option: SSLCertLocation +# Location of SSL client certificates. +# This parameter is used in web monitoring and for communication with Vault. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# SSLCertLocation=${datadir}/zabbix/ssl/certs + +### Option: SSLKeyLocation +# Location of private keys for SSL client certificates. +# This parameter is used in web monitoring and for communication with Vault. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# SSLKeyLocation=${datadir}/zabbix/ssl/keys + +### Option: SSLCALocation +# Override the location of certificate authority (CA) files for SSL server certificate verification. +# If not set, system-wide directory will be used. +# This parameter is used in web monitoring, SMTP authentication, HTTP agent items and for communication with Vault. +# +# Mandatory: no +# Default: +# SSLCALocation= + +### Option: StatsAllowedIP +# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of external Zabbix instances. +# Stats request will be accepted only from the addresses listed here. If this parameter is not set no stats requests +# will be accepted. +# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally +# and '::/0' will allow any IPv4 or IPv6 address. +# '0.0.0.0/0' can be used to allow any IPv4 address. +# Example: StatsAllowedIP=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com +# +# Mandatory: no +# Default: +# StatsAllowedIP= +StatsAllowedIP=127.0.0.1 + +####### LOADABLE MODULES ####### + +### Option: LoadModulePath +# Full path to location of server modules. +# Default depends on compilation options. +# To see the default path run command "zabbix_server --help". +# +# Mandatory: no +# Default: +# LoadModulePath=${libdir}/modules + +### Option: LoadModule +# Module to load at server startup. Modules are used to extend functionality of the server. +# Formats: +# LoadModule= +# LoadModule= +# LoadModule= +# Either the module must be located in directory specified by LoadModulePath or the path must precede the module name. +# If the preceding path is absolute (starts with '/') then LoadModulePath is ignored. +# It is allowed to include multiple LoadModule parameters. +# +# Mandatory: no +# Default: +# LoadModule= + +####### TLS-RELATED PARAMETERS ####### + +### Option: TLSCAFile +# Full pathname of a file containing the top-level CA(s) certificates for +# peer certificate verification. +# +# Mandatory: no +# Default: +# TLSCAFile= + +### Option: TLSCRLFile +# Full pathname of a file containing revoked certificates. +# +# Mandatory: no +# Default: +# TLSCRLFile= + +### Option: TLSCertFile +# Full pathname of a file containing the server certificate or certificate chain. +# +# Mandatory: no +# Default: +# TLSCertFile= + +### Option: TLSKeyFile +# Full pathname of a file containing the server private key. +# +# Mandatory: no +# Default: +# TLSKeyFile= + +####### For advanced users - TLS ciphersuite selection criteria ####### + +### Option: TLSCipherCert13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# +# Mandatory: no +# Default: +# TLSCipherCert13= + +### Option: TLSCipherCert +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128 +# +# Mandatory: no +# Default: +# TLSCipherCert= + +### Option: TLSCipherPSK13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example: +# TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherPSK13= + +### Option: TLSCipherPSK +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL +# Example for OpenSSL: +# kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherPSK= + +### Option: TLSCipherAll13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example: +# TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherAll13= + +### Option: TLSCipherAll +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128:kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherAll= + +### Option: DBTLSConnect +# Setting this option enforces to use TLS connection to database. +# required - connect using TLS +# verify_ca - connect using TLS and verify certificate +# verify_full - connect using TLS, verify certificate and verify that database identity specified by DBHost +# matches its certificate +# On MySQL starting from 5.7.11 and PostgreSQL following values are supported: "required", "verify_ca" and +# "verify_full". +# On MariaDB starting from version 10.2.6 "required" and "verify_full" values are supported. +# Default is not to set any option and behavior depends on database configuration +# +# Mandatory: no +# Default: +# DBTLSConnect= + +### Option: DBTLSCAFile +# Full pathname of a file containing the top-level CA(s) certificates for database certificate verification. +# Supported only for MySQL and PostgreSQL +# +# Mandatory: no +# (yes, if DBTLSConnect set to one of: verify_ca, verify_full) +# Default: +# DBTLSCAFile= + +### Option: DBTLSCertFile +# Full pathname of file containing Zabbix server certificate for authenticating to database. +# Supported only for MySQL and PostgreSQL +# +# Mandatory: no +# Default: +# DBTLSCertFile= + +### Option: DBTLSKeyFile +# Full pathname of file containing the private key for authenticating to database. +# Supported only for MySQL and PostgreSQL +# +# Mandatory: no +# Default: +# DBTLSKeyFile= + +### Option: DBTLSCipher +# The list of encryption ciphers that Zabbix server permits for TLS protocols up through TLSv1.2 +# Supported only for MySQL +# +# Mandatory no +# Default: +# DBTLSCipher= + +### Option: DBTLSCipher13 +# The list of encryption ciphersuites that Zabbix server permits for TLSv1.3 protocol +# Supported only for MySQL, starting from version 8.0.16 +# +# Mandatory no +# Default: +# DBTLSCipher13= + +### Option: Vault +# Specifies vault: +# HashiCorp - HashiCorp KV Secrets Engine - Version 2 +# CyberArk - CyberArk Central Credential Provider +# +# Mandatory: no +# Default: +# Vault=HashiCorp + +### Option: VaultToken +# Vault authentication token that should have been generated exclusively for Zabbix server with read only permission +# to paths specified in Vault macros and read only permission to path specified in optional VaultDBPath +# configuration parameter. +# It is an error if VaultToken and VAULT_TOKEN environment variable are defined at the same time. +# +# Mandatory: no +# (yes, if Vault is explicitly set to HashiCorp) +# Default: +# VaultToken= + +### Option: VaultURL +# Vault server HTTP[S] URL. System-wide CA certificates directory will be used if SSLCALocation is not specified. +# +# Mandatory: no +# Default: +# VaultURL=https://127.0.0.1:8200 + +### Option: VaultPrefix +# Custom prefix for Vault path or query depending on the Vault. +# Most suitable defaults will be used if not specified. +# Note that 'data' is automatically appended after mountpoint for HashiCorp if VaultPrefix is not specified. +# Example prefix for HashiCorp: +# /v1/secret/data/ +# Example prefix for CyberArk: +# /AIMWebService/api/Accounts? +# Mandatory: no +# Default: +# VaultPrefix= + +### Option: VaultDBPath +# Vault path or query depending on the Vault from where credentials for database will be retrieved by keys. +# Keys used for HashiCorp are 'password' and 'username'. +# Example path: +# secret/zabbix/database +# Keys used for CyberArk are 'Content' and 'UserName'. +# Example query: +# AppID=zabbix_server&Query=Safe=passwordSafe;Object=zabbix_server_database +# This option can only be used if DBUser and DBPassword are not specified. +# +# Mandatory: no +# Default: +# VaultDBPath= + +### Option: VaultTLSCertFile +# Name of the SSL certificate file used for client authentication. The certificate file must be in PEM1 format. +# If the certificate file contains also the private key, leave the SSL key file field empty. The directory +# containing this file is specified by configuration parameter SSLCertLocation. +# +# Mandatory: no +# Default: +# VaultTLSCertFile= + +### Option: VaultTLSKeyFile +# Name of the SSL private key file used for client authentication. The private key file must be in PEM1 format. +# The directory containing this file is specified by configuration parameter SSLKeyLocation. +# +# Mandatory: no +# Default: +# VaultTLSKeyFile= + +### Option: StartReportWriters +# Number of pre-forked report writer instances. +# +# Mandatory: no +# Range: 0-100 +# Default: +# StartReportWriters=0 + +### Option: WebServiceURL +# URL to Zabbix web service, used to perform web related tasks. +# Example: http://localhost:10053/report +# +# Mandatory: no +# Default: +# WebServiceURL= + +### Option: ServiceManagerSyncFrequency +# How often Zabbix will synchronize configuration of a service manager (in seconds). +# +# Mandatory: no +# Range: 1-3600 +# Default: +# ServiceManagerSyncFrequency=60 + +### Option: ProblemHousekeepingFrequency +# How often Zabbix will delete problems for deleted triggers (in seconds). +# +# Mandatory: no +# Range: 1-3600 +# Default: +# ProblemHousekeepingFrequency=60 + +## Option: StartODBCPollers +# Number of pre-forked ODBC poller instances. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartODBCPollers=1 + +### Option: EnableGlobalScripts +# Enable global scripts on Zabbix server. +# 0 - disable +# 1 - enable +# +# Mandatory: no +# Default: +# EnableGlobalScripts=1 +EnableGlobalScripts=0 + +# Option: AllowSoftwareUpdateCheck +# Allow Zabbix UI to receive information about software updates from zabbix.com +# 0 - disable software update checks +# 1 - enable software update checks +# +# Mandatory: no +# Default: +# AllowSoftwareUpdateCheck=1 + +### Option: SMSDevices +# List of comma delimited modem files allowed to use Zabbix server +# SMS sending not possible if this parameter is not set +# Example: SMSDevices=/dev/ttyUSB0,/dev/ttyUSB1 +# +# Mandatory: no +# Default: +# SMSDevices= + +####### For advanced users - TCP-related fine-tuning parameters ####### + +## Option: ListenBacklog +# The maximum number of pending connections in the queue. This parameter is passed to +# listen() function as argument 'backlog' (see "man listen"). +# +# Mandatory: no +# Range: 0 - INT_MAX (depends on system, too large values may be silently truncated to implementation-specified maximum) +# Default: SOMAXCONN (hard-coded constant, depends on system) +# ListenBacklog= + + +####### High availability cluster parameters ####### + +## Option: HANodeName +# The high availability cluster node name. +# When empty, server is working in standalone mode; a node with empty name is registered with address for the frontend to connect to. +# +# Mandatory: no +# Default: +# HANodeName= + +## Option: NodeAddress +# IP or hostname with optional port to specify how frontend should connect to the server. +# Format:
[:] +# +# If IP or hostname is not set, then ListenIP value will be used. In case ListenIP is not set, localhost will be used. +# If port is not set, then ListenPort value will be used. In case ListenPort is not set, 10051 will be used. +# This option can be overridden by address specified in frontend configuration. +# +# Mandatory: no +# Default: +# NodeAddress=localhost:10051 + +####### Browser monitoring ####### + +### Option: WebDriverURL +# WebDriver interface HTTP[S] URL. For example http://localhost:4444 used with Selenium WebDriver standalone server. +# +# Mandatory: no +# Default: +# WebDriverURL= + +### Option: StartBrowserPollers +# Number of pre-forked instances of browser item pollers. +# +# Mandatory: no +# Range: 0-1000 +# Default: +# StartBrowserPollers=1 diff --git a/plugins/zabbix/conf/zabbix_server6.conf b/plugins/zabbix/conf/zabbix_server6.conf new file mode 100644 index 0000000000..3c20f6938a --- /dev/null +++ b/plugins/zabbix/conf/zabbix_server6.conf @@ -0,0 +1,13 @@ +LogFile=/var/log/zabbixsrv/zabbix_server.log +LogFileSize=1 +ListenPort=10051 +PidFile=/run/zabbixsrv/zabbix_server.pid + +DBHost=127.0.0.1 +DBPort={$ZABBIX_DB_PORT} +DBName=zabbix +DBUser=zabbix +DBPassword={$ZABBIX_DB_PASS} +AlertScriptsPath=/var/lib/zabbixsrv/alertscripts +ExternalScripts=/var/lib/zabbixsrv/externalscripts +TmpDir=/var/lib/zabbixsrv/tmp diff --git a/plugins/zabbix/data/server6.0.sql.gz b/plugins/zabbix/data/server6.0.sql.gz new file mode 100644 index 0000000000..32513529d9 Binary files /dev/null and b/plugins/zabbix/data/server6.0.sql.gz differ diff --git a/plugins/zabbix/data/server7.0.sql.gz b/plugins/zabbix/data/server7.0.sql.gz new file mode 100644 index 0000000000..d0118365df Binary files /dev/null and b/plugins/zabbix/data/server7.0.sql.gz differ diff --git a/plugins/zabbix/ico.png b/plugins/zabbix/ico.png new file mode 100644 index 0000000000..01024eb075 Binary files /dev/null and b/plugins/zabbix/ico.png differ diff --git a/plugins/zabbix/ico.svg b/plugins/zabbix/ico.svg new file mode 100644 index 0000000000..9425964a3f --- /dev/null +++ b/plugins/zabbix/ico.svg @@ -0,0 +1 @@ + diff --git a/plugins/zabbix/index.html b/plugins/zabbix/index.html new file mode 100755 index 0000000000..3fa1f338c0 --- /dev/null +++ b/plugins/zabbix/index.html @@ -0,0 +1,34 @@ + + +
+
+
+
+

服务

+

自启动

+

OP配置

+

PHP配置

+

ZS配置

+

ZS运行日志

+

ZA配置

+

ZA运行日志

+

相关说明

+ +
+
+
+
+
+
+ \ No newline at end of file diff --git a/plugins/zabbix/index.py b/plugins/zabbix/index.py new file mode 100755 index 0000000000..493d3d764e --- /dev/null +++ b/plugins/zabbix/index.py @@ -0,0 +1,533 @@ +# coding:utf-8 + +import sys +import io +import os +import time +import re + +sys.path.append(os.getcwd() + "/class/core") +import mw + +app_debug = False +if mw.isAppleSystem(): + app_debug = True + + +def getPluginName(): + return 'zabbix' + + +def getPluginDir(): + return mw.getPluginDir() + '/' + getPluginName() + + +def getServerDir(): + return mw.getServerDir() + '/' + getPluginName() + + +def getInitDFile(): + current_os = mw.getOs() + if current_os == 'darwin': + return '/tmp/' + getPluginName() + + if current_os.startswith('freebsd'): + return '/etc/rc.d/' + getPluginName() + + return '/etc/init.d/' + getPluginName() + + +def getConf(): + path = getServerDir() + "/web_conf/nginx/vhost/zabbix.conf" + return path + + +def getInitDTpl(): + path = getPluginDir() + "/init.d/" + getPluginName() + ".tpl" + return path + + +def getArgs(): + args = sys.argv[3:] + tmp = {} + args_len = len(args) + + if args_len == 1: + t = args[0].strip('{').strip('}') + if t.strip() == '': + tmp = [] + else: + t = t.split(':') + tmp[t[0]] = t[1] + tmp[t[0]] = t[1] + elif args_len > 1: + for i in range(len(args)): + t = args[i].split(':') + tmp[t[0]] = t[1] + return tmp + +def checkArgs(data, ck=[]): + for i in range(len(ck)): + if not ck[i] in data: + return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!')) + return (True, mw.returnJson(True, 'ok')) + +def getPidFile(): + file = getConf() + content = mw.readFile(file) + rep = 'pidfile\s*(.*)' + tmp = re.search(rep, content) + return tmp.groups()[0].strip() + +def status(): + cmd = "ps aux|grep zabbix_server |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'" + data = mw.execShell(cmd) + if data[0] == '': + return 'stop' + return 'start' + +def getInstallVerion(): + version_pl = getServerDir() + "/version.pl" + version = mw.readFile(version_pl).strip() + return version + +def contentReplace(content): + service_path = mw.getServerDir() + content = content.replace('{$ROOT_PATH}', mw.getRootDir()) + content = content.replace('{$SERVER_PATH}', service_path) + content = content.replace('{$ZABBIX_ROOT}', '/usr/share/zabbix') + content = content.replace('{$ZABBIX_PORT}', '18888') + + psdb = pSqliteDb('databases') + db_pass = psdb.where('name = ?', ('zabbix',)).getField('password') + content = content.replace('{$ZABBIX_DB_PORT}', getMySQLPort()) + content = content.replace('{$ZABBIX_DB_PASS}', db_pass) + return content + + +def getMySQLConf(): + choose_mysql = getServerDir()+'/mysql.pl' + if os.path.exists(choose_mysql): + ver = mw.readFile(choose_mysql) + return mw.getServerDir() + '/'+ver+'/etc/my.cnf' + + apt_path = mw.getServerDir() + '/mysql-apt/etc/my.cnf' + if os.path.exists(apt_path): + mw.writeFile(choose_mysql, 'mysql-apt') + return apt_path + + yum_path = mw.getServerDir() + '/mysql-yum/etc/my.cnf' + if os.path.exists(yum_path): + mw.writeFile(choose_mysql, 'mysql-yum') + return yum_path + + path = mw.getServerDir() + '/mysql/etc/my.cnf' + if os.path.exists(path): + mw.writeFile(choose_mysql, 'mysql') + return path + return path + + +def getMySQLPort(): + file = getMySQLConf() + content = mw.readFile(file) + rep = 'port\s*=\s*(.*)' + tmp = re.search(rep, content) + return tmp.groups()[0].strip() + +def getMySQLSocketFile(): + file = getMySQLConf() + content = mw.readFile(file) + rep = 'socket\s*=\s*(.*)' + tmp = re.search(rep, content) + return tmp.groups()[0].strip() + +def getMySQLBin(): + choose_mysql = getServerDir()+'/mysql.pl' + ver = mw.readFile(choose_mysql) + mysql_dir = mw.getServerDir() + '/'+ver + + if ver == 'mysql-apt': + return '/www/server/mysql-apt/bin/usr/bin/mysql' + if ver == 'mysql-yum': + return '/www/server/mysql-yum/bin/usr/bin/mysql' + return '/www/server/mysql/bin/mysql' + +def getMySQLBinLink(): + choose_mysql = getServerDir()+'/mysql.pl' + ver = mw.readFile(choose_mysql) + mysql_dir = mw.getServerDir() + '/'+ver + + if ver == 'mysql-apt': + return '/www/server/mysql-apt/bin/usr/bin/mysql -S /www/server/mysql-apt/mysql.sock' + if ver == 'mysql-yum': + return '/www/server/mysql-yum/bin/usr/bin/mysql -S /www/server/mysql-yum/mysql.sock' + return '/www/server/mysql/bin/mysql -S /www/server/mysql/mysql.sock' + +def pSqliteDb(dbname='databases'): + choose_mysql = getServerDir()+'/mysql.pl' + ver = mw.readFile(choose_mysql) + + mysql_dir = mw.getServerDir() + '/'+ver + conn = mw.M(dbname).dbPos(mysql_dir, 'mysql') + return conn + + +def pMysqlDb(): + # pymysql + db = mw.getMyORM() + db.setDbName('zabbix') + db.setPort(getMySQLPort()) + db.setSocket(getMySQLSocketFile()) + db.setPwd(pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')) + return db + + +def getInstalledPhpConfDir(): + phpver = ["80","81","82","83","84"] + php_type = ['php-apt','php-yum', 'php']; + + for pt in php_type: + for ver in phpver: + php_install_dir = mw.getServerDir() + '/'+ pt+'/'+ver + if os.path.exists(php_install_dir): + if pt == 'php-apt': + return pt + ver[0:1]+'.'+ver[1:2] + if pt == 'php': + return pt + '-' + ver + if pt == 'php-yum': + return pt + '-' + ver + return pt + ver + return 'php-80' + +def isInstalledPhp(): + phpver = ["80","81","82","83","84"] + php_type = ['php-apt','php-yum', 'php']; + + for pt in php_type: + for ver in phpver: + php_install_dir = mw.getServerDir() + '/'+ pt+'/'+ver + if os.path.exists(php_install_dir): + return True + return False + +def isInstalledMySQL(): + mysql_type = ['mysql-apt','mysql-yum', 'mysql']; + for mt in mysql_type: + mysql_install_dir = mw.getServerDir() + '/'+ mt + if os.path.exists(mysql_install_dir): + return True + return False + + +def zabbixNginxConf(): + return mw.getServerDir()+'/web_conf/nginx/vhost/zabbix.conf' + +def zabbixPhpConf(): + # ver = getInstallVerion() + # if ver == '6.0': + # return '/usr/share/zabbix/conf/zabbix.conf.php' + return '/etc/zabbix/web/zabbix.conf.php' + +def zabbixServerConf(): + ver = getInstallVerion() + if ver == '6.0': + return '/etc/zabbix_server.conf' + return '/etc/zabbix/zabbix_server.conf' + +def zabbixAgentConf(): + return '/etc/zabbix/zabbix_agentd.conf' + +def zabbixImportMySQLDataFile(): + tgz_file = getPluginDir()+"/data/server6.0.sql.gz" + ver = getInstallVerion() + if ver == '6.0': + return tgz_file + return '/usr/share/zabbix-sql-scripts/mysql/server.sql.gz' + +def zabbixImportMySQLData(): + mysql_conf = getMySQLConf() + if not os.path.exists(mysql_conf): + exit("需要安装MySQL") + + choose_mysql = getServerDir()+'/mysql.pl' + ver = mw.readFile(choose_mysql) + + pmdb = pMysqlDb() + psdb = pSqliteDb('databases') + find_ps_zabbix = psdb.field('id').where('name = ?', ('zabbix',)).select() + if len(find_ps_zabbix) < 1: + db_pass = mw.getRandomString(16) + # 创建数据 + cmd = 'python3 plugins/'+ver+'/index.py add_db {"name":"zabbix","codeing":"utf8mb4","db_user":"zabbix","password":"'+db_pass+'","dataAccess":"127.0.0.1","ps":"zabbix","address":"127.0.0.1"}' + # print(cmd) + mw.execShell(cmd) + pmdb.query("ALTER DATABASE `zabbix` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin") + pmdb.query("grant all privileges on zabbix.* to zabbix@127.0.0.1") + + + db_pass = psdb.where('name = ?', ('zabbix',)).getField('password') + find_zabbix_version = pmdb.query("show tables like 'dbversion'") + if len(find_zabbix_version) == 0: + # 初始化导入数据 + pmdb.query("set global log_bin_trust_function_creators=1") + + mysql_bin = getMySQLBinLink() + + tgz_file = zabbixImportMySQLDataFile() + # zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | /www/server/mysql/bin/mysql --default-character-set=utf8mb4 -uzabbix -p"LGhb1f7QG6SDL5CX" zabbix + import_data_cmd = 'zcat '+tgz_file+' | '+mysql_bin+' --default-character-set=utf8mb4 -uzabbix -p"'+db_pass+'" zabbix' + # print(import_data_cmd) + mw.execShell(import_data_cmd) + # pmdb.query("set global log_bin_trust_function_creators=0") + + + ver = getInstallVerion() + if ver == '6.0': + pmdb.query("update dbversion set mandatory=6000000") + + return True + +def initOpConf(): + nginx_src_tpl = getPluginDir()+'/conf/zabbix.nginx.conf' + nginx_dst_vhost = zabbixNginxConf() + + phpver = getInstalledPhpConfDir() + + # nginx配置 + if not os.path.exists(nginx_dst_vhost): + content = mw.readFile(nginx_src_tpl) + content = contentReplace(content) + content = content.replace('{$PHP_VER}',phpver) + mw.writeFile(nginx_dst_vhost, content) + +def initZsConf(): + ver = getInstallVerion() + zs_src_tpl = getPluginDir()+'/conf/zabbix_server.conf' + if ver == '6.0': + zs_src_tpl = getPluginDir()+'/conf/zabbix_server6.conf' + + zs_dst_path = zabbixServerConf() + + # zabbix_server配置 + content = mw.readFile(zs_src_tpl) + content = contentReplace(content) + mw.writeFile(zs_dst_path, content) + +def initPhpConf(): + php_src_tpl = getPluginDir()+'/conf/zabbix.conf.php' + php_dst_path = zabbixPhpConf() + # php配置 + # if not os.path.exists(php_dst_path): + content = mw.readFile(php_src_tpl) + content = contentReplace(content) + mw.writeFile(php_dst_path, content) + +def initAgentConf(): + za_src_tpl = getPluginDir()+'/conf/zabbix_agentd.conf' + za_dst_path = zabbixAgentConf() + + # zabbix_agent配置 + content = mw.readFile(za_src_tpl) + content = contentReplace(content) + mw.writeFile(za_dst_path, content) + +def openPort(): + try: + import firewall_api + firewall_api.firewall_api().addAcceptPortArgs('18888', 'zabbix-web', 'port') + firewall_api.firewall_api().addAcceptPortArgs('10051', 'zabbix-server', 'port') + firewall_api.firewall_api().addAcceptPortArgs('10050', 'zabbix-agent', 'port') + return port + except Exception as e: + return "Release failed {}".format(e) + return True + + +def initDreplace(): + # 导入MySQL配置 + zabbixImportMySQLData() + + # 初始化OP配置 + initOpConf() + + + init_file = getServerDir() + '/init.pl' + if not os.path.exists(init_file): + initZsConf() + initAgentConf() + initPhpConf() + openPort() + mw.writeFile(init_file, 'ok') + return True + + +def zOp(method): + + initDreplace() + + data = mw.execShell('systemctl ' + method + ' zabbix-server') + mw.execShell('systemctl ' + method + ' zabbix-agent') + if data[1] == '': + return 'ok' + return data[1] + + +def start(): + val = zOp('start') + mw.restartWeb() + return val + + +def stop(): + val = zOp('stop') + + # 删除nginx配置 + nginx_dst_vhost = zabbixNginxConf() + if os.path.exists(nginx_dst_vhost): + os.remove(nginx_dst_vhost) + + mw.restartWeb() + + return val + +def restart(): + status = zOp('restart') + return status + +def reload(): + initZsConf() + initAgentConf() + initPhpConf() + return zOp('reload') + +def initdStatus(): + current_os = mw.getOs() + if current_os == 'darwin': + return "Apple Computer does not support" + + shell_cmd = 'systemctl status zabbix-server | grep loaded | grep "enabled;"' + data = mw.execShell(shell_cmd) + if data[0] == '': + return 'fail' + return 'ok' + + +def initdInstall(): + current_os = mw.getOs() + if current_os == 'darwin': + return "Apple Computer does not support" + + data = mw.execShell('systemctl enable zabbix-server') + if data[1] != '': + return data[1] + return 'ok' + + +def initdUinstall(): + current_os = mw.getOs() + if current_os == 'darwin': + return "Apple Computer does not support" + + data = mw.execShell('systemctl disable zabbix-server') + if data[1] != '': + return data[1] + return 'ok' + +def runLog(): + zs_conf = zabbixServerConf() + content = mw.readFile(zs_conf) + + rep = 'LogFile=\s*(.*)' + tmp = re.search(rep, content) + + if tmp.groups(): + return tmp.groups()[0].strip() + return '/var/log/zabbix/zabbix_server.log' + +def zabbixAgentLog(): + za_conf = zabbixAgentConf() + content = mw.readFile(za_conf) + + rep = 'LogFile=\s*(.*)' + tmp = re.search(rep, content) + + if tmp.groups(): + return tmp.groups()[0].strip() + return '/var/log/zabbix/zabbix_agentd.log' + + +def installPreInspection(): + cmd = "cat /etc/*-release | grep PRETTY_NAME |awk -F = '{print $2}' | awk -F '\"' '{print $2}'| awk '{print $1}'" + sys = mw.execShell(cmd) + + + cmd = "cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F '\"' '{print $2}'" + sys_id = mw.execShell(cmd) + + sysName = sys[0].strip().lower() + sysId = sys_id[0].strip().lower() + + # opensuse + if not sysName in ['debian','centos','ubuntu','almalinux','rocky']: + return '不支持该系统' + + if sysName == 'debian' and not sysId in ['12']: + return '不支持,'+sysName+'['+sysId+'],仅支持debian12!' + + openresty_dir = mw.getServerDir() + "/openresty" + if not os.path.exists(openresty_dir): + return '需要安装Openresty插件' + + is_installed_php = isInstalledPhp() + if not is_installed_php: + return '需要安装PHP/PHP-APT/PHP-YUM插件,至少8.0!' + + + is_installed_mysql = isInstalledMySQL() + if not is_installed_mysql: + return '需要安装MySQL/MySQL-APT/MySQL-YUM插件,至少8.0!' + + return 'ok' + + +def uninstallPreInspection(): + return 'ok' + + +if __name__ == "__main__": + func = sys.argv[1] + if func == 'status': + print(status()) + elif func == 'start': + print(start()) + elif func == 'stop': + print(stop()) + elif func == 'restart': + print(restart()) + elif func == 'reload': + print(reload()) + elif func == 'initd_status': + print(initdStatus()) + elif func == 'initd_install': + print(initdInstall()) + elif func == 'initd_uninstall': + print(initdUinstall()) + elif func == 'install_pre_inspection': + print(installPreInspection()) + elif func == 'uninstall_pre_inspection': + print(uninstallPreInspection()) + elif func == 'conf': + print(zabbixNginxConf()) + elif func == 'php_conf': + print(zabbixPhpConf()) + elif func == 'zabbix_server_conf': + print(zabbixServerConf()) + elif func == 'zabbix_agent_conf': + print(zabbixAgentConf()) + elif func == 'run_log': + print(runLog()) + elif func == 'zabbix_agent_log': + print(zabbixAgentLog()) + else: + print('error') diff --git a/plugins/zabbix/info.json b/plugins/zabbix/info.json new file mode 100755 index 0000000000..c77a1334b9 --- /dev/null +++ b/plugins/zabbix/info.json @@ -0,0 +1,19 @@ +{ + "sort": 7, + "ps": "Zabbix是一个成熟、易用的企业级开源监控解决方案,适用于百万级指标的网络监控和应用监控[开发中]", + "name": "zabbix", + "title": "Zabbix", + "shell": "install.sh", + "versions":["6.0","7.0"], + "tip": "soft", + "install_pre_inspection":true, + "uninstall_pre_inspection":true, + "checks": "server/zabbix", + "path": "server/zabbix", + "display": 1, + "author": "midoks", + "date": "2022-07-14", + "home": "https://www.zabbix.com/", + "type": 0, + "pid": "5" +} diff --git a/plugins/zabbix/install.sh b/plugins/zabbix/install.sh new file mode 100755 index 0000000000..a49c4689f7 --- /dev/null +++ b/plugins/zabbix/install.sh @@ -0,0 +1,86 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH + +# https://www.zabbix.com + +# cd /www/server/mdserver-web/plugins/zabbix && /bin/bash install.sh install 7.0 +# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/zabbix/index.py start + + + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") + +install_tmp=${rootPath}/tmp/mw_install.pl +VERSION=$2 + +sysName=`uname` +echo "use system: ${sysName}" + +OSNAME=`bash ${rootPath}/scripts/getos.sh` + +if [ "" == "$OSNAME" ];then + OSNAME=`cat ${rootPath}/data/osname.pl` +fi + +if [ "macos" == "$OSNAME" ];then + echo "不支持Macox" + exit +fi + +if [ -f ${rootPath}/bin/activate ];then + source ${rootPath}/bin/activate +fi + +Install_App() +{ + echo '正在安装脚本文件...' + mkdir -p $serverPath/source/zabbix + + mkdir -p $serverPath/zabbix + echo "${VERSION}" > $serverPath/zabbix/version.pl + + shell_file=${curPath}/versions/${VERSION}/${OSNAME}.sh + + if [ -f $shell_file ];then + bash -x $shell_file install + else + echo '不支持...' + exit 1 + fi + + #初始化 + cd ${rootPath} && python3 ${rootPath}/plugins/zabbix/index.py start + cd ${rootPath} && python3 ${rootPath}/plugins/zabbix/index.py initd_install + + + if [ -d /etc/zabbix/web ];then + chown -R www:www /etc/zabbix/web + fi + echo 'Zabbix安装完成' +} + +Uninstall_App() +{ + shell_file=${curPath}/versions/${VERSION}/${OSNAME}.sh + if [ -f $shell_file ];then + bash -x $shell_file uninstall + fi + + cd ${rootPath} && python3 ${rootPath}/plugins/zabbix/index.py stop + cd ${rootPath} && python3 ${rootPath}/plugins/zabbix/index.py initd_uninstall + + rm -rf $serverPath/zabbix + rm -rf $serverPath/source/zabbix + echo 'Zabbix卸载完成' +} + +action=$1 +if [ "${1}" == 'install' ];then + Install_App +else + Uninstall_App +fi diff --git a/plugins/zabbix/js/zabbix.js b/plugins/zabbix/js/zabbix.js new file mode 100755 index 0000000000..da1d95bc2f --- /dev/null +++ b/plugins/zabbix/js/zabbix.js @@ -0,0 +1,66 @@ +function zabbixPost(method, version, args,callback){ + var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); + + var req_data = {}; + req_data['name'] = 'zabbix'; + req_data['func'] = method; + req_data['version'] = version; + + if (typeof(args) == 'string'){ + req_data['args'] = JSON.stringify(toArrayObject(args)); + } else { + req_data['args'] = JSON.stringify(args); + } + + $.post('/plugins/run', req_data, function(data) { + layer.close(loadT); + if (!data.status){ + //错误展示10S + layer.msg(data.msg,{icon:0,time:2000,shade: [10, '#000']}); + return; + } + + if(typeof(callback) == 'function'){ + callback(data); + } + },'json'); +} + +function zabbixPostCallbak(method, version, args,callback){ + var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); + + var req_data = {}; + req_data['name'] = 'zabbix'; + req_data['func'] = method; + args['version'] = version; + + if (typeof(args) == 'string'){ + req_data['args'] = JSON.stringify(toArrayObject(args)); + } else { + req_data['args'] = JSON.stringify(args); + } + + $.post('/plugins/callback', req_data, function(data) { + layer.close(loadT); + if (!data.status){ + layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']}); + return; + } + + if(typeof(callback) == 'function'){ + callback(data); + } + },'json'); +} + + +function zabbixReadme(){ + var readme = '
    '; + readme += '
  • 默认配置OpenResty端口:18888
  • '; + readme += '
  • 初始化账户:Admin/zabbix
  • '; + readme += '
  • https://www.zabbix.com/download
  • '; + readme += '
'; + + $('.soft-man-con').html(readme); +} + diff --git a/plugins/zabbix/versions/6.0/alma.sh b/plugins/zabbix/versions/6.0/alma.sh new file mode 100644 index 0000000000..5858a76d3f --- /dev/null +++ b/plugins/zabbix/versions/6.0/alma.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() +{ + yum install -y glibc-langpack-zh + + mkdir -p $serverPath/source/zabbix + + ZABBIX_NAME=zabbix-release-6.0-5.el${SYS_VERSION_ID:0:1}.noarch.rpm + + rpm -Uvh https://repo.zabbix.com/zabbix/6.0/alma/${SYS_VERSION_ID:0:1}/x86_64/${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 +} + +Uninstall_App() +{ + dnf remove -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy + dnf install -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/centos.sh b/plugins/zabbix/versions/6.0/centos.sh new file mode 100644 index 0000000000..562d58e704 --- /dev/null +++ b/plugins/zabbix/versions/6.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() +{ + yum install -y glibc-langpack-zh + + mkdir -p $serverPath/source/zabbix + + ZABBIX_NAME=zabbix-release-6.0-5.el${SYS_VERSION_ID}.noarch.rpm + + rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/${SYS_VERSION_ID}/x86_64/${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 +} + +Uninstall_App() +{ + dnf remove -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy 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/debian.sh b/plugins/zabbix/versions/6.0/debian.sh new file mode 100644 index 0000000000..d5b2b49478 --- /dev/null +++ b/plugins/zabbix/versions/6.0/debian.sh @@ -0,0 +1,48 @@ +#!/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_6.0-5+debian${SYS_VERSION_ID}_all.deb + echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/6.0/debian/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/6.0/debian/pool/main/z/zabbix-release/${ZABBIX_NAME} + fi + + dpkg --configure -a + cd $serverPath/source/zabbix && dpkg -i ${ZABBIX_NAME} + apt update -y + rm -rf /etc/zabbix/zabbix_server.conf.dpkg-new + rm -rf /etc/zabbix/zabbix_server.conf + apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-sql-scripts zabbix-agent zabbix-get +} + +Uninstall_App() +{ + apt remove -y zabbix-server-mysql zabbix-frontend-php zabbix-sql-scripts zabbix-agent zabbix-get + 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/6.0/opensuse.sh b/plugins/zabbix/versions/6.0/opensuse.sh new file mode 100644 index 0000000000..748fc705dd --- /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/rocky.sh b/plugins/zabbix/versions/6.0/rocky.sh new file mode 100644 index 0000000000..2b3348512e --- /dev/null +++ b/plugins/zabbix/versions/6.0/rocky.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() +{ + yum install -y glibc-langpack-zh + + mkdir -p $serverPath/source/zabbix + + ZABBIX_NAME=zabbix-release-6.0-5.el${SYS_VERSION_ID:0:1}.noarch.rpm + + rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rocky/${SYS_VERSION_ID:0:1}/x86_64/${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 +} + +Uninstall_App() +{ + dnf remove -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy + dnf install -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 0000000000..16458b4b76 --- /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 new file mode 100644 index 0000000000..dd1cc523c4 --- /dev/null +++ b/plugins/zabbix/versions/7.0/alma.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() +{ + yum install -y glibc-langpack-zh + + mkdir -p $serverPath/source/zabbix + + ZABBIX_NAME=zabbix-release-7.0-4.el${SYS_VERSION_ID:0:1}.noarch.rpm + + 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} + dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy + dnf install -y zabbix-agent +} + +Uninstall_App() +{ + dnf remove -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy + dnf install -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/7.0/centos.sh b/plugins/zabbix/versions/7.0/centos.sh new file mode 100644 index 0000000000..db9c4a3b04 --- /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() +{ + yum install -y glibc-langpack-zh + + 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_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 +} + +Uninstall_App() +{ + dnf remove -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy 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/7.0/debian.sh b/plugins/zabbix/versions/7.0/debian.sh new file mode 100644 index 0000000000..bac75fe590 --- /dev/null +++ b/plugins/zabbix/versions/7.0/debian.sh @@ -0,0 +1,52 @@ +#!/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-2+debian${SYS_VERSION_ID}_all.deb + echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/debian/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/debian/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/opensuse.sh b/plugins/zabbix/versions/7.0/opensuse.sh new file mode 100644 index 0000000000..805f6419cf --- /dev/null +++ b/plugins/zabbix/versions/7.0/opensuse.sh @@ -0,0 +1,60 @@ +#!/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-7.0-2.sles${SYS_VERSION_ID:0:2}.noarch.rpm + + rpm -Uvh https://repo.zabbix.com/zabbix/7.0/sles/${SYS_VERSION_ID:0:2}/x86_64/${ZABBIX_NAME} + echo "rpm -Uvh https://repo.zabbix.com/zabbix/7.0/sles/${SYS_VERSION_ID:0:2}/x86_64/${ZABBIX_NAME}" + + + # debug + # symbol lookup error: /usr/sbin/zabbix_server: undefined symbol: usmAES256CiscoPrivProtocol + # /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf + + # zypper update -y net-snmp + # zypper update -y net-snmp-utils + # zypper install -y net-snmp-devel + + zypper install -y zabbix-server-mysql + zypper install -y zabbix-web-mysql + zypper install -y zabbix-sql-scripts + zypper install -y zabbix-agent +} + +Uninstall_App() +{ + zypper remove -y zabbix-server-mysql + zypper remove -y zabbix-web-mysql + zypper remove -y zabbix-sql-scripts + 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/7.0/rocky.sh b/plugins/zabbix/versions/7.0/rocky.sh new file mode 100644 index 0000000000..8bc6c05a9b --- /dev/null +++ b/plugins/zabbix/versions/7.0/rocky.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() +{ + yum install -y glibc-langpack-zh + + mkdir -p $serverPath/source/zabbix + + ZABBIX_NAME=zabbix-release-7.0-4.el${SYS_VERSION_ID:0:1}.noarch.rpm + + 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} + dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy + dnf install -y zabbix-agent +} + +Uninstall_App() +{ + dnf remove -y zabbix-server-mysql zabbix-web-mysql zabbix-sql-scripts zabbix-selinux-policy + dnf install -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/7.0/ubuntu.sh b/plugins/zabbix/versions/7.0/ubuntu.sh new file mode 100644 index 0000000000..16458b4b76 --- /dev/null +++ b/plugins/zabbix/versions/7.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_agent/conf/zabbix_agentd.conf b/plugins/zabbix_agent/conf/zabbix_agentd.conf new file mode 100644 index 0000000000..9ffe32e8bf --- /dev/null +++ b/plugins/zabbix_agent/conf/zabbix_agentd.conf @@ -0,0 +1,18 @@ +PidFile=/run/zabbix/zabbix_agentd.pid +LogFile=/var/log/zabbix/zabbix_agentd.log +LogFileSize=1 + +ListenIP=0.0.0.0 +ListenPort=10050 +EnableRemoteCommands=1 +Timeout=3 + +Server=127.0.0.1 +ServerActive=127.0.0.1 + +Hostname=Zabbix server +Include=/etc/zabbix/zabbix_agentd.d/*.conf + +# Include=/usr/local/etc/zabbix_agentd.userparams.conf +# Include=/usr/local/etc/zabbix_agentd.conf.d/ +# Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf diff --git a/plugins/zabbix_agent/conf/zabbix_agentd.conf.bak b/plugins/zabbix_agent/conf/zabbix_agentd.conf.bak new file mode 100644 index 0000000000..b81c79ba6c --- /dev/null +++ b/plugins/zabbix_agent/conf/zabbix_agentd.conf.bak @@ -0,0 +1,554 @@ +# This is a configuration file for Zabbix agent daemon (Unix) +# To get more information about Zabbix, visit https://www.zabbix.com + +############ GENERAL PARAMETERS ################# + +### Option: PidFile +# Name of PID file. +# +# Mandatory: no +# Default: +# PidFile=/tmp/zabbix_agentd.pid + +PidFile=/run/zabbix/zabbix_agentd.pid + +### Option: LogType +# Specifies where log messages are written to: +# system - syslog +# file - file specified with LogFile parameter +# console - standard output +# +# Mandatory: no +# Default: +# LogType=file + +### Option: LogFile +# Log file name for LogType 'file' parameter. +# +# Mandatory: yes, if LogType is set to file, otherwise no +# Default: +# LogFile= + +LogFile=/var/log/zabbix/zabbix_agentd.log + +### Option: LogFileSize +# Maximum size of log file in MB. +# 0 - disable automatic log rotation. +# +# Mandatory: no +# Range: 0-1024 +# Default: +# LogFileSize=1 + +LogFileSize=0 + +### Option: DebugLevel +# Specifies debug level: +# 0 - basic information about starting and stopping of Zabbix processes +# 1 - critical information +# 2 - error information +# 3 - warnings +# 4 - for debugging (produces lots of information) +# 5 - extended debugging (produces even more information) +# +# Mandatory: no +# Range: 0-5 +# Default: +# DebugLevel=3 + +### Option: SourceIP +# Source IP address for outgoing connections. +# +# Mandatory: no +# Default: +# SourceIP= + +### Option: AllowKey +# Allow execution of item keys matching pattern. +# Multiple keys matching rules may be defined in combination with DenyKey. +# Key pattern is wildcard expression, which support "*" character to match any number of any characters in certain position. It might be used in both key name and key arguments. +# Parameters are processed one by one according their appearance order. +# If no AllowKey or DenyKey rules defined, all keys are allowed. +# +# Mandatory: no + +### Option: DenyKey +# Deny execution of items keys matching pattern. +# Multiple keys matching rules may be defined in combination with AllowKey. +# Key pattern is wildcard expression, which support "*" character to match any number of any characters in certain position. It might be used in both key name and key arguments. +# Parameters are processed one by one according their appearance order. +# If no AllowKey or DenyKey rules defined, all keys are allowed. +# Unless another system.run[*] rule is specified DenyKey=system.run[*] is added by default. +# +# Mandatory: no +# Default: +# DenyKey=system.run[*] + +### Option: EnableRemoteCommands - Deprecated, use AllowKey=system.run[*] or DenyKey=system.run[*] instead +# Internal alias for AllowKey/DenyKey parameters depending on value: +# 0 - DenyKey=system.run[*] +# 1 - AllowKey=system.run[*] +# +# Mandatory: no + +### Option: LogRemoteCommands +# Enable logging of executed shell commands as warnings. +# 0 - disabled +# 1 - enabled +# +# Mandatory: no +# Default: +# LogRemoteCommands=0 + +##### Passive checks related + +### Option: Server +# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies. +# Incoming connections will be accepted only from the hosts listed here. +# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally +# and '::/0' will allow any IPv4 or IPv6 address. +# '0.0.0.0/0' can be used to allow any IPv4 address. +# Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com +# +# Mandatory: yes, if StartAgents is not explicitly set to 0 +# Default: +# Server= + +Server=127.0.0.1 + +### Option: ListenPort +# Agent will listen on this port for connections from the server. +# +# Mandatory: no +# Range: 1024-32767 +# Default: +# ListenPort=10050 + +### Option: ListenIP +# List of comma delimited IP addresses that the agent should listen on. +# First IP address is sent to Zabbix server if connecting to it to retrieve list of active checks. +# +# Mandatory: no +# Default: +# ListenIP=0.0.0.0 + +### Option: StartAgents +# Number of pre-forked instances of zabbix_agentd that process passive checks. +# If set to 0, disables passive checks and the agent will not listen on any TCP port. +# +# Mandatory: no +# Range: 0-100 +# Default: +# StartAgents=10 + +##### Active checks related + +### Option: ServerActive +# Zabbix server/proxy address or cluster configuration to get active checks from. +# Server/proxy address is IP address or DNS name and optional port separated by colon. +# Cluster configuration is one or more server addresses separated by semicolon. +# Multiple Zabbix servers/clusters and Zabbix proxies can be specified, separated by comma. +# More than one Zabbix proxy should not be specified from each Zabbix server/cluster. +# If Zabbix proxy is specified then Zabbix server/cluster for that proxy should not be specified. +# Multiple comma-delimited addresses can be provided to use several independent Zabbix servers in parallel. Spaces are allowed. +# If port is not specified, default port is used. +# IPv6 addresses must be enclosed in square brackets if port for that host is specified. +# If port is not specified, square brackets for IPv6 addresses are optional. +# If this parameter is not specified, active checks are disabled. +# Example for Zabbix proxy: +# ServerActive=127.0.0.1:10051 +# Example for multiple servers: +# ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1] +# Example for high availability: +# ServerActive=zabbix.cluster.node1;zabbix.cluster.node2:20051;zabbix.cluster.node3 +# Example for high availability with two clusters and one server: +# ServerActive=zabbix.cluster.node1;zabbix.cluster.node2:20051,zabbix.cluster2.node1;zabbix.cluster2.node2,zabbix.domain +# +# Mandatory: no +# Default: +# ServerActive= + +ServerActive=127.0.0.1 + +### Option: Hostname +# List of comma delimited unique, case sensitive hostnames. +# Required for active checks and must match hostnames as configured on the server. +# Value is acquired from HostnameItem if undefined. +# +# Mandatory: no +# Default: +# Hostname= + +Hostname=Zabbix server + +### Option: HostnameItem +# Item used for generating Hostname if it is undefined. Ignored if Hostname is defined. +# Does not support UserParameters or aliases. +# +# Mandatory: no +# Default: +# HostnameItem=system.hostname + +### Option: HostMetadata +# Optional parameter that defines host metadata. +# Host metadata is used at host auto-registration process. +# An agent will issue an error and not start if the value is over limit of 2034 bytes. +# If not defined, value will be acquired from HostMetadataItem. +# +# Mandatory: no +# Range: 0-2034 bytes +# Default: +# HostMetadata= + +### Option: HostMetadataItem +# Optional parameter that defines an item used for getting host metadata. +# Host metadata is used at host auto-registration process. +# During an auto-registration request an agent will log a warning message if +# the value returned by specified item is over limit of 65535 characters. +# This option is only used when HostMetadata is not defined. +# +# Mandatory: no +# Default: +# HostMetadataItem= + +### Option: HostInterface +# Optional parameter that defines host interface. +# Host interface is used at host auto-registration process. +# An agent will issue an error and not start if the value is over limit of 255 characters. +# If not defined, value will be acquired from HostInterfaceItem. +# +# Mandatory: no +# Range: 0-255 characters +# Default: +# HostInterface= + +### Option: HostInterfaceItem +# Optional parameter that defines an item used for getting host interface. +# Host interface is used at host auto-registration process. +# During an auto-registration request an agent will log a warning message if +# the value returned by specified item is over limit of 255 characters. +# This option is only used when HostInterface is not defined. +# +# Mandatory: no +# Default: +# HostInterfaceItem= + +### Option: RefreshActiveChecks +# How often list of active checks is refreshed, in seconds. +# +# Mandatory: no +# Range: 1-86400 +# Default: +# RefreshActiveChecks=5 + +### Option: BufferSend +# Do not keep data longer than N seconds in buffer. +# +# Mandatory: no +# Range: 1-3600 +# Default: +# BufferSend=5 + +### Option: BufferSize +# Maximum number of values in a memory buffer. The agent will send +# all collected data to Zabbix Server or Proxy if the buffer is full. +# +# Mandatory: no +# Range: 2-65535 +# Default: +# BufferSize=100 + +### Option: MaxLinesPerSecond +# Maximum number of new lines the agent will send per second to Zabbix Server +# or Proxy processing 'log' and 'logrt' active checks. +# The provided value will be overridden by the parameter 'maxlines', +# provided in 'log' or 'logrt' item keys. +# +# Mandatory: no +# Range: 1-1000 +# Default: +# MaxLinesPerSecond=20 + +### Option: HeartbeatFrequency +# Frequency of heartbeat messages in seconds. +# Used for monitoring availability of active checks. +# 0 - heartbeat messages disabled. +# +# Mandatory: no +# Range: 0-3600 +# Default: 60 +# HeartbeatFrequency= + +############ ADVANCED PARAMETERS ################# + +### Option: Alias +# Sets an alias for an item key. It can be used to substitute long and complex item key with a smaller and simpler one. +# Multiple Alias parameters may be present. Multiple parameters with the same Alias key are not allowed. +# Different Alias keys may reference the same item key. +# For example, to retrieve the ID of user 'zabbix': +# Alias=zabbix.userid:vfs.file.regexp[/etc/passwd,^zabbix:.:([0-9]+),,,,\1] +# Now shorthand key zabbix.userid may be used to retrieve data. +# Aliases can be used in HostMetadataItem but not in HostnameItem parameters. +# +# Mandatory: no +# Range: +# Default: + +### Option: Timeout +# Specifies timeout for communications (in seconds). +# +# Mandatory: no +# Range: 1-30 +# Default: +# Timeout=3 + +### Option: AllowRoot +# Allow the agent to run as 'root'. If disabled and the agent is started by 'root', the agent +# will try to switch to the user specified by the User configuration option instead. +# Has no effect if started under a regular user. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Default: +# AllowRoot=0 + +### Option: User +# Drop privileges to a specific, existing user on the system. +# Only has effect if run as 'root' and AllowRoot is disabled. +# +# Mandatory: no +# Default: +# User=zabbix +# NOTE: This option is overriden by settings in systemd service file! + +### Option: Include +# You may include individual files or all files in a directory in the configuration file. +# Installing Zabbix will create include directory in /usr/local/etc, unless modified during the compile time. +# +# Mandatory: no +# Default: +# Include= + +Include=/etc/zabbix/zabbix_agentd.d/*.conf + +# Include=/usr/local/etc/zabbix_agentd.userparams.conf +# Include=/usr/local/etc/zabbix_agentd.conf.d/ +# Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf + +####### USER-DEFINED MONITORED PARAMETERS ####### + +### Option: UnsafeUserParameters +# Allow all characters to be passed in arguments to user-defined parameters. +# The following characters are not allowed: +# \ ' " ` * ? [ ] { } ~ $ ! & ; ( ) < > | # @ +# Additionally, newline characters are not allowed. +# 0 - do not allow +# 1 - allow +# +# Mandatory: no +# Range: 0-1 +# Default: +# UnsafeUserParameters=0 + +### Option: UserParameter +# User-defined parameter to monitor. There can be several user-defined parameters. +# Format: UserParameter=, +# See 'zabbix_agentd' directory for examples. +# +# Mandatory: no +# Default: +# UserParameter= + +### Option: UserParameterDir +# Directory to execute UserParameter commands from. Only one entry is allowed. +# When executing UserParameter commands the agent will change the working directory to the one +# specified in the UserParameterDir option. +# This way UserParameter commands can be specified using the relative ./ prefix. +# +# Mandatory: no +# Default: +# UserParameterDir= + +####### LOADABLE MODULES ####### + +### Option: LoadModulePath +# Full path to location of agent modules. +# Default depends on compilation options. +# To see the default path run command "zabbix_agentd --help". +# +# Mandatory: no +# Default: +# LoadModulePath=${libdir}/modules + +### Option: LoadModule +# Module to load at agent startup. Modules are used to extend functionality of the agent. +# Formats: +# LoadModule= +# LoadModule= +# LoadModule= +# Either the module must be located in directory specified by LoadModulePath or the path must precede the module name. +# If the preceding path is absolute (starts with '/') then LoadModulePath is ignored. +# It is allowed to include multiple LoadModule parameters. +# +# Mandatory: no +# Default: +# LoadModule= + +####### TLS-RELATED PARAMETERS ####### + +### Option: TLSConnect +# How the agent should connect to server or proxy. Used for active checks. +# Only one value can be specified: +# unencrypted - connect without encryption +# psk - connect using TLS and a pre-shared key +# cert - connect using TLS and a certificate +# +# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection) +# Default: +# TLSConnect=unencrypted + +### Option: TLSAccept +# What incoming connections to accept. +# Multiple values can be specified, separated by comma: +# unencrypted - accept connections without encryption +# psk - accept connections secured with TLS and a pre-shared key +# cert - accept connections secured with TLS and a certificate +# +# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection) +# Default: +# TLSAccept=unencrypted + +### Option: TLSCAFile +# Full pathname of a file containing the top-level CA(s) certificates for +# peer certificate verification. +# +# Mandatory: no +# Default: +# TLSCAFile= + +### Option: TLSCRLFile +# Full pathname of a file containing revoked certificates. +# +# Mandatory: no +# Default: +# TLSCRLFile= + +### Option: TLSServerCertIssuer +# Allowed server certificate issuer. +# +# Mandatory: no +# Default: +# TLSServerCertIssuer= + +### Option: TLSServerCertSubject +# Allowed server certificate subject. +# +# Mandatory: no +# Default: +# TLSServerCertSubject= + +### Option: TLSCertFile +# Full pathname of a file containing the agent certificate or certificate chain. +# +# Mandatory: no +# Default: +# TLSCertFile= + +### Option: TLSKeyFile +# Full pathname of a file containing the agent private key. +# +# Mandatory: no +# Default: +# TLSKeyFile= + +### Option: TLSPSKIdentity +# Unique, case sensitive string used to identify the pre-shared key. +# +# Mandatory: no +# Default: +# TLSPSKIdentity= + +### Option: TLSPSKFile +# Full pathname of a file containing the pre-shared key. +# +# Mandatory: no +# Default: +# TLSPSKFile= + +####### For advanced users - TLS ciphersuite selection criteria ####### + +### Option: TLSCipherCert13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# +# Mandatory: no +# Default: +# TLSCipherCert13= + +### Option: TLSCipherCert +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128 +# +# Mandatory: no +# Default: +# TLSCipherCert= + +### Option: TLSCipherPSK13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example: +# TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherPSK13= + +### Option: TLSCipherPSK +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL +# Example for OpenSSL: +# kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherPSK= + +### Option: TLSCipherAll13 +# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example: +# TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 +# +# Mandatory: no +# Default: +# TLSCipherAll13= + +### Option: TLSCipherAll +# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string. +# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption. +# Example for GnuTLS: +# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509 +# Example for OpenSSL: +# EECDH+aRSA+AES128:RSA+aRSA+AES128:kECDHEPSK+AES128:kPSK+AES128 +# +# Mandatory: no +# Default: +# TLSCipherAll= + +####### For advanced users - TCP-related fine-tuning parameters ####### + +## Option: ListenBacklog +# The maximum number of pending connections in the queue. This parameter is passed to +# listen() function as argument 'backlog' (see "man listen"). +# +# Mandatory: no +# Range: 0 - INT_MAX (depends on system, too large values may be silently truncated to implementation-specified maximum) +# Default: SOMAXCONN (hard-coded constant, depends on system) +# ListenBacklog= diff --git a/plugins/zabbix_agent/conf/zabbix_agentd/userparameter_examples.conf b/plugins/zabbix_agent/conf/zabbix_agentd/userparameter_examples.conf new file mode 100644 index 0000000000..5c0aea9872 --- /dev/null +++ b/plugins/zabbix_agent/conf/zabbix_agentd/userparameter_examples.conf @@ -0,0 +1,27 @@ +# Emulating built-in agent parameter 'system.users.num' +UserParameter=system.test,who | wc -l + +# Get size of a directory +# Defaults to /tmp +UserParameter=vfs.dir.size[*],dir="$1"; du -s -B 1 "${dir:-/tmp}" | cut -f1 + +# Total CPU utilisation by all processes with a given name. +# Returns empty value if no such processes are present, numeric items will turn unsupported +# Defaults to zabbix_agentd +UserParameter=proc.cpu[*],proc="$1"; ps -o pcpu= -C "${proc:-zabbix_agentd}" | awk '{sum += $$1} END {print sum}' + +# Mail queue length from mailq +UserParameter=unix_mail.queue,mailq | grep -v "Mail queue is empty" | grep -c '^[0-9A-Z]' + +# Partition discovery on Linux +UserParameter=vfs.partitions.discovery.linux,for partition in $(awk 'NR > 2 {print $4}' /proc/partitions); do partitionlist="$partitionlist,"'{"{#PARTITION}":"'$partition'"}'; done; echo '{"data":['${partitionlist#,}']}' + +# Partition discovery on Solaris (using iostat output) +# On Solaris bash usually is not the one linked from /bin/sh, so a wrapper script is suggested +UserParameter=vfs.partitions.discovery.solaris,/somewhere/solaris_partitions.sh +# Wrapper script (solaris_partitions.sh) contents: +##!/bin/bash +#for partition in $(iostat -x | tail +3 | awk '{print $1}'); do +# partitionlist="$partitionlist,"'{"{#PARTITION}":"'$partition'"}' +#done +#echo '{"data":['${partitionlist#,}']}' diff --git a/plugins/zabbix_agent/conf/zabbix_agentd/userparameter_mysql.conf b/plugins/zabbix_agent/conf/zabbix_agentd/userparameter_mysql.conf new file mode 100644 index 0000000000..2d6430e29a --- /dev/null +++ b/plugins/zabbix_agent/conf/zabbix_agentd/userparameter_mysql.conf @@ -0,0 +1,15 @@ +#template_db_mysql.conf created by Zabbix for "Template DB MySQL" and Zabbix 4.2 +#For OS Linux: You need create .my.cnf in zabbix-agent home directory (/var/lib/zabbix by default) +#For OS Windows: You need add PATH to mysql and mysqladmin and create my.cnf in %WINDIR%\my.cnf,C:\my.cnf,BASEDIR\my.cnf https://dev.mysql.com/doc/refman/5.7/en/option-files.html +#The file must have three strings: +#[client] +#user=zbx_monitor +#password= +# +UserParameter=mysql.ping[*], mysqladmin -h"$1" -P"$2" ping +UserParameter=mysql.get_status_variables[*], mysql -h"$1" -P"$2" -sNX -e "show global status" +UserParameter=mysql.version[*], mysqladmin -s -h"$1" -P"$2" version +UserParameter=mysql.db.discovery[*], mysql -h"$1" -P"$2" -sN -e "show databases" +UserParameter=mysql.dbsize[*], mysql -h"$1" -P"$2" -sN -e "SELECT SUM(DATA_LENGTH + INDEX_LENGTH) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='$3'" +UserParameter=mysql.replication.discovery[*], mysql -h"$1" -P"$2" -sNX -e "show slave status" +UserParameter=mysql.slave_status[*], mysql -h"$1" -P"$2" -sNX -e "show slave status" diff --git a/plugins/zabbix_agent/ico.png b/plugins/zabbix_agent/ico.png new file mode 100644 index 0000000000..01024eb075 Binary files /dev/null and b/plugins/zabbix_agent/ico.png differ diff --git a/plugins/zabbix_agent/index.html b/plugins/zabbix_agent/index.html new file mode 100755 index 0000000000..6b1847c4ae --- /dev/null +++ b/plugins/zabbix_agent/index.html @@ -0,0 +1,30 @@ + + +
+
+
+
+

服务

+

自启动

+

默认配置

+

运行日志

+

相关说明

+ +
+
+
+
+
+
+ \ No newline at end of file diff --git a/plugins/zabbix_agent/index.py b/plugins/zabbix_agent/index.py new file mode 100755 index 0000000000..01c05abd7c --- /dev/null +++ b/plugins/zabbix_agent/index.py @@ -0,0 +1,222 @@ +# coding:utf-8 + +import sys +import io +import os +import time +import re + +sys.path.append(os.getcwd() + "/class/core") +import mw + +app_debug = False +if mw.isAppleSystem(): + app_debug = True + + +def getPluginName(): + return 'zabbix_agent' + + +def getPluginDir(): + return mw.getPluginDir() + '/' + getPluginName() + + +def getServerDir(): + return mw.getServerDir() + '/' + getPluginName() + + +def getInitDFile(): + current_os = mw.getOs() + if current_os == 'darwin': + return '/tmp/' + getPluginName() + return '/etc/init.d/' + getPluginName() + + +def getInitDTpl(): + path = getPluginDir() + "/init.d/" + getPluginName() + ".tpl" + return path + + +def getArgs(): + args = sys.argv[3:] + tmp = {} + args_len = len(args) + + if args_len == 1: + t = args[0].strip('{').strip('}') + if t.strip() == '': + tmp = [] + else: + t = t.split(':') + tmp[t[0]] = t[1] + tmp[t[0]] = t[1] + elif args_len > 1: + for i in range(len(args)): + t = args[i].split(':') + tmp[t[0]] = t[1] + return tmp + +def checkArgs(data, ck=[]): + for i in range(len(ck)): + if not ck[i] in data: + return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!')) + return (True, mw.returnJson(True, 'ok')) + +def getPidFile(): + file = getConf() + content = mw.readFile(file) + rep = 'pidfile\s*(.*)' + tmp = re.search(rep, content) + return tmp.groups()[0].strip() + +def status(): + cmd = "ps aux|grep zabbix_agentd |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'" + data = mw.execShell(cmd) + if data[0] == '': + return 'stop' + return 'start' + +def contentReplace(content): + service_path = mw.getServerDir() + content = content.replace('{$ROOT_PATH}', mw.getRootDir()) + content = content.replace('{$SERVER_PATH}', service_path) + return content + +def zabbixAgentConf(): + return '/etc/zabbix/zabbix_agentd.conf' + +def runLog(): + za_conf = zabbixAgentConf() + content = mw.readFile(za_conf) + + rep = 'LogFile=\s*(.*)' + tmp = re.search(rep, content) + + if tmp.groups() == 0: + return tmp.groups()[0].strip() + return '/var/log/zabbix/zabbix_agentd.log' + +def initAgentConf(): + za_src_tpl = getPluginDir()+'/conf/zabbix_agentd.conf' + za_dst_path = zabbixAgentConf() + + # zabbix_agent配置 + content = mw.readFile(za_src_tpl) + content = contentReplace(content) + mw.writeFile(za_dst_path, content) + +def initDreplace(): + init_file = getServerDir() + '/init.pl' + if not os.path.exists(init_file): + initAgentConf() + openPort() + mw.writeFile(init_file, 'ok') + return True + +def openPort(): + try: + import firewall_api + firewall_api.firewall_api().addAcceptPortArgs('10050', 'zabbix-agent', 'port') + return port + except Exception as e: + return "Release failed {}".format(e) + return True + +def zOp(method): + + initDreplace() + + data = mw.execShell('systemctl ' + method + ' zabbix-agent') + if data[1] == '': + return 'ok' + return data[1] + + +def start(): + + return zOp('start') + + +def stop(): + val = zOp('stop') + return val + +def restart(): + status = zOp('restart') + return status + +def reload(): + return zOp('reload') + +def initdStatus(): + current_os = mw.getOs() + if current_os == 'darwin': + return "Apple Computer does not support" + + shell_cmd = 'systemctl status zabbix-agent | grep loaded | grep "enabled;"' + data = mw.execShell(shell_cmd) + if data[0] == '': + return 'fail' + return 'ok' + + +def initdInstall(): + current_os = mw.getOs() + if current_os == 'darwin': + return "Apple Computer does not support" + + mw.execShell('systemctl enable zabbix-agent') + return 'ok' + + +def initdUinstall(): + current_os = mw.getOs() + if current_os == 'darwin': + return "Apple Computer does not support" + + mw.execShell('systemctl disable zabbix-agent') + return 'ok' + + +def installPreInspection(): + zabbix_dir = mw.getServerDir()+'/zabbix' + if os.path.exists(zabbix_dir): + return '已经安装zabbix插件' + return 'ok' + + +def uninstallPreInspection(): + return 'ok' + + +if __name__ == "__main__": + func = sys.argv[1] + if func == 'status': + print(status()) + elif func == 'start': + print(start()) + elif func == 'stop': + print(stop()) + elif func == 'restart': + print(restart()) + elif func == 'reload': + print(reload()) + elif func == 'initd_status': + print(initdStatus()) + elif func == 'initd_install': + print(initdInstall()) + elif func == 'initd_uninstall': + print(initdUinstall()) + elif func == 'install_pre_inspection': + print(installPreInspection()) + elif func == 'uninstall_pre_inspection': + print(uninstallPreInspection()) + elif func == 'conf': + print(zabbixAgentConf()) + elif func == 'zabbix_agent_conf': + print(zabbixAgentConf()) + elif func == 'run_log': + print(runLog()) + else: + print('error') diff --git a/plugins/zabbix_agent/info.json b/plugins/zabbix_agent/info.json new file mode 100755 index 0000000000..23bc1d7e73 --- /dev/null +++ b/plugins/zabbix_agent/info.json @@ -0,0 +1,19 @@ +{ + "sort": 7, + "ps": "Zabbix被控服务器[开发中]", + "name": "zabbix_agent", + "title": "Zabbix Agent", + "shell": "install.sh", + "versions":["7.0"], + "tip": "soft", + "install_pre_inspection":true, + "uninstall_pre_inspection":true, + "checks": "server/zabbix_agent", + "path": "server/zabbix_agent", + "display": 1, + "author": "midoks", + "date": "2022-07-14", + "home": "https://www.zabbix.com", + "type": 0, + "pid": "5" +} diff --git a/plugins/zabbix_agent/install.sh b/plugins/zabbix_agent/install.sh new file mode 100755 index 0000000000..17cd991066 --- /dev/null +++ b/plugins/zabbix_agent/install.sh @@ -0,0 +1,77 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin +export PATH + +# https://www.zabbix.com + +# cd /www/server/mdserver-web/plugins/zabbix_agent && /bin/bash install.sh install 7.0 +# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/zabbix_agent/index.py start + + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") + +install_tmp=${rootPath}/tmp/mw_install.pl +VERSION=$2 + +sysName=`uname` +echo "use system: ${sysName}" + +OSNAME=`bash ${rootPath}/scripts/getos.sh` + +if [ "" == "$OSNAME" ];then + OSNAME=`cat ${rootPath}/data/osname.pl` +fi + +if [ "macos" == "$OSNAME" ];then + echo "不支持Macox" + exit +fi + +if [ -f ${rootPath}/bin/activate ];then + source ${rootPath}/bin/activate +fi + +Install_App() +{ + echo '正在安装脚本文件...' + mkdir -p $serverPath/source/zabbix_agent + shell_file=${curPath}/versions/${VERSION}/${OSNAME}.sh + + if [ -f $shell_file ];then + bash -x $shell_file install + else + echo '不支持...' + exit 1 + fi + + + mkdir -p $serverPath/zabbix_agent + echo "${VERSION}" > $serverPath/zabbix_agent/version.pl + + #初始化 + cd ${rootPath} && python3 ${rootPath}/plugins/zabbix_agent/index.py start + cd ${rootPath} && python3 ${rootPath}/plugins/zabbix_agent/index.py initd_install + + + echo 'Zabbix安装完成' +} + +Uninstall_App() +{ + cd ${rootPath} && python3 ${rootPath}/plugins/zabbix_agent/index.py stop + cd ${rootPath} && python3 ${rootPath}/plugins/zabbix_agent/index.py initd_uninstall + + rm -rf $serverPath/zabbix_agent + rm -rf $serverPath/source/zabbix_agent + echo 'Zabbix卸载完成' +} + +action=$1 +if [ "${1}" == 'install' ];then + Install_App +else + Uninstall_App +fi diff --git a/plugins/zabbix_agent/js/zabbix.js b/plugins/zabbix_agent/js/zabbix.js new file mode 100755 index 0000000000..6fd7b3cf2c --- /dev/null +++ b/plugins/zabbix_agent/js/zabbix.js @@ -0,0 +1,64 @@ +function zabbixPost(method, version, args,callback){ + var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); + + var req_data = {}; + req_data['name'] = 'zabbix'; + req_data['func'] = method; + req_data['version'] = version; + + if (typeof(args) == 'string'){ + req_data['args'] = JSON.stringify(toArrayObject(args)); + } else { + req_data['args'] = JSON.stringify(args); + } + + $.post('/plugins/run', req_data, function(data) { + layer.close(loadT); + if (!data.status){ + //错误展示10S + layer.msg(data.msg,{icon:0,time:2000,shade: [10, '#000']}); + return; + } + + if(typeof(callback) == 'function'){ + callback(data); + } + },'json'); +} + +function zabbixPostCallbak(method, version, args,callback){ + var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); + + var req_data = {}; + req_data['name'] = 'zabbix'; + req_data['func'] = method; + args['version'] = version; + + if (typeof(args) == 'string'){ + req_data['args'] = JSON.stringify(toArrayObject(args)); + } else { + req_data['args'] = JSON.stringify(args); + } + + $.post('/plugins/callback', req_data, function(data) { + layer.close(loadT); + if (!data.status){ + layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']}); + return; + } + + if(typeof(callback) == 'function'){ + callback(data); + } + },'json'); +} + + +function zabbixReadme(){ + var readme = '
    '; + readme += '
  • 需要手动配置【默认配置】
  • '; + readme += '
'; + + $('.soft-man-con').html(readme); +} + diff --git a/plugins/zabbix_agent/versions/6.0/debian.sh b/plugins/zabbix_agent/versions/6.0/debian.sh new file mode 100644 index 0000000000..80283fa0bb --- /dev/null +++ b/plugins/zabbix_agent/versions/6.0/debian.sh @@ -0,0 +1,41 @@ +#!/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}'` + +Install_App() +{ + mkdir -p $serverPath/source/zabbix + + ZABBIX_NAME=zabbix-release_6.0-5+debian${SYS_VERSION_ID}_all.deb + echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/6.0/debian/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/6.0/debian/pool/main/z/zabbix-release/${ZABBIX_NAME} + fi + + cd $serverPath/source/zabbix && dpkg -i ${ZABBIX_NAME} + apt update -y + + apt install -y zabbix-agent +} + +Uninstall_App() +{ + echo "卸载成功" +} + +action=${1} +if [ "${1}" == 'install' ];then + Install_App +else + Uninstall_App +fi diff --git a/plugins/zabbix_agent/versions/7.0/alma.sh b/plugins/zabbix_agent/versions/7.0/alma.sh new file mode 100644 index 0000000000..39f54df272 --- /dev/null +++ b/plugins/zabbix_agent/versions/7.0/alma.sh @@ -0,0 +1,43 @@ +#!/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-7.0-4.el${SYS_VERSION_ID:0:1}.noarch.rpm + + 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} + dnf install -y zabbix-agent +} + +Uninstall_App() +{ + dnf 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_agent/versions/7.0/centos.sh b/plugins/zabbix_agent/versions/7.0/centos.sh new file mode 100644 index 0000000000..a456ee761e --- /dev/null +++ b/plugins/zabbix_agent/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() +{ + yum install -y glibc-langpack-zh + + 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_NAME} + + cd $serverPath/source/zabbix && rpm -Uvh ${ZABBIX_NAME} + dnf install -y zabbix-agent + + # dnf module switch-to zabbix-web-1:7.0.4 +} + +Uninstall_App() +{ + dnf 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_agent/versions/7.0/debian.sh b/plugins/zabbix_agent/versions/7.0/debian.sh new file mode 100644 index 0000000000..3278f253c9 --- /dev/null +++ b/plugins/zabbix_agent/versions/7.0/debian.sh @@ -0,0 +1,41 @@ +#!/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}'` + +Install_App() +{ + mkdir -p $serverPath/source/zabbix + + ZABBIX_NAME=zabbix-release_7.0-2+debian${SYS_VERSION_ID}_all.deb + echo "wget -O $serverPath/source/zabbix/${ZABBIX_NAME} https://repo.zabbix.com/zabbix/7.0/debian/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/debian/pool/main/z/zabbix-release/${ZABBIX_NAME} + fi + + cd $serverPath/source/zabbix && dpkg -i ${ZABBIX_NAME} + apt update -y + + apt install -y zabbix-agent +} + +Uninstall_App() +{ + echo "卸载成功" +} + +action=${1} +if [ "${1}" == 'install' ];then + Install_App +else + Uninstall_App +fi diff --git a/plugins/zabbix_agent/versions/7.0/opensuse.sh b/plugins/zabbix_agent/versions/7.0/opensuse.sh new file mode 100644 index 0000000000..6ec3cd19c1 --- /dev/null +++ b/plugins/zabbix_agent/versions/7.0/opensuse.sh @@ -0,0 +1,44 @@ +#!/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-7.0-2.sles${SYS_VERSION_ID:0:2}.noarch.rpm + + rpm -Uvh https://repo.zabbix.com/zabbix/7.0/sles/${SYS_VERSION_ID:0:2}/x86_64/${ZABBIX_NAME} + echo "rpm -Uvh https://repo.zabbix.com/zabbix/7.0/sles/${SYS_VERSION_ID:0:2}/x86_64/${ZABBIX_NAME}" + + # cd $serverPath/source/zabbix && rpm -Uvh ${ZABBIX_NAME} + zypper install -y zabbix-agent +} + +Uninstall_App() +{ + 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_agent/versions/7.0/rocky.sh b/plugins/zabbix_agent/versions/7.0/rocky.sh new file mode 100644 index 0000000000..c7107c7d6e --- /dev/null +++ b/plugins/zabbix_agent/versions/7.0/rocky.sh @@ -0,0 +1,43 @@ +#!/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-7.0-4.el${SYS_VERSION_ID:0:1}.noarch.rpm + + 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} + dnf install -y zabbix-agent +} + +Uninstall_App() +{ + dnf install -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_agent/versions/7.0/ubuntu.sh b/plugins/zabbix_agent/versions/7.0/ubuntu.sh new file mode 100644 index 0000000000..e12309ca5a --- /dev/null +++ b/plugins/zabbix_agent/versions/7.0/ubuntu.sh @@ -0,0 +1,51 @@ +#!/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-agent +} + +Uninstall_App() +{ + 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/scripts/install/debian.sh b/scripts/install/debian.sh index 28b538ae0f..658e14a238 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -43,14 +43,17 @@ echo "SSH PORT:${SSH_PORT}" # choose lang cmd # dpkg-reconfigure --frontend=noninteractive locales +# dpkg-reconfigure locales if [ ! -f /usr/sbin/locale-gen ];then apt install -y locales sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen locale-gen en_US.UTF-8 + locale-gen zh_CN.UTF-8 localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 > /dev/null 2>&1 update-locale LANG=en_US.UTF-8 else locale-gen en_US.UTF-8 + locale-gen zh_CN.UTF-8 localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 > /dev/null 2>&1 fi @@ -168,7 +171,8 @@ apt install -y gcc apt install -y patchelf apt install -y libffi-dev -apt install -y cmake automake make +apt install -y cmake +apt install -y automake make apt install -y webp scons apt install -y libwebp-dev diff --git a/scripts/install/opensuse.sh b/scripts/install/opensuse.sh index e7f1648b1e..1b9cdb6878 100644 --- a/scripts/install/opensuse.sh +++ b/scripts/install/opensuse.sh @@ -27,6 +27,7 @@ zypper install -y libjpeg-devel libpng-devel zypper install -y libevent-devel zypper install -y libtirpc-devel zypper install -y rpcgen +zypper install -y libstdc++6 zypper install -y expect zypper install -y pv zypper install -y bc diff --git a/scripts/update/debian.sh b/scripts/update/debian.sh index 0bd677649d..060e926355 100644 --- a/scripts/update/debian.sh +++ b/scripts/update/debian.sh @@ -5,10 +5,11 @@ export DEBIAN_FRONTEND=noninteractive apt autoremove -y apt install -y locate -if [ ! -d /usr/share/locale/locale.alias ];then - mkdir -p /usr/share/locale/locale.alias +if [ ! -d /usr/share/locale ];then + mkdir -d /usr/share/locale fi locale-gen en_US.UTF-8 +locale-gen zh_CN.UTF-8 localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 > /dev/null 2>&1 export LC_CTYPE=en_US.UTF-8 export LC_ALL=en_US.UTF-8