Zabbix配置安装
zabbix是一个CS结构的监控系统,之前一直没有很好的整理下安装:安装几次都要重新看,目前将Zabbix配置安装进行整理如下
Zabbix配置需要web、php、mysql、gcc等支持
请自行配置好
接下来我们开始操作
操作范例的操作系统为Centos 5.2
- tar zxvf zabbix-1.6.2.tar.gz
- mysql -uroot -p
- mysql> create databases zabbix;
- mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY ‘zabbix’ WITH GRANT OPTION;
- mysql> use zabbix;
- mysql> source /usr/local/src/zabbix-1.6.2/create/schema/mysql.sql
- mysql> source /usr/local/src/zabbix-1.6.2/create/data/data.sql
- mysql> source /usr/local/src/zabbix-1.6.2/create/data/images_mysql.sql
- cd zabbix-1.6.2
- ./configure –prefix=/usr/local/zabbix/ \ //指定安装目录
- –enable-server \ //安装server,被监控节点不需要
- –enable-agent \ //安装agent
- –with-mysql \ //需要mysql支持需要指定目录
- –with-net-snmp //需要snmp支持需要指定目录
常用的编译选项如下,需要更多的可以看帮助
- –enable-static Build statically linked binaries
- –enable-server Turn on build of server
- –enable-proxy Turn on build of proxy server
- –enable-agent Turn on build of agent
- –enable-ipv6 Turn on support of IPv6
- –with-mysql
- –with-oracle
- –with-pgsql
- –with-sqlite3
- –with-jabber
- –with-net-snmp
- –with-ucd-snmp
Zabbix配置客户端只需执行:
- ./configure –prefix=/usr/local/zabbix –enable-agent
- make && make install
Zabbix配置安装过程没有报错基本就OK,接下来增加对应的端口:
- vi /etc/services
加入
- zabbix_agent 10050/tcp # zabbix agent
- zabbix_agent 10050/udp # zabbix agent
- zabbix_trapper 10051/tcp # zabbix trapper
- zabbix_trapper 10051/udp # zabbix trapper
复制配置文件和服务启动脚本
- cp -rf misc/conf /opt/app/zabbix/etc -R
到
- misc/init.d/
选择一个自己合适自己环境的启动脚本,或者自己写一个
添加一个zabbix用户
useradd zabbix
然后用脚本启动zabbix_server和zabbix_agentd
- [root@zabbix ~]#ll /usr/local/zabbix/sbin/
- total 2344
- -rwxr-xr-x 1 root root 362581 Apr 16 22:55 zabbix_agent
- -rwxr-xr-x 1 root root 425336 Apr 16 22:55 zabbix_agentd
- -rwxr-xr-x 1 root root 136854 Apr 16 22:55 zabbix_get
- -rwxr-xr-x 1 root root 163086 Apr 16 22:55 zabbix_sender
- -rwxr-xr-x 1 root root 1284665 Apr 16 22:55 zabbix_server
Zabbix配置回到zabbix的编译目录:
生成配置文件:
- mkdir /etc/zabbix
- cp misc/conf/* /etc/zabbix/
- vi frontends/php/include/db.inc.php
更改数据库相关内容:
- $DB_TYPE ="MYSQL";
- $DB_SERVER ="localhost";
- $DB_DATABASE ="zabbix";
- $DB_USER ="zabbix";
- $DB_PWD ="zabbix";
- cp -rf frontends/php /var/www/html/zabbix -R
php环境需求
- PHP version: 5.2.8 Ok
- PHP Memory limit: 128M Ok
- PHP post max size: 8M Ok
- PHP max execution time: 300 sec Ok
- PHP Databases support: MySQL Ok
- PHP BC math support yes Ok
- GD Version: bundled (2.0.34 compatible) Ok
- Image formats: PNG Ok
- PHP Timezone: Asia/Shanghai
注:gd-devel没有安装上去将无法在web端安装过去,对应的其他也要安装,比如net-snmp,可通过yum来安装,方便。
- [root@zabbix ~]#rpm -qa|grep gd
- gd-devel-2.0.33-9.4.el5_1.1
- gd-2.0.33-9.4.el5_1.1
安装php-bcmath
- yum -y install php-bcmath
修改时区
- Vi /etc/php.ini
- date.timezone =Asia/Shanghai
如何安装Zabbix就介绍到这里了。
【编辑推荐】