zabbix 监控服务系列之--------NO1源码包安装篇
一、在zabbix主机上需要安装的步骤1、在已有的LAMP或者LNMP的基础上安装zabbix,安装一些依赖包:
1 yum -y install mysql-devel libcurl-devel net-snmp-devel phpphp-fpm
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel \
bzip2 bzip2-devel ncurses curl openssl-devel db4-devel libXpm-devel libX11-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c libcurllibcurl-devel
2、添加用户:
12groupadd zabbixuseradd zabbix -g zabbix 3、创建数据库,添加授权账号
12create database zabbix character set utf8;grant all privileges on zabbix.* to zabbix@localhost>'zabbix'; 4、编译安装zabbix
下载地址:wgethttp://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.0/zabbix-2.2.0.tar.gz
12345tar zxf zabbix-2.2.0.tar.gzcd zabbix-2.2.0./configure --prefix=/usr/local/zabbix --enable-server --enable-agent \--with-mysql --with-net-snmp --with-libcurlmake install 5、导入数据库
123mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/schema.sqlmysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/images.sqlmysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/data.sql 6、修改配置文件
1234567cp misc/init.d/fedora/core/zabbix_server /etc/init.d/cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/cp -R frontends/php /var/www/html/zabbixsed -i 's/^DBUser=.*$/DBUser=zabbix/g' /usr/local/zabbix/etc/zabbix_server.confsed -i 's/^.*DBPassword=.*$/DBPassword=zabbix/g' /usr/local/zabbix/etc/zabbix_server.confsed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_serversed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd 7、添加服务端口:
123456cat >>/etc/services/etc/rc.local echo "/etc/init.d/zabbix_agentd start" >> /etc/rc.local
netstat -tnlp
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 21314/zabbix_server
Installing the Web frontend
This is where Apache and PHP come into play. We will need to install some extra php packages for full functionality
yum install php-mysql php-gd php-bcmath php-mbstring php-xml
Once installed its time to copy the web files to the correct folder, with CentOS and Apache this would be /var/www/html/.
cp -r frontends/php/ /var/www/html/
To make the page accessable through http://localhost/zabbix we will have to to rename the folder to zabbix.
# mv /var/www/html/php/ /var/www/html/zabbix
Apache configuration file for Zabbix frontend is located
in /etc/httpd/conf.d/zabbix.conf. Some PHP settings are already configured.
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
# php_value date.timezone Europe/Riga
php:
/etc/php.ini
and change following:
max_execution_time = 600
memory_limit = 256M
post_max_size = 32M
date.timezone = Europe/Zurich
mbstring.func_overload = 2
9、web页面配置,配置http访问好了后web登陆:http://ip/zabbix
10,如果是nginx做反向代理,使用域名访问,执行以下操作、
server {
listen 80;
server_namezabbix.xxx.com;
index index.html index.php index.html;
root/var/www/html/zabbix;
location ~ ^(.+.php)(.*)$ {
fastcgi_split_path_info ^(.+.php)(.*)$;
include fastcgi.conf;
fastcgi_pass127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_paramPATH_INFO $fastcgi_path_info;
}
}
参考文章:http://bguncle.blog.运维网.com/3184079/1330247
二、在被监控机器上安装:
1.下载
http://cdnetworks-kr-2.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.0.1/zabbix-2.0.1.tar.gz
2.安装
2)创建用户
添加Zabbix用户和组。
groupadd zabbix
useradd zabbix -g zabbix -s /sbin/nologin
mkdir /usr/local/zabbix_agentd
2.
[*] tar -zxvf zabbix-2.0.1.tar.gz -C/usr/local/zabbix_agent
3.
[*] cd zabbix-2.0.1
[*] ./configure --prefix=/usr/local/zabbix_agent --enable-agent
[*] make install
4.
安装服
cat >>/etc/services
页:
[1]