zabbix搭建
2022-07-04 本文已影响0人
自由如风才是少年的梦
参考网站:https://www.zabbix.com/cn/download
环境:10.10.9.60
安装目录:/home/mcloud/docker-test/zabbix
端口:本地4001 10.10.9.60:4001
下载zabbix源
sudo wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb
sudo dpkg -i zabbix-release_5.0-1+focal_all.deb
sudo apt update
安装Zabbix server,Web前端,agent
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-agent
数据库导入
初始化(略)
mysql -uroot -p password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;
迁移(详细)
导出旧的zabbix数据库
mysqldump -uroot -pmemo@903carl --opt zabbix > zabbix.sql
拷贝数据库备份文件
scp zabbix.sql mcloud@10.10.9.60:docker-test/zabbix
创建新的数据库
sudo mysql -uroot -pnextcloud@903 create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by 'zabbix@903';
grant all privileges on zabbix.* to zabbix@localhost;
quit;
导入数据库
mysql -uzabbix -pzabbix@903 zabbix < zabbix.sql
为Zabbix server配置数据库
编辑配置文件 /etc/zabbix/zabbix_server.conf
DBPassword=zabbix@903
修改配置文件
编辑配置文件 /etc/zabbix/nginx.conf, uncomment and set 'listen' and 'server_name' directives.
listen 80; # server_name example.com;
编辑配置文件 /etc/zabbix/php-fpm.conf, uncomment and set the right timezone for you.
php_value[date.timezone] = Asia/Shanghai
启动Zabbix server和agent进程
启动Zabbix server和agent进程,并为它们设置开机自启:
sudo systemctl restart zabbix-server zabbix-agent nginx php7.4-fpm
sudo systemctl enable zabbix-server zabbix-agent nginx php7.4-fpm