Update index.py

This commit is contained in:
Mr Chen 2024-07-20 01:53:29 +08:00
parent f89be00419
commit 9b52fee2a7
1 changed files with 10 additions and 1 deletions

View File

@ -212,6 +212,13 @@ def zabbixServerConf():
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():
getMySQLConf()
choose_mysql = getServerDir()+'/mysql.pl'
@ -237,8 +244,10 @@ def zabbixImportMySQLData():
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 /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | '+mysql_bin+' --default-character-set=utf8mb4 -uzabbix -p"'+db_pass+'" 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")