diff --git a/plugins/zabbix/conf/zabbix_agentd.conf b/plugins/zabbix/conf/zabbix_agentd.conf new file mode 100644 index 000000000..9ffe32e8b --- /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/index.html b/plugins/zabbix/index.html index 5b52f8f6d..0f5d20d14 100755 --- a/plugins/zabbix/index.html +++ b/plugins/zabbix/index.html @@ -16,6 +16,7 @@
OP配置
PHP配置
ZS配置
+ZA配置
运行日志
相关说明
diff --git a/plugins/zabbix/index.py b/plugins/zabbix/index.py index 0f4039d36..dde359e74 100755 --- a/plugins/zabbix/index.py +++ b/plugins/zabbix/index.py @@ -152,6 +152,9 @@ def zabbixPhpConf(): def zabbixServerConf(): return '/etc/zabbix/zabbix_server.conf' +def zabbixAgentConf(): + return '/etc/zabbix/zabbix_agentd.conf' + def zabbixImportMySQLData(): pmdb = pMysqlDb() psdb = pSqliteDb('databases') @@ -211,6 +214,15 @@ def initPhpConf(): 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 @@ -222,6 +234,7 @@ def openPort(): return "Release failed {}".format(e) return True + def initDreplace(): # 导入MySQL配置 zabbixImportMySQLData() @@ -233,6 +246,7 @@ def initDreplace(): init_file = getServerDir() + '/init.pl' if not os.path.exists(init_file): initZsConf() + initAgentConf() openPort() mw.writeFile(init_file, 'ok') return True @@ -376,6 +390,8 @@ if __name__ == "__main__": print(zabbixPhpConf()) elif func == 'zabbix_server_conf': print(zabbixServerConf()) + elif func == 'zabbix_agent_conf': + print(zabbixAgentConf()) elif func == 'run_log': print(runLog()) else: diff --git a/plugins/zabbix/versions/7.0/debian.sh b/plugins/zabbix/versions/7.0/debian.sh index ad8a22cb9..c3e3c6c9d 100644 --- a/plugins/zabbix/versions/7.0/debian.sh +++ b/plugins/zabbix/versions/7.0/debian.sh @@ -29,12 +29,14 @@ Install_App() cd $serverPath/source/zabbix && dpkg -i ${ZABBIX_NAME} apt update -y - apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-sql-scripts zabbix-agent zabbix-get + 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-agent zabbix-get + 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 "卸载成功"