zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。  zabbix由2部分构成,zabbix server与可选组件zabbix agent。
  zabbix server可以通过SNMP,zabbix agent,ping,端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能,它可以运行在Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。
  无论安装什么软件程序,最好是安装稳定版,不能只是为了一味追求最新版本,忽略了软件程序的稳定性,我个人的安装习惯是在最新版本的基础上往前推一两个版本,安装它的稳定版。
1.编译安装nginx。
1)编译安装pcre,nginx安装需要pcre的支持。

1
2
3
4
5
6
7
8
[iyunv@vmware1 ~]# mkdir -p /taokey/tools
[iyunv@vmware1 ~]# cd /taokey/tools/
[iyunv@vmware1 tools]# yum install -y gcc gcc-c++
[iyunv@vmware1 tools]# tar -zxf pcre-8.33.tar.gz 
[iyunv@vmware1 tools]# cd pcre-8.33
[iyunv@vmware1 pcre-8.33]# ./configure
[iyunv@vmware1 pcre-8.33]# make && make install
[iyunv@vmware1 pcre-8.33]# cd ..

2)创建nginx普通用户,下载并解压nginx源码包。

1
2
3
4
5
[iyunv@vmware1 ~]# useradd nginx -s /sbin/nologin -M
[iyunv@vmware1 tools]# wget http://nginx.org/download/nginx-1.6.3.tar.gz
[iyunv@vmware1 tools]# tar -zxf nginx-1.6.3.tar.gz 
[iyunv@vmware1 tools]# cd nginx-1.6.3
[iyunv@vmware1 nginx-1.6.3]# yum -y install openssl openssl-devel

3)编译安装nginx,然后启动nginx。

1
2
3
4
5
6
7
8
9
10
11
12
[iyunv@vmware1 nginx-1.6.3]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
[iyunv@vmware1 nginx-1.6.3]# make && make install
[iyunv@vmware1 nginx-1.6.3]# echo /usr/local/lib >>/etc/ld.so.conf
[iyunv@vmware1 nginx-1.6.3]# ldconfig 
[iyunv@vmware1 nginx-1.6.3]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[iyunv@vmware1 nginx-1.6.3]# /usr/local/nginx/sbin/nginx 
[iyunv@vmware1 nginx-1.6.3]# ps -ef | grep nginx
root     11456     1  0 14:39 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx    11457 11456  0 14:39 ?        00:00:00 nginx: worker process      
root     11459  1794  0 14:39 pts/1    00:00:00 grep nginx

2.yum安装MySQL,启动MySQL。

1
2
3
4
5
6
7
8
[iyunv@vmware1 ~]# yum install -y mysql-server mysql-devel mysql
[iyunv@vmware1 ~]# /etc/init.d/mysqld start
[iyunv@vmware1 ~]# ps -ef | grep mysql
root     11567     1  0 14:41 pts/1    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
mysql    11669 11567  1 14:41 pts/1    00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root     11693  1794  0 14:42 pts/1    00:00:00 grep mysql
[iyunv@vmware1 ~]# netstat -anpt | grep 3306
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      11669/mysqld

3.yum安装PHP。

1
2
3
4
5
6
7
8
9
10
11
12
13
[iyunv@vmware1 ~]# yum install -y php php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm php-pecl* 
[iyunv@vmware1 ~]# sed -i 's/^user =.*/user = nginx/g' /etc/php-fpm.d/www.conf
[iyunv@vmware1 ~]# sed -i 's/^group =.*/group = nginx/g' /etc/php-fpm.d/www.conf
[iyunv@vmware1 ~]# /etc/init.d/php-fpm start
正在启动 php-fpm:[确定]
[iyunv@vmware1 ~]# ps -ef | grep php
root     11746     1  0 14:45 ?        00:00:00 php-fpm: master process (/etc/php-fpm.conf)
nginx    11747 11746  0 14:45 ?        00:00:00 php-fpm: pool www            
nginx    11748 11746  0 14:45 ?        00:00:00 php-fpm: pool www            
nginx    11749 11746  0 14:45 ?        00:00:00 php-fpm: pool www            
nginx    11750 11746  0 14:45 ?        00:00:00 php-fpm: pool www            
nginx    11751 11746  0 14:45 ?        00:00:00 php-fpm: pool www            
root     11754  1794  0 14:45 pts/1    00:00:00 grep php

4.配置nginx,结合php环境。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
vi /usr/local/nginx/conf/nginx.conf
    server {
        listen       80;
        server_name  localhost;
        location / {
            root   html;
            index  index.html index.htm index.php;
        }
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
            include        fastcgi.conf;
        }
}     
[iyunv@vmware1 ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[iyunv@vmware1 ~]# /usr/local/nginx/sbin/nginx -s reload

5.测试一下php环境是否可以正常运行。(测试如图,php环境没有问题)

1
2
3
4
5
[iyunv@vmware1 ~]# cat > /usr/local/nginx/html/index.php  <<EOF
<?php
phpinfo();
?>
EOF

<ignore_js_op> 
6.安装zabbix server端软件包。
1)安装相应的库和软件包,并且创建zabbix用户。

1
2
[iyunv@vmware1 ~]# yum -y install libcurl-devel net-snmp-devel
[iyunv@vmware1 ~]# useradd zabbix -s /sbin/nologin

2)下载zabbix源码包,编译安装zabbix。

1
2
3
4
[iyunv@vmware1 tools]# tar -zxf zabbix-2.2.9.tar.gz 
[iyunv@vmware1 tools]# cd zabbix-2.2.9
[iyunv@vmware1 zabbix-2.2.9]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
[iyunv@vmware1 zabbix-2.2.9]# make install

7.在MySQL中创建zabbix所需数据库,以及账号密码。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[iyunv@vmware1 zabbix-2.2.9]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database zabbix character set utf8;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';
Query OK, 0 rows affected (0.01 sec)

mysql> delete from mysql.user where user=""; 
Query OK, 2 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

8.zabbix数据导入创建好的zabbix数据库中。

1
2
3
[iyunv@vmware1 zabbix-2.2.9]# mysql -uzabbix -pzabbix -h127.0.0.1 zabbix < database/mysql/schema.sql
[iyunv@vmware1 zabbix-2.2.9]# mysql -uzabbix -pzabbix -h127.0.0.1 zabbix < database/mysql/images.sql
[iyunv@vmware1 zabbix-2.2.9]# mysql -uzabbix -pzabbix -h127.0.0.1 zabbix < database/mysql/data.sql

9.拷贝zabbix服务端和客户端的启动文件。

1
2
[iyunv@vmware1 zabbix-2.2.9]# cp misc/init.d/fedora/core/zabbix_server /etc/init.d/
[iyunv@vmware1 zabbix-2.2.9]# cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/

10.修改配置文件及启动文件。

1
2
3
4
5
[iyunv@vmware1 zabbix-2.2.9]# sed -i 's/^DBUser=.*$/DBUser=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf
[iyunv@vmware1 zabbix-2.2.9]# sed -i 's/^.*DBPassword=.*$/DBPassword=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf
[iyunv@vmware1 zabbix-2.2.9]# sed -i 's/^.*DBHost=.*$/DBHost=127.0.0.1/g' /usr/local/zabbix/etc/zabbix_server.conf
[iyunv@vmware1 zabbix-2.2.9]# sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_server
[iyunv@vmware1 zabbix-2.2.9]# sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd

11.在/etc/services文件中,添加zabbix服务端口。

1
2
3
4
5
6
7
8
9
10
11
[iyunv@vmware1 zabbix-2.2.9]# cat >>/etc/services <<EOF
zabbix-agent     10050/tcp       #Zabbix Agent
zabbix-agent     10050/udp       #Zabbix Agent
zabbix-trapper   10051/tcp       #Zabbix Trapper
zabbix-trapper   10051/udp       #Zabbix Trapper
EOF
[iyunv@vmware1 zabbix-2.2.9]# tail -4 /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

12.复制zabbix程序文件端到nginx的指定web目录下,并且设置相应权限。

1
2
[iyunv@vmware1 zabbix-2.2.9]# cp -ra frontends/php/ /usr/local/nginx/html/zabbix
[iyunv@vmware1 zabbix-2.2.9]# chown -R nginx.nginx /usr/local/nginx/html/zabbix

13.启动zabbix server和zabix agent。

1
2
3
4
5
6
7
[iyunv@vmware1 zabbix-2.2.9]# /etc/init.d/zabbix_server start
[iyunv@vmware1 zabbix-2.2.9]# /etc/init.d/zabbix_agentd start
[iyunv@vmware1 zabbix-2.2.9]# netstat -anpt | grep 10050
tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN      19850/zabbix_agentd 
[iyunv@vmware1 zabbix-2.2.9]# netstat -anpt | grep 10051
tcp        0      0 0.0.0.0:10051               0.0.0.0:*                   LISTEN      19786/zabbix_server 
tcp        0      0 127.0.0.1:10051             127.0.0.1:37229             TIME_WAIT   -

14.在浏览器输入:http://192.168.1.40/zabbix/setup.php 安装zabbix server的web界面。
<ignore_js_op>

点击Next:

<ignore_js_op>

php安装会遇到几个报错,解决方法:
15.修改php配置满足zabbix安装要求。

1
2
3
4
5
[iyunv@vmware1 zabbix-2.2.9]# sed -i 's/^\(.*\)date.timezone =.*$/date.timezone = Asia\/Shanghai/g' /etc/php.ini
[iyunv@vmware1 zabbix-2.2.9]# sed -i 's/^\(.*\)post_max_size =.*$/post_max_size = 16M/g' /etc/php.ini
[iyunv@vmware1 zabbix-2.2.9]# sed -i 's/^\(.*\)max_execution_time =.*$/max_execution_time = 300/g' /etc/php.ini
[iyunv@vmware1 zabbix-2.2.9]# sed -i 's/^\(.*\)max_input_time =.*$/max_input_time = 300/g' /etc/php.ini
[iyunv@vmware1 zabbix-2.2.9]# /etc/init.d/php-fpm restart

修改完之后,然后再重新刷新页面,如图所示:

<ignore_js_op>

然后再点击Next,进行下一步:

<ignore_js_op>

输入相应的数据库信息,然后测试连接, 没有问题,继续下一步:

<ignore_js_op>

此页面,可以设置成默认的Host和Port,然后点击下一步:

<ignore_js_op>

继续点击下一步 Next:

<ignore_js_op>

安装到这里,说明已经安装完成了,最后点击Finish,完成安装即可。

<ignore_js_op>

Zabbix默认的账号admin,默认密码是zabbix,咱们登陆进去。

<ignore_js_op>

zabbix2.2.9安装之后语言选项中没有Chinese (zh_CN) 选项,虽然不建议使用这个汉化版本,但是对于有日文选项而没有中文来说。还是有些不爽,好了,修改方式如下:
在zabbix服务端的安装目录下找到/usr/local/nginx/html/zabbix/include/locales.inc.php 把false修改成true,然后保存退出即可。

1
2
[iyunv@vmware1 zabbix-2.2.9]# vim /usr/local/nginx/html/zabbix/include/locales.inc.php +58
'zh_CN' => array('name' => _('Chinese (zh_CN)'),        'display' => true),

此时,刷新页面,就可以找到中文版本。
<ignore_js_op>

保存之后,就成为了汉化版本的zabbix页面。

<ignore_js_op>

zabbix server安装到此结束,谢谢。

snmp安装zabbix的更多相关文章

  1. 自学Zabbix11.2 Zabbix SNMP安装

    点击返回:自学Zabbix之路 点击返回:自学Zabbix4.0之路 点击返回:自学zabbix集锦 自学Zabbix11.2 Zabbix SNMP安装 1. yum安装snmp 1 # yum i ...

  2. Centos 源码安装zabbix 2.4.5

    Zabbix简介 Zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案.zabbix能监视各种网络参数,保证服务器系统 的安全运营:并提供柔软的通知机制以让系统管 ...

  3. CentOS7安装Zabbix

    一.Zabbix简介 Zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案. Zabbix能监视各种网络参数,保证服务器系统的安全运营:并提供灵活的通知机制以让系 ...

  4. centos 6.9安装zabbix 3.0

    Linux下常用的系统监控软件有Nagios.Cacti.Zabbix.Monit等,这些开源的软件,可以帮助我们更好的管理机器,在第一时间内发现,并警告系统维护人员. 今天开始研究下Zabbix,使 ...

  5. CentOS 7源码安装zabbix

    一.Zabbix简介 zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案.zabbix能监视各种网络参数,保证服务器系统的安全运营:并提供灵活的通知机制以让系统 ...

  6. Centos 7.0 下安装 Zabbix server 3.0服务器的安装及 监控主机的加入(1)

    一.本系列分为6部分 1.Centos 7.0 下安装 Zabbix server 3.0服务器的安装及 监控主机的加入 2.Centos 6.5 下安装 Zabbix server 3.0服务器的安 ...

  7. CentOS 7.2安装zabbix 3.0 LTS

    1.zabbix简介 zabbix(音同 zæbix)是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案. zabbix能监视各种网络参数,保证服务器系统的安全运营:并提供 ...

  8. (转)基于CentOS 7安装Zabbix 3.4和Zabbix4.0

    原文:https://blog.csdn.net/leshami/article/details/78708049 CentOS 7环境下Zabbix4.0的安装和配置实例-----------htt ...

  9. Centos 7.0_64bit 下安装 Zabbix server 3.0服务器的安装

    一.关闭selinux   修改配置文件/ etc / selinux / config,将SELINU置为禁用(disabled)   vim /etc/selinux/config  # This ...

随机推荐

  1. lambda表达式 <二>

    概念了解: 1.什么是匿名委托(匿名方法的简单介绍.为什么要用匿名方法) 2.匿名方法的[拉姆达表达式]方法定义 3.匿名方法的调用(匿名方法的参数传递.使用过程中需要注意什么) 什么是匿名方法? 匿 ...

  2. Linux服务器通过拷贝的方式安装多个tomcat

    Tomcat占用资源少.运行速度快.安装配置简单,在个人开发中拥有广泛的使用者.很多人在使用中存在以下的误区:1.Tomcat必须通过eclipse启动2.Tomcat必须通过安装才能使用运行3.一台 ...

  3. LeetCode OJ:Find Median from Data Stream(找数据流的中数)

    Median is the middle value in an ordered integer list. If the size of the list is even, there is no ...

  4. 201621123014《Java程序设计》第五周学习总结

    1. 本周学习总结 1.1 写出你认为本周学习中比较重要的知识点关键词 答:接口.interface.implements.Comparable.Comparator 1.2 尝试使用思维导图将这些关 ...

  5. (转载) Chrome中canvas上drawImage无法画出image的解决办法

    在自己写demo的过程中 碰到了这样一个问题 发现drawImage方法没有达到预期的效果 图片没办法显示 而fillRect等画图形的方法却工作良好 大概的代码如下: $(function() { ...

  6. windows下gvim搭建IDE

    原文转载自:手把手教你把Vim改装成一个IDE编程环境(图文) 如侵犯您的版权,请联系:windeal12@qq.com By: 吴垠 Date: 2007-09-07 Version: 0.5 Em ...

  7. New Concept English three(16)

    35w/m 43 Mary and her husband Dimitri lived in the tiny village of Perachora in southern Greece. One ...

  8. Html5的Web存储和WebSql

    HTML5 Web 存储 使用HTML5可以在本地存储用户的浏览数据. 早些时候,本地存储使用的是cookies.但是Web 存储需要更加的安全与快速. 这些数据不会被保存在服务器上,但是这些数据只用 ...

  9. jq的attr、prop和data区别

    prop()获取在匹配的元素集中的第一个元素的属性值. 大家都知道有的浏览器只要写disabled,checked就可以了,而有的要写成disabled = "disabled", ...

  10. key相同合并Map

    public class Demo11 { public static void main(String[] args) { ConcurrentHashMap<Integer, Map< ...