Install zabbix 2.4.5 and centoszabbix in Centos source code

Source: Internet
Author: User

Install zabbix 2.4.5 and centoszabbix in Centos source code
Zabbix Introduction

Zabbix is an enterprise-level open-source solution that provides distributed system monitoring and network monitoring functions based on the WEB interface. Zabbix can monitor various network parameters to ensure secure operation of server systems. It also provides a soft notification mechanism for system administrators to quickly locate and solve various problems. Zabbix consists of two parts: zabbix server and the optional component zabbix agent. Zabbix server can provide remote server/network status monitoring, data collection and other functions through SNMP, zabbix agent, ping, port monitoring and other methods, it can run in Linux, Solaris, HP-UX, AIX, Free BSD, Open BSD, OS X, and other platforms. The zabbix agent must be installed on the monitored target server. It collects hardware information, memory, CPU, and other information related to the operating system. Zabbix agent can run on Linux, Solaris, HP-UX, AIX, Free BSD, Open BSD, OS X, Tru64/OSF1, Windows NT4.0, Windows 2000/2003/XP/Vista) and other systems. The zabbix server can independently monitor the service status of the remote server. It can also be used with the zabbix agent to poll the zabbix agent to actively receive monitoring data (trapping mode ), it can also passively receive data sent by zabbix agent (trapping mode ). In addition, zabbix server also supports SNMP (v1, v2) and can be used with SNMP software (for example, net-snmp.

Zabbix features
Easy installation and configuration, low learning cost, multi-language support (including Chinese) free, open-source, automatic discovery, distributed monitoring of servers and network devices, and centralized WEB management functions allow you to set or view monitoring results through the WEB interface without agent, user security authentication, and soft authorization methods. Mobile phone text messages and emails are supported. and other notification functions.
Main functions of Zabbix
CPU load memory usage disk network condition port monitoring log monitoring
Install fping because zabbix uses fping instead of ping as the icmp tool, you must install fping
You can download fping source code from the http://fping.sourceforge.net/, decompress the compilation and installation.

Fping is an enhanced ping tool that can ping multiple hosts at the same time.

Fping official website is: http://www.fping.com

wget http://fping.sourceforge.net/download/fping.tar.gz
tar -xvf /nfs/pkg/fping.tar.gz
cd fping-2.4b2_to/
./configure 
make && make install

After the installation is complete, there will be two files:

/Usr/local/sbin/fping# Execution File/Usr/local/man/man8/fping.8# Man File

Set fping permissions:

chown root:zabbix /usr/local/sbin/fping
chmod 710 /usr/local/sbin/fping
chmod ug+s /usr/local/sbin/fping

Then install traceroute:

yum install traceroute -y
Zabbix Installation
① Environment
1) Disable iptables
[root@k zabbix]# iptables -F
[root@k zabbix]# /etc/init.d/iptables save
 
2) Disable selinux
 
Edit File/Etc/sysconfig/selinuxSetSELINUX = enforcingTo:SELINUX = disabled
3) install related dependent packages
  yum -y install gcc mysql-server httpd php php-mysql php-gd php-bcmath php-xml php-mbstring mysql-devel php-snmp net-snmp-devel net-snmp  net-snmp-utils OpenIPMI-devel curl-devel
② Download unzip tar xvf zabbix-2.4.5.tar.gz-C/usr/local add zabbix user and group groupadd zabbix useradd zabbix-g zabbix-s/sbin/nologin ③ configure zabbix database to start MySQL database: service mysqld start modify MySQL root User password (the default password is blank) mysqladmin-u root-p password 123456 enter the database: mysql-u root-pmysql> create database zabbix default charset utf8;
Mysql> grant all on zabbix. * to zabbix @ 'localhost' identified by '123 ';
Mysql> grant all on zabbix. * to zabbix @ '2017. 0.0.1 'identified by '20160301 ';
Mysql> flush privileges; (refresh permission configuration)
quit
Import tables and data: cd/usr/local/zabbix-2.4.5/database/mysqlmysql-u zabbix-p123456 zabbix <schema. SQL (redirect the mysql. SQL file in zabbix TO THE zabbix database)
Mysql-u zabbix-p123456 zabbix <images. SQL (sequential)
mysql -u zabbix -p123456 zabbix  < data.sql
④ Compile and install zabbix
 
