centos zabbix 脚本
时间: 2023-10-09 14:04:10 浏览: 177
以下在CentOS系统上安装Zabbix监控系统的脚本:
1. 安装EPEL仓库和Zabbix仓库:
```bash
yum install epel-release -y
rpm -ivh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
```
2. 安装Zabbix server, agent, frontend:
```bash
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
```
3. 安装MySQL数据库:
```bash
yum install mariadb-server -y
systemctl enable mariadb
systemctl start mariadb
```
4. 创建Zabbix数据库和用户:
```bash
mysql -uroot -p
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
quit
```
5. 导入Zabbix数据库结构:
```bash
zcat /usr/share/doc/zabbix-server-mysql-5.0.*/create.sql.gz | mysql -uzabbix -p zabbix
```
6. 配置Zabbix server:
```bash
vi /etc/zabbix/zabbix_server.conf
```
修改以下行:
```conf
DBName=zabbix
DBUser=zabbix
DBPassword=password
```
7. 配置PHP时区:
```bash
vi /etc/httpd/conf.d/zabbix.conf
```
添加以下行:
```conf
php_value date.timezone Asia/Shanghai
```
8. 启动Zabbix服务:
```bash
systemctl enable zabbix-server
systemctl enable zabbix-agent
systemctl restart zabbix-server
systemctl restart zabbix-agent
systemctl restart httpd
```
9. 安装Zabbix agent:
```bash
yum install zabbix-agent
```
10. 配置Zabbix agent:
```bash
vi /etc/zabbix/zabbix_agentd.conf
```
修改以下行:
```conf
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=CentOS-7
```
11. 启动Zabbix agent:
```bash
systemctl enable zabbix-agent
systemctl restart zabbix-agent
```
这样,您就可以访问Zabbix Web界面并开始监控您的服务器了。默认的登录用户名和密码是“Admin / zabbix”。
阅读全文
相关推荐














