首先我已经配置好了,LAMP环境,或者可以使用下面的命令:
[[email protected] ~]#yum install make mysql-server httpd php mysql-devel gcc net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath php-mbstring php-xml unixODBC-devel OpenIPMI-devel libxml2-devel
完成安装:
1、新建一个zabbix账户:
[[email protected] ~]useradd zabbix -s /sbin/nologin
2、创建zabbix数据库、并赋给zabbix权限:
mysql> create database zabbix character set utf8 collate utf8_bin; Query OK, 1 row affected (0.00 sec) mysql> grant all on zabbix.* to [email protected] identified by ‘zabbix‘; Query OK, 0 rows affected (0.02 sec) mysql> flush privileges;
3、下载zabbix,并且导入数据库,我这里原有的是2.2的所以还是用2.2的
[[email protected] src]# cd /usr/local/src/zabbix-2.2.2 [[email protected] zabbix-2.2.2]# cd database/mysql/ [[email protected] mysql]# mysql -uzabbix -pzabbix zabbix < schema.sql [[email protected] mysql]# mysql -uzabbix -pzabbix zabbix < images.sql [[email protected] mysql]# mysql -uzabbix -pzabbix zabbix < data.sql
4、编译安装zabbix_server:
[[email protected] zabbix-2.2.2]# ./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --with-unixodbc --prefix=/usr/local/zabbix [[email protected] zabbix-2.2.2]# make && make install
5、编辑httpd.conf支持index.php
[[email protected] zabbix-2.2.2]# vim /usr/local/apache2/conf/httpd.conf DirectoryIndex index.php index.html
6、修改zabbix文件对应的数据库账号和密码:
[[email protected] zabbix-2.2.2]# vim /usr/local/zabbix/etc/zabbix_server.conf DBName=zabbix DBUser=zabbix DBPassword=zabbix
7、复制启动脚本,并修改相应选项:
[[email protected] zabbix-2.2.2]# cp misc/init.d/fedora/core5/zabbix_server /etc/init.d/[[email protected] zabbix-2.2.2]# cp misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/ 修改两个配置文件把 [[email protected] zabbix-2.2.2]# vim /etc/init.d/zabbix_agentd ZABBIX_BIN="/usr/local/sbin/zabbix_agentd"改成ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd" [[email protected] zabbix-2.2.2]# vim /etc/init.d/zabbix_server ZABBIX_BIN="/usr/local/sbin/zabbix_server"改成ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_server"
启动:
[[email protected] zabbix-2.2.2]# /etc/init.d/zabbix_server start [[email protected] zabbix-2.2.2]# /etc/init.d/zabbix_agentd start [[email protected] zabbix-2.2.2]# chkconfig zabbix_agentd on [[email protected] zabbix-2.2.2]# chkconfig zabbix_server on 8、修改php.ini文件支持大小,不然web也没容易报错: [[email protected] zabbix-2.2.2]# vim /etc/php.ini max_execution_time = 300 max_input_time = 300 date.timezone =Asia/Shanghai post_max_size = 32M 重启httpd使php配置生效
9、复制zabbix的php项目早http目录下,并且给权限:
[[email protected] frontends]# cp -rf php /usr/local/apache2/htdocs/zabbix [[email protected] htdocs]# chown -R apache.apache /usr/local/apache2/htdocs/zabbix/
10、然后访问web: http://IP/zabbix 默认下一步:
11、下面的选型要全部为ok才能执行下一步,哪个不行就yum安装。然后一直填写相关的数据库信息:
12、安装成功,登录的账号默认为:Admin,密码为:zabbix:
到这里server端已经安装完成。但是为了有时候方便,我们还是需要汉化一下zabbix,
步骤:
1、确认zabbix已经支持了中午语言:
[[email protected] ~]# vim /var/www/html/zabbix/include/locales.inc.php ‘zh_CN‘ => array(‘name‘ => _(‘Chinese (zh_CN)‘), ‘display‘ => true),
2、在自己的windows电脑找到本地C:\Windows\Fonts\simkai.ttf(楷体)上传到服务器zabbix网站目录fonts目录下。并且修改命名方式(不上传字体会照成乱码):
[[email protected] fonts]# mv simkai.ttf DejaVuSans.ttf
mv:是否覆盖"DejaVuSans.ttf"? y
3、点击右上角的。profile.选择语言为zh-cn
#到此汉化已经完成。接下来就是客户端agent的安装了,这里选择agent的监控方式,因为足够强大:
agent安装步骤:
客户端安装的话不用依赖LAMP环境,直接装上就好
1、添加账户:
[[email protected] ~]# useradd zabbix -s /sbin/nologin
2、编译安装zabbix_agent:
[[email protected] zabbix-2.2.2]# ./configure --with-net-snmp --with-libcurl --enable-agent --prefix=/usr/local/zabbix [[email protected] zabbix-2.2.2]# make && make install
3、设置启动项和修改配置文件:
[[email protected] zabbix-2.2.2]# cp misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/ [[email protected] zabbix-2.2.2]# chmod 700 /etc/init.d/zabbix_agentd [[email protected] zabbix-2.2.2]# vim /etc/init.d/zabbix_agentd ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd"
4、修改zabbix指向的服务器:
[[email protected] zabbix-2.2.2]# vim /usr/local/zabbix/etc/zabbix_agentd.conf Server=192.168.10.205
完成后保存退出,今天就补充大到这