yum安装zabbix
服务端
yum install zabbix-server-mysql zabbix-web-mysql
安装zabbix-web-mysql的时候可能会缺少包
错误:软件包:zabbix-web-3.0.30-2.el7.noarch (zabbix)
需要:php-mbstring
错误:软件包:zabbix-web-3.0.30-2.el7.noarch (zabbix)
需要:php-bcmath
需要配置163的yum源
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.163.com/centos/7/os/x86_64/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever - Extras - 163.com
baseurl=http://mirrors.163.com/centos/7/extras/x86_64/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
安装成功后再将zabbix初始表导入到mysql的zabbix库里
安装mysql并创建zabbix库
create database zabbix character set utf8 collate utf8_bin; (一定要设置utf8,要不然后面不好改)
grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix';
zcat /usr/share/doc/zabbix-server-mysql-3.0.30/create.sql.gz | mysql -uzabbix -pzabbix zabbix
修改配置
vi /etc/httpd/conf.d/zabbix.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
启动服务(端口10051,要先启动httpd)
systemctl start zabbix-server (注意selinux关闭)
web页面默认的用户密码为Admin zabbix
zabbix和数据库拆分通过修改/etc/zabbix/web/zabbix.conf.php文件(zabbix-server性能到达瓶颈)
修改字体
cd /usr/share/zabbix/fonts
\mv xxx.ttf graphfont.ttf (将windows上面复制过来的字体重命名并删除源字体)
自定义报警脚本的存放目录
/usr/lib/zabbix/alertscripts(通过rpm -ql zabbix-server-mysql查找到的)
添加触发器trigger
需要修改configuration里的action和administration里的mediatype
客户端安装
yum install -y zabbix-agent
修改配置
vi /etc/zabbix/zabbix_agentd.conf
Server=192.168.174.47 (允许哪台机器向我要数据,此处填写zabbix-server的ip)
启动服务(端口10050)
systemctl start zabbix-agent
服务端测试ping
zabbix_get -s node2 -k agent.ping
客户端自定义item(计算文件大小)
cd /etc/zabbix/zabbix_agentd.d/
touch monitor_file.conf (创建item的配置文件)
vi monitor_file.conf
UserParameter=monitor_file,stat -c %s /etc/services (前面是key,后面是命令)