zabbix配置
一、Zabbix 服务端安装
1.安装依赖包
[[email protected] html]# yum install grep net-snmp-devel libxml2-devel libcurl-devel
2.打开zabbix安装包所在目录,解压、配置安装
[[email protected] zabbix]# tar -zxvf zabbix-2.4.7.tar.gz
[[email protected] zabbix]# cd zabbix-2.4.7
[[email protected] zabbix-2.4.7]# ./configure --prefix=/usr/local/zabbix-2.4.7/ --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
[[email protected] zabbix-2.4.7]#make
[[email protected] zabbix-2.4.7]#make install
3.创建用户
为了安全考虑zabbix只使用普通用户运行,,假如你当前用户叫ttlsa,那么你运行他,他便使用ttlsa身份运行。但是如果你在root环境下运行zabbix,那么zabbix将会主动使用zabbix用户来运行。但是如果你的系统没有名叫zabbix的用户,你需要创建一个用户,如下:
[[email protected] zabbix-2.4.7]# groupadd zabbix
[[email protected] zabbix-2.4.7]# useradd -g zabbix zabbix
4.初始化数据库
zabbix server与proxy需要数据库,angent不需要。尤其要注意的是proxy只需要导入一个sql文件,而server一共要导入3个sql文件。(注:搭建proxy的时候导入了3个sql 可能会导致报错,只需要导入一个表结构即可。)
[[email protected] zabbix-2.4.7]# mysql -uroot –p
mysql> create database zabbix default charset utf8; (注:别忘记加default charset utf8)
mysql> use zabbix;
mysql> source /home/package/zabbix/zabbix-2.4.7/database/mysql/schema.sql; (注意路径)
mysql> source /home/package/zabbix/zabbix-2.4.7/database/mysql/images.sql;
mysql> source /home/package/zabbix/zabbix-2.4.7/database/mysql/data.sql;
5.配置zabbix
1.配置zabbix_server配置文件(/usr/local/zabbix-2.4.7/etc/zabbix_server.conf)
[[email protected] etc]# vi zabbix_server.conf
DBName=zabbix
DBUser=root
DBPassword=123456
DBPort=3306
2.添加开机启动脚本
[[email protected] ~]# cd /home/package/zabbix/zabbix-2.4.7/misc/init.d/fedora/core/ (注意路径)
[[email protected] core]# cp zabbix_server /etc/rc.d/init.d/zabbix_server
[[email protected] core]# cp zabbix_agentd /etc/rc.d/init.d/zabbix_agentd
[[email protected] core]# chmod +x /etc/rc.d/init.d/zabbix_server
[[email protected] core]# chmod +x /etc/rc.d/init.d/zabbix_agentd
[[email protected] core]# chkconfig zabbix_server on
[[email protected] core]# chkconfig zabbix_agentd on
3.修改zabbix开机启动脚本中的启动路径
[[email protected] core]# vi /etc/rc.d/init.d/zabbix_server
BASEDIR=/usr/local/zabbix-2.4.7/
[[email protected] core]# vi /etc/rc.d/init.d/zabbix_agentd
BASEDIR=/usr/local/zabbix-2.4.7/
6.
二、Zabbix管理站点配置
1.拷贝前端文件
在apache的www目录建立zabbix的web目录: (/var/www/html)
[[email protected] html]# mkdir zabbix/
[[email protected] html]#chmod –R 777 zabbix/ (这句要手动输入,-R是递归改变文件夹里所有权限)
打开zabbix解压后的文件位置:
[[email protected] zabbix-2.4.7]# cd /home/package/zabbix/zabbix-2.4.7 (注意路径)
[[email protected] zabbix-2.4.7]# cp -rp frontends/php/* /var/www/html/zabbix/
2.配置虚拟主机
[[email protected] html]# vi /etc/httpd/conf/httpd.conf
找到NameVirtualHost *:80 这一行,把前面的#号去掉。
在最后添加:
<virtualhost *:80>
documentroot /var/www/html/zabbix
servername *:80
</virtualhost>
<Directory "/var/www/html/zabbix">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
保存退出。
重启apache服务:
[[email protected] html]# service httpd restart
1.在浏览器打开zabbix安装页面,按要求配置:
2.PHP支持环境检查
这一步也许会有很多不OK
配置php文件,适应zabbix安装所需的参数
vim /etc/php.ini
date.timezone = Asia/Shanghai
max_execution_time = 300
max_input_time = 300
post_max_size = 32M
memory_limit = 128M
mbstring.func_overload = 2
配置apache文件,定义安装访问zabbix的虚拟主机
vim /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1
DocumentRoot "/var/www/html"
ServerName 192.168.239.130 (服务器的IP地址)
3.Mysql配置
4.Zabbix服务端配置
5.信息列表
6.完成安装
默认账号为 admin 密码 zabbix
解决zabbix中文乱码、汉化
1、在windows中找一个自己喜欢的字体或者去网上下载一个字体
2、将字体上传至/var/www/html/zabbix/fonts目录下
3、修改zabbix页面管理的中文字体设置
vim /var/www/html/zabbix/include/defines.inc.php #修改以下两行
define('ZBX_FONT_NAME', 'simkai'); (找到 define('ZBX_FONT_NAME',) )
define('ZBX_GRAPH_FONT_NAME', 'simkai'); (找到 define('ZBX_GRAPH_FONT_NAME',) )
4、登陆页面设置相应用户的默认语言Administrator—->Users(此处要保证显示的是用户,否则显示的都是用户组)
5、点击用户名进入用户信息编辑,默认语言选择简体中文,然后点击save保存
6、刷新页面
1 |
#已经成为中文,在有些地方还是会有英文的但是zabbix的汉化相对其他开源软件来说已经做的十分的
|
正常安装完zabbix后,登录后zabbix监控报错zabbix server is not running: the information displayed may not be current,
下面的几种情况都有可能引起这个错误,
selinux是否关闭。一定要关闭这个,开启selinux会引起一连串问题,甚至zabbix的discovery功能也不能正常使用
1、zabbix_server服务重启
#service zabbix-server restart
或者
#service zabbix_server restart
2、zabbix_agentd客户端重启
#service zabbix-agentd restart
或者
#service zabbix_agentd restart