0%

CentOS 安装配置zabbix库

CentOS 安装配置zabbix库

安装zabbix库

1
2
3
4
5
6
7
$ sudo rpm -ivh https://repo.zabbix.com/zabbix/5.4/rhel/7/x86_64/zabbix-release-5.4-1.el7.noarch.rpm

# 安装zabbix前端的一些包
$ yum-config-manager --enable rhel-7-server-optional-rpms

# Installation
$ sudo yum install zabbix-server-mysql

新建数据库

新建 zabbix Mysql 数据库及专用账号

1
$ mysql 
1
2
3
4
5
6
7
mysql > CREATE DATABASE zabbix character set utf8 collate utf8_bin;

mysql > GRANT all ON zabbix.* TO 'zabbix'@'%' IDENTIFIED BY 'zabbix';

mysql > flush privileges;

mysql > quit

导入数据

默认情况下,执行下述命令就可以;

1
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

但是我好想没有找到这个压缩文件,所以执行下面的命令:

1
2
3
4
5
$ cd /usr/share/zabbix-mysql/
# 依次导入下列sql表
$ cat schema.sql | mysql -uzabbix -p zabbix
$ cat images.sql | mysql -uzabbix -p zabbix
$ cat data.sql | mysql -uzabbix -p zabbix

配置数据库

1
2
3
4
5
6
7
8
9
$ vim /etc/zabbix/zabbix_server.conf

DBHost=localhost

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix

启动 Zabbix server 进程

1
2
3
$ service zabbix-server start

$ systemctl enable zabbix-server

web UI 安装zabbix

重启一下Httpd 服务后,进入 http://zabbix-server-ip/zabbix 即可web配置,

初始登录信息为Admin/zabbix

安装zabbix agent

安装Zabbix Agent

1
yum install zabbix-agent

编辑Zabbix Agent 配置文件

1
2
3
4
5
6
vim /etc/zabbix/zabbix_agentd.conf

Server=[zabbix server ip]

ServerActive=[zabbix server ip]
Hostname=[ Hostname of client system ]

重启Zabbix Agent

1
2
3
4
5
service zabbix-agent restart

添加开机启动
​```bash
chkconfig zabbix-agent on

Zabbix agent on Zabbix server is unreachable for 5 minutes

checked and found that the ServerActive address is not changed to zabbix-server IP address in configuration file. So we changed it to Zabbix-server IP.

We made the changes in:

1
/etc/zabbix/zabbix_agentd.conf

and restarted the service using:

1
$ sudo service zabbix-agent2 start 

This fixed the issue.

Not able to find zabbix data source in grafana After enabling plugin

It appears as signed on grafana’s plugin panel, but /etc/grafana/grafana.ini needs editing.


[plugins]
allow_loading_unsigned_plugins = alexanderzobnin-zabbix-datasource

zabbix 无法启动server服务器

可以检查日志tailf /var/log/zabbix/zabbix_server.log

ZABBIX 报错连接拒绝(cannot connect to [10050]: [111] Connection refused)

首先还是看一下防火墙等是不是阻断.
然后确认数据库的最大连接数.默认的是256.

1.vim /etc/my.cnf
[mysqld]
max_connections=需要添加的最大连接数

2.vim /etc/systemd/system.conf
DefaultLimitNOFILE=65535
DefaultLimitNPROC=65535

3.重启

systemctl daemon-reload

systemctl restart mysqld.service

查看最大连接数
mysql>show variables like ‘max_connections’;
查看当前连接数
show status like ‘%thread%’;

处无为之事,行不言之教;作而弗始,生而弗有,为而弗恃,功成不居!

欢迎关注我的其它发布渠道