cd /usr/local/zabbix-2.4.5;
./configure --sysconfdir=/etc/zabbix  --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-libcurl --with-net-snmp --with-openipmi
make && make install
Configuration File
Modify vi/etc/zabbix/zabbix_server.conf as follows:
DBName = zabbix <--- database DBUser = zabbix used by zabbix <--- username DBPassword used by zabbix to connect to mysql = 123456 <---- password used by zabbix to connect to mysql
DBSocket =/var/lib/mysql. sock <--- if the local database is connected, make sure that the socket path is correct.
FpingLocation =/Usr/local/sbin/fping <--- modify the default icmp tool to fping
 
 vi /etc/zabbix/zabbix_agentd.conf
Server = 192.168.66.16 <---- pointing to the ip address of the zabbix Server
ServerActive = 192.168.66.16 <---- pointing to the ip address of the zabbix Server
Hostname = 192.168.66.16 <--- hostname or ip address of the Local Machine (zabbix client)
Add a web Front-end PHP File
 cd /usr/local/zabbix-2.4.5/frontends/
 cp -rf php /var/www/html/zabbix
 chown -R zabbix:zabbix /var/www/html/zabbix
Web Front-end installation Configuration
Vi/etc/php. ini: Modify the related php parameters max_execution_time = 600 max_input_time = 600 date. timezone = Asia/Shanghai post_max_size = 32 M memory_limit = 256 M vi/etc/httpd/conf/httpd. conf DirectoryIndex index. php index.html # LoadModule foo_module modules/mod_foo.so LoadModule php5_module modules/libphp5.so
Start the service
 /etc/init.d/httpd start  /etc/init.d/mysqld start /usr/local/zabbix/sbin/zabbix_server start 
 /usr/local/zabbix/sbin/zabbix_agentd start
Configure Zabbix Server 
Access the Zabbis Serve address in the local browser to start web Front-end configuration. http: // 192.168.66.16/zabbix follow the prompts to go to next step, step 3 Check of pre-requisites must be configured after all items are OK. If fail is prompted, go to the server to Check whether the package is installed or whether the configuration is changed according to the above steps. Six steps are required, for example:
A) Go to the installation page and click Next.

 

B) Make sure all monitoring items are OK. click Next.

C) Fill in the username, password, address, and other information of the zabbix database, click Test connection, OK, and click Next

("Medium Database name" is the name of the Database created earlier, and "User" is the zabbix Database User connecting to MySQL created earlier. "Password" is the Password used to connect to the MySQL Database created earlier, the password used in this experiment is 123456; Test connection must be OK before proceeding to the next step)
D) fill in information about the zabbix server, host name, port listened by the server program, Host IP address, etc. If the server and web server are on the same server by default, click Next

E) If you have confirmed that the information entered in the previous sections is correct, click Next.

F) Check the config file of the web program. If there is no problem, it will show OK. Click finish to complete the installation. (if there is a problem, the permission of the zabbix virtual host directory file is usually incorrect, the process with the above settings is generally normal)

If an error occurs, follow the prompts (click

Click to download the configuration file, copy the downloaded file to/var/www/html/zabbix/conf/, and rename it zabbix. conf. php: Modify the file owner to zabbix {command chown zabbix. zabbix/var/www/html/zabbix/conf/zabbix. conf. php}, click the Retry button, and click Finish)

If a wrong password or user name is entered due to a wrong hand, an error will always be reported later, you can manually edit the configuration file vim/var/www/html/zabbix/conf/zabbix. conf. php manually defines related parameters.
G) Go to the logon page and click "Log On". The default account password is admin/zabbixh. Add a monitoring item to enter Configuration-> Hosts, Select Zabbix Server, and then Activate Select and Activate monitoring of Zabbix Server (Local Machine. Log on to the Monitoring Dashboard and you can see the Monitoring Result of Zabbix Server (this must be ensured that the zabbix_agentd.conf configuration file will take effect by default). Note that after the agent is configured, add the host, you need to add a template to display the green connection. Create a metric item: 1) Enter Configuration-Hosts selection button 2) After performing the first step, the interface shown in the figure will be displayed. Change the red part to the IP address of the agent, the value of Host name must be the same as the value in agent zabbix_agentd.conf. 3) Add a template (you must add a template to obtain the monitoring data), and click the options in, the page is displayed. 4) Click select in to list all zabbix templates. select the template to be added and click add to add the template, finally, click the Update button to complete the addition of monitoring. Zabbix client configuration: it is best to keep the server time synchronization

Decompress, compile, and install the SDK using the root user

tar -xvf /nfs/pkg/zabbix-2.0.3.tar.gz;cd zabbix-2.0.3./configure --prefix=/usr/local/zabbix/ --sysconfdir=/etc/zabbix/ --enable-agentmake make install

