设为首页 收藏本站
查看: 1492|回复: 0

[经验分享] deploy zabbix 2.2.10 on ubuntu 14.04 64bit

[复制链接]
累计签到:54 天
连续签到:1 天
发表于 2015-11-23 12:09:55 | 显示全部楼层 |阅读模式
  Architecture:

Nginx: 1.4.6

php5:  5.5.9-1ubuntu4.12

mysql: 5.5
Install depends


#apt-get install -y nginx php5-fpm php5-gd mysql-server php5-mysql libmysqld-dev libxml2-dev libsnmp-dev libcurl4-openssl-dev

Config php5-fpm


#/etc/php5/fpm/pool.d/www.conf
...
> 33 ;listen = /var/run/php5-fpm.sock
> 34 listen = 9000
#service php5-fpm restart

Config nginx


#cp /etc/nginx/sites-available/default{,.bak}
#vim /etc/nginx/sites-enabled/default
...
24 ##      root /usr/share/nginx/html;
25         root /var/www/html/zabbix;
26         index index.php index.html index.htm;
...
54         location ~ \.php$ {
55                 fastcgi_split_path_info ^(.+\.php)(/.+)$;
56         #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
57         #
58         #       # With php5-cgi alone:
59                 fastcgi_pass 127.0.0.1:9000;
60         #       # With php5-fpm:
61         #       fastcgi_pass unix:/var/run/php5-fpm.sock;
62                 fastcgi_index index.php;
63                 include fastcgi_params;
64         }
...
#nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
#service nginx reload


Installing Zabbix daemons
download and untar pkg


#wget http://7mnldi.com1.z0.glb.clouddn.com/zabbix-2.2.10.tar.gz
#tar -xf zabbix-2.2.10.tar.gz

Create user account


#groupadd zabbix
#useradd -g zabbix zabbix

Create Zabbix database
  For Zabbix server and proxy daemons, as well as Zabbix frontend, a database is required. It is not needed to run Zabbix agent.

SQL scripts are provided for creating database schema and inserting the dataset. Zabbix proxy database needs only the
schema while Zabbix server database requires also the dataset on top of the schema.
  For example: config mysql


shell> mysql -u<username> -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> quit;
shell> mysql -u<username> -p<password> zabbix < database/mysql/schema.sql
# stop here if you are creating database for Zabbix proxy
shell> mysql -u<username> -p<password> zabbix < database/mysql/images.sql
shell> mysql -u<username> -p<password> zabbix < database/mysql/data.sql

  Having created a Zabbix database, proceed to the following steps of compiling Zabbix.
Configure the sources
  When configuring the sources for a Zabbix server or proxy, you must specify the database type to be used. Only one database type can be compiled with a server or proxy process at a time.
  To see all of the supported configuration options, inside the extracted Zabbix source directory run:


#./configure --help
  To configure the sources for a Zabbix server and agent, you may run something like:


#./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
  note: –with-libxml2 configuration option is required for virtual machine monitoring, supported since Zabbix 2.2.0.

  To configure the sources for a Zabbix server (with PostgreSQL etc.), you may run:


#./configure --enable-server --with-postgresql --with-net-snmp
  To configure the sources for a Zabbix proxy (with SQLite etc.), you may run:


#./configure --prefix=/usr --enable-proxy --with-net-snmp --with-sqlite3 --with-ssh2
  To configure the sources for a Zabbix agent, you may run:


#./configure --enable-agent

Make and install everything


#make install
  This step should be run as a user with sufficient permissions (commonly ‘root’, or by using sudo).
  Running make install will by default install the daemon binaries (zabbix_server, zabbix_agentd, zabbix_proxy) in /usr/local/sbin and the client binaries (zabbix_get, zabbix_sender) in /usr/local/bin.
  To specify a different location than /usr/local, use a --prefix key in the previous step of configuring sources, for example --prefix=/home/zabbix. In this case daemon binaries will be installed under /sbin, while utilities under /bin. Man pages will be installed under /share.

Review and edit configuration files

  • edit the Zabbix agent configuration file /usr/local/etc/zabbix_agentd.conf

    You need to configure this file for every host with zabbix_agentd installed.
  You must specify the Zabbix server IP address in the file. Connections from other hosts will be denied.

  • edit the Zabbix server configuration file /usr/local/etc/zabbix_server.conf

    You must specify the database name, user and password (if using any).
  With SQLite the full path to database file must be specified; DB user and password are not required.

  The rest of the parameters will suit you with their defaults if you have a small installation (up to ten monitored hosts). You should change the default parameters if you want to maximize the performance of Zabbix server (or proxy) though. See the performance tuning section for more details.

  • if you have installed a Zabbix proxy, edit the proxy configuration file /usr/local/etc/zabbix_proxy.conf
  You must specify the server IP address and proxy hostname (must be known to the server), as well as the database name, user and password (if using any)
  With SQLite the full path to database file must be specified; DB user and password are not required.

Start up the daemons
  Run zabbix_server on the server side.


#zabbix_server
  Make sure that your system allows allocation of 36MB (or a bit more) of shared memory, otherwise the server may not start and you will see “Cannot allocate shared memory for .” in the server log file. This may happen on FreeBSD, Solaris 8.
See the “See also” section at the bottom of this page to find out how to configure shared memory.

  Run zabbix_agentd on all the monitored machines.


#zabbix_agentd
  Make sure that your system allows allocation of 2MB of shared memory, otherwise the agent may not start and you will see “Cannot allocate shared memory for collector.” in the agent log file. This may happen on Solaris 8.

  If you have installed Zabbix proxy, run zabbix_proxy.


#zabbix_proxy

Installing Zabbix web interface
  Copying PHP files

Zabbix frontend is written in PHP, so to run it a PHP supported webserver is needed. Installation is done by simply copying the PHP files from frontends/php to the webserver HTML documents directory.


#mkdir /var/www/html/zabbix
#cd frontends/php
# cp -a . /var/www/html/zabbix

Installing frontend
  Step 1

In your browser, open Zabbix URL: http://<server_ip_or_name>

You should see the first screen of the frontend installation wizard.
  Step 2

Make sure that all software prerequisites are met.



Current value   Required
PHP version 5.5.9-1ubuntu4.12   5.3.0   OK
PHP option memory_limit 128M    128M    OK
PHP option post_max_size        8M  16M Fail
PHP option upload_max_filesize  2M  2M  OK
PHP option max_execution_time   30  300 Fail
PHP option max_input_time       60  300 Fail
PHP time zone                   unknown     Fail
PHP databases support           MySQL   OK
PHP bcmath                      on      OK
PHP mbstring                    on      OK
PHP sockets                     on      OK
PHP gd                          2.1.1   2.0 OK
PHP gd PNG support              on      OK
PHP gd JPEG support             on      OK
PHP gd FreeType support         on      OK
PHP libxml                      2.9.1   2.6.15  OK
PHP xmlwriter                   on      OK
PHP xmlreader                   on      OK
PHP ctype                       on      OK
PHP session                     on      OK
PHP session auto start          off off OK
PHP gettext                     on      OK

  Resolve:


#vim /etc/php5/fpm/php.ini
...
385 #max_execution_time = 30
386 max_execution_time = 300
396 #max_input_time = 60
397 max_input_time = 300
675 #post_max_size = 8M
676 post_max_size = 32M
883 date.timezone ='Asia/Shanghai'
  make sure like this:



Current value   Required
PHP version 5.5.9-1ubuntu4.12   5.3.0   OK
PHP option memory_limit 128M    128M    OK
PHP option post_max_size        32M 16M OK
PHP option upload_max_filesize  2M  2M  OK
PHP option max_execution_time   300 300 OK
PHP option max_input_time       300 300 OK
PHP time zone                   Asia/Shanghai   OK
PHP databases support           MySQL   OK
PHP bcmath                      on      OK
PHP mbstring                    on      OK
PHP sockets                     on      OK
PHP gd                          2.1.1   2.0 OK
PHP gd PNG support              on      OK
PHP gd JPEG support             on      OK
PHP gd FreeType support         on      OK
PHP libxml                      2.9.1   2.6.15  OK
PHP xmlwriter                   on      OK
PHP xmlreader                   on      OK
PHP ctype                       on      OK
PHP session                     on      OK
PHP session auto start          off off OK
PHP gettext                     on      OK

  Step 3

Enter details for connecting to the database. Zabbix database must already be created.
  Step 4

Enter Zabbix server details.
  Step 5

Review a summary of settings.
  Step 6

Download the configuration file and place it under conf/.
  Step 7

Finish the installation.
  Step 8

Zabbix frontend is ready! The default user name is Admin, password zabbix.
ISSUES
missing libmysqld-dev


#./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
...
checking for mysql_config... no
configure: error: MySQL library not found
  Resolve:


#apt-get install -y libmysqld-dev

missing libxml2-dev


#./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
...
checking for xml2-config... no
configure: error: LIBXML2 library not found
  Resolve:


#apt-get install -y libxml2-dev

missing libsnmp-dev


#./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
...
checking for net-snmp-config... no
configure: error: Invalid Net-SNMP directory - unable to find net-snmp-config
  Resolve:


#apt-get install libsnmp-dev

missing libcurl4-openssl-dev


#./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
...
checking for curl-config... no
configure: error: Curl library not found

  Resolve:


#apt-get install -y libcurl4-openssl-dev

On the dashboard of zabbix, it’s display:


"Zabbix server is not running: the information displayed may not be current."
  Resolve:


## at first, test the port: 10051
# telnet localhost 10051
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
## use netstat to check
#netstat -anlp |grep 10051
## not found 10051
## check zabbix_server log
#less /tmp/zabbix_server.log
...
2317:20150901:140732.342 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'root'@'localhost' (using password: NO)
2317:20150901:140732.342 Database is down. Reconnecting in 10 seconds.
2317:20150901:140742.342 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'root'@'localhost' (using password: NO)
2317:20150901:140742.342 Database is down. Reconnecting in 10 seconds.
2317:20150901:140752.343 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'root'@'localhost' (using password: NO)
...
#vim /usr/local/etc/zabbix_server.conf
...
112 # DBPassword=
113 DBPassword=yourdbpassword
##and then,restart zabbix_server
#killall zabbix_server && zabbix_server

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-142606-1-1.html 上篇帖子: zabbix监控平台的安装 下篇帖子: Monitoring tomcat By zabbix
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表