Zabbix installation and configuration
Step1:从zabbix官方获取最新版本
http://www.zabbix.com/download.php
1、提取zabbix源文件
tar zxvf zabbix-3.0.2.tar.gz |
2、创建zabbix运行用户和组
groupadd zabbix useradd -g zabbix zabbix |
3、安装依赖包
yum -y install curl-devel net-snmp-devel libxml2-devel libcurl-devel |
Step2:安装zabbix
4、zabbix服务端安装
./configure --help #获取可编译参数选项 ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-proxy --with-net-snmp --enable-ipv6 --with-libcurl --with-libxml2 --with-mysql=/usr/local/mysql/bin/mysql_config |
5、zabbix客户端安装
./configure --prefix=/usr/local/zabbix --enable-agent |
6、创建zabbix数据库
mysql> create database zabbix; mysql> GRANT ALL ON zabbix.* TO [email protected]‘localhost‘ IDENTIFIED BY ‘zabbix‘; mysql> FLUSH PRIVILEGES; mysql -uroot -p zabbix < /usr/local/src/zabbix-3.0.2/database/mysql/schema.sql |
7、创建启动脚本
# cp misc/init.d/tru64/zabbix_server /etc/init.d/ # cp misc/init.d/tru64/zabbix_agentd /etc/init.d/ # chmod +x /etc/init.d/zabbix_* # ln -sv /usr/local/zabbix/sbin/zabbix_* /usr/local/sbin/ `/usr/local/sbin/zabbix_agentd‘ -> `/usr/local/zabbix/sbin/zabbix_agentd‘ `/usr/local/sbin/zabbix_proxy‘ -> `/usr/local/zabbix/sbin/zabbix_proxy‘ `/usr/local/sbin/zabbix_server‘ -> `/usr/local/zabbix/sbin/zabbix_server‘ |
Step3:zabbix web配置,增加zabbix虚拟主机
8、创建zabbix目录,拷贝zabbix文件
# mkdir /data/www/html/zabbix -p # cd frontends/php/ # chown -R php-fpm. /data/www/html/zabbix/ |
9、Nginx配置
server { listen 80; server_name 172.15.1.12; index index.html index.htm index.php index.jsp; server_tokens off; root /data/www/html; access_log /var/log/nginx/www_access.log main; location /zabbix { location ~ \.php$ { |
Step4:PHP模块的支持
10、查看php已支持的模块
[[email protected] php-5.6.20]# /usr/local/php/bin/php -m [PHP Modules] bcmath Core ctype curl date dom ereg exif fileinfo filter ftp gd gettext hash iconv json libxml mbstring mcrypt mhash mysql mysqli openssl pcre PDO pdo_sqlite Phar posix Reflection session shmop SimpleXML soap sockets SPL sqlite3 standard sysvsem tokenizer xml xmlreader xmlwriter zlib [Zend Modules] |
11、增加 --with-gettext --enable-sockets
# cd php-5.6.20 # cd ext/gettext/ # /usr/local/php/bin/phpize # ./configure --with-php-config=/usr/local/php/bin/php-config # cd ext/sockets/ # /usr/local/php/bin/phpize # ./configure --with-php-config=/usr/local/php/bin/php-config |
12、/usr/local/php/etc/php.ini
post_max_size = 16M max_execution_time = 300 max_input_time = 300 memory_limit = 128M upload_max_filesize = 2M session.auto_start = 0 mbstring.func_overload = 0 always_populate_raw_post_data = -1 date.timezone = Asia/Shanghai |
Step5:在浏览器打开http://172.15.1.12/zabbix完成zabbix安装
zabbix数据库参数
下一步,进入安装细节
完成安装
进入zabbix登录页面username=admin,password=zabbix
Step5:启动zabbix_server、zabbix_agentd
1、libmysqlclient.so.18文件报错
[[email protected] ~]# ls /usr/local/mysql/lib/ libmysqlclient.a libmysqlclient_r.so libmysqlclient_r.so.18.1.0 libmysqlclient.so.18 libmysqld.a plugin libmysqlclient_r.a libmysqlclient_r.so.18 libmysqlclient.so libmysqlclient.so.18.1.0 libmysqlservices.a [[email protected] ~]# echo "/usr/local/mysql/lib" >> /etc/ld.so.conf [[email protected] ~]# ldconfig [[email protected] ~]# /etc/init.d/zabbix_server start Zabbix server started.
2、zabbix_server.conf
# vim /usr/local/zabbix/etc/zabbix_server.conf DBName=zabbix DBUser=zabbix DBPassword=zabbix DBPort=3306 DBSocket=/var/lib/mysql/mysql.sock |
3、启动zabbix
/etc/init.d/zabbix_server restart /etc/init.d/zabbix_agentd restart |
[[email protected] ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 :::10050 :::* LISTEN 0 128 *:10050 *:* LISTEN 0 128 :::10051 :::* LISTEN 0 128 *:10051 *:* LISTEN 0 128 127.0.0.1:9000 *:* LISTEN 0 80 :::3306 :::* LISTEN 0 128 *:80 *:* LISTEN 0 128 :::22 :::* LISTEN 0 128 *:22 *:* LISTEN 0 100 ::1:25 :::* LISTEN 0 100 127.0.0.1:25 *:* LISTEN 0 128 127.0.0.1:6010 *:* LISTEN 0 128 ::1:6010 :::*
Quickstart
Step1:添加普通用户
Administration-->Users-->Create user
Step2:为新用户添加新媒介
Users-->Media-->add
Step3:添加用户权限
User groups-->Zabbix administrators-->Permissions
为用户添加只读权限