To facilitate IO monitoring, install sysstat and execute the following command:

yum install sysstat -y
Sed-I s/10.71.xx.xx/$ HOST_IP/g/etc/zabbix/zabbix_agentd.conf: Change the Hostname = 10.71.xx.xx in the configuration file/etc/zabbix/zabbix_agentd.conf to the IP, for example, 241 Hostname = $ HOST_IP changes DisableActive = 0 to # DisableActive = 0 and ServerPort = 10051 to # ServerPort = 10051.

Add a scheduled task to collect monitoring data:

Run the following command: crontab-e-u zabbix: # run zabbix data gathering for custom checks every min */3 *****/usr/bin/sudo/etc/zabbix/scripts/zabbix_tomcat_cron.sh>/dev/null 2> & 1 * ***/etc/zabbix/scripts/zabbix_vmstat_cron.sh>/dev/null 2> & 1 *****/etc/zabbix/scripts/zabbix_iostat_cron.sh>/dev/null 2> & 1 *****/etc/zabbix/scripts/zabbix_tcpConStat_cron.sh>/dev/null 2> & 1 *****/usr/bin/sudo/etc/ zabbix/scripts/zabbix_fileSocket_cron.sh>/dev/null 2> & 1 *****/etc/zabbix/scripts/zabbix_DbConnStat_cron.sh>/dev/null 2> & 1

Set the permissions for some special scripts:
Run the following command: Modify visuults requiretty to # Defaults requiretty and add: Cmnd_Alias SU =/bin/su-Cmnd_Alias SUWWW =/bin/su-www xujing ALL = (root) NOPASSWD: SU, SUWWW, SERVICESCmnd_Alias FILESOCKET =/etc/zabbix/scripts,/etc/zabbix/scripts/zabbix_tomcat_cron.sh,/etc/zabbix/scripts/file_socket.sh, /usr/bin/sudo,/bin/su,/bin/killzabbix ALL = (root) NOPASSWD: FILESOCKET

Set the startup service:
Run the following command: cp/nfs/script/zabbix_agentd/etc/init. d/chmod + x/etc/init. d/zabbix_agentdchkconfig -- add zabbix_agentdchkconfig zabbix_agentd on

Start zabbix_agentd:
Run the following command:/etc/init. d/zabbix_agentd start

Check the log to confirm that there is no exception during startup:
tail -100 /tmp/zabbix_agentd.log220.web.lg-9-8.zwc.com<2013-04-21 01:26:10> ~/zabbix-2.0.3root># tail -100 /tmp/zabbix_agentd.log19506:20130421:012610.832 Starting Zabbix Agent [10.0.0.220]. Zabbix 2.0.3 (revision 30485).19507:20130421:012610.832 agent #0 started [collector]19509:20130421:012610.833 agent #1 started [listener]19510:20130421:012610.833 agent #2 started [listener]19511:20130421:012610.834 agent #3 started [listener]
Zabbix Proxy Server Installation Configuration 

Zabbix supports distributed monitoring and is deployed through zabbix_proxy to collect and forward monitoring data in a centralized area to Zabbix Server. Principle

Preparations before installation 

Create zabbix users:

groupadd zabbix -g 504;useradd zabbix -u 504 -g zabbix

Install the dependent software package:

yum install -y net-snmp-devel curl-devel mysql-devel traceroute net-snmp-utils OpenIPMI-devel

Create a directory required for running and configure the permissions:

mkdir /var/log/zabbix;chown -R zabbix.zabbix /var/log/zabbix/mkdir /var/run/zabbix; chown -R zabbix.zabbix /var/run/zabbix/

In addition, you also need to prepare a mysql database to store the monitoring data collected by zabbix_proxy.

Install

Compile and install fping

See compile and install fping

Compile and install zabbix_proxy

tar -zxvf zabbix-1.8.10.tar.gz;cd zabbix-1.8.10./configure --prefix=/usr/local/zabbix --enable-agent --with-mysql --with-libcurl --with-net-snmp --with-openipmimake make install
Configure the Startup Script

 

FAQs: zabbix image garbled Solution
1. upload C: \ WINDOWS \ Fonts \ simhei of the local mongown system. ttf file to zabbix/fonts in the zabbixweb directory. 2.vi zabbix/include/defines. inc. php replaces all DejaVuSans with simhei
Zabbix Template 
Official configuration has a lot of templates, refer to http://www.zabbix.com/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.