CENTOS installation and deployment zabbix and centos deployment zabbix

Source: Internet
Author: User
Tags tru64

CENTOS installation and deployment zabbix and centos deployment zabbix

Http://www.showerlee.com/archives/13 ()

The rhce email has been sent, so I am free to update the previous documents.

The content I updated is mainly to add my current understanding to the configuration and tell you some ideas and ideas at that time. Instead of posting a lot of commands as many documents on the Internet, many friends who do not know this knowledge point are even more confused.

I have been interested in LINUX for more than half a year. Turning to LINUX is the goal of my future career ..


I recently studied ZABBIX, a popular open-source network monitoring system in the next group. After playing it all over again, ZABBIX is deeply simplified by its interface and its background configuration logic classification is clear, the advantages of easy configuration and getting started are attractive. The system of the unit is immediately replaced by the platform monitoring, and the results are good after a period of testing.

I have played cacti and nagios before, and it is a commonly used network management complementary combination in the industry. However, I personally feel that the former may cause data loss when the network is unstable due to the snmp protocol, although nagios does not rely on SNMP, the complicated installation of the client, initial configuration, and the need to understand the plug-in syntax of nagios may discourage many beginners.

Zabbix not only draws on the advantages of both plotting and dynamic monitoring, but also many plug-ins and common script templates are built-in in the system. The most important configuration is much simpler than the previous two, therefore, it saves a lot of learning costs. In addition, the monitoring system is written in the PHP language, so you do not need to modify the underlying code if the system is customized, you can directly set your preferred settings on the WEB interface and support font modification and simplified Chinese. We strongly recommend that you use this network management platform online.

Zabbix introduction (from Baidu encyclopedia)

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.

Main features of zabbix:

-Simple installation and configuration, low learning cost

-Supports multiple languages (including Chinese)

-Free Open Source

-Automatically discover servers and network devices

-Distributed monitoring and centralized WEB management

-Agent-free monitoring

-User security authentication and soft authorization Methods

-Set or view monitoring results on the WEB interface

-Email and other notification functions

Zabbix main functions:

-CPU load

-Memory usage

-Disk usage

-Network condition

-Port Monitoring

-Log monitoring


Disable iptables and SELINUX before configuration to avoid errors during installation.

# Service iptables stop

# Setenforce 0

# Vi/etc/sysconfig/selinux

---------------

SELINUX = disabled

---------------


1. Install the LAMP Environment

Ben Bo Portal: http://www.showerlee.com/archives/6


Ii. zabbix (server, agent) Configuration:

Server: 192.168.7.201

Agent: 192.168.7.249

To put it simply, zabbix_server and zabbix_agentd are installed on the server. The client only needs to install zabbix_agentd. The monitoring principle is that the zabbix_agentd service transfers the data obtained from the system to zabbix_server, then, the zabbix_server service displays the data on the PHP page, which is easy to understand.


(Server) indicates server-side configuration only

(Agent) indicates only client Configuration

(Server, agent) indicates that both the client and server must be configured.


1. Download zabbix (server, agent)

Note: I downloaded the stable and integrated compilation package from the official server 2.06 and the client. Therefore, pay attention to this during later compilation, the -- enable-server -- enable-agent parameter is compiled on the server and the -- enable-agent parameter is compiled on the client.

Another download method officially provided is the compilation package separately divided by the server and the client. The compilation method is different from the original method. Note the difference here.

# Wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.0.6/zabbix-2.0.6.tar.gz/download


2. Install the components required by zabbix (server, agent)

# Yum-y install curl-devel net-snmp-devel perl-DBI


3. Create a user account (server, agent)

# Groupadd zabbix

# Useradd-g zabbix

# Usermod-s/sbin/nologin zabbix


4. Create a zabbix database and import zabbix database data (server)

# Mysql-u root-p123456

> Grant all on zabbix. * to zabbix @ localhost identified by '123 ';

> Create database zabbix;

# Tar zxvf zabbix-2.0.6.tar.gz

# Cd zabbix-2.0.6

# Mysql-uzabbix-p123456 zabbix <database/mysql/schema. SQL

# Mysql-uzabbix-p123456 zabbix <database/mysql/images. SQL

# Mysql-uzabbix-p123456 zabbix <database/mysql/data. SQL


5. Compile and install (server, agent)

Server: (192.168.7.201)

#./Configure -- enable-server -- enable-agent -- with-mysql -- enable-ipv6 -- with-net-snmp -- with-libcurl

# Make install

Agent: (192.168.7.249)

#./Configure -- enable-agent

# Make install

Here, the zabbix configuration file uses the default path because I forgot the custom installation directory during compilation. Under/usr/local/etc, here, if you re-compile, there are many changes below, and the subsequent content is based on this path.

We recommend that you add the -- prefix =/usr/local/zabbix parameter during compilation. The zabbix configuration file is under the/usr/local/zabbix/etc directory by default, before starting the service, load the environment variables in the bin and sbin directories in the zabbix directory.

By default, the bin and sbin directories under the zabbix installation path/usr/local/are merged with the system, so no environment variables need to be loaded.


Finally, I have answers to the wrong article.

6. Edit the configuration file (server, agent)

# Cd/usr/local/etc/

Remove the configuration file comment:

# Cat zabbix_server.conf | grep-v "#" | grep-v "^ $"> zabbix_server.conf.bak

# Cp zabbix_server.conf.bak zabbix_server.conf

# Cat zabbix_agentd.conf | grep-v "#" | grep-v "^ $"> zabbix_agentd.conf.bak

# Cp zabbix_agentd.conf.bak zabbix_agentd.conf

Server: (192.168.7.201)

# Vi/usr/local/etc/zabbix_server.conf

Modify the following content and delete other unmodified parameter entries:

-------------

LogFile =/var/log/zabbix_server.log

DBHost = localhost

DBName = zabbix

DBUser = zabbix

DBPassword = 123456

-------------

# Vi/usr/local/etc/zabbix_agentd.conf

Modify the following content and delete other unmodified parameter entries:

-------------

LogFile =/var/log/zabbix_agentd.log

Server = 127.0.0.1, 192.168.7.201

UnsafeUserParameters = 1

-------------

Agent: (192.168.7.249)

# Vi/usr/local/etc/zabbix_agentd.conf

Modify the following content and delete other unmodified parameter entries:

-------------

LogFile =/var/log/zabbix_agentd.log

Server = 192.168.7.201

UnsafeUserParameters = 1

-------------

# Touch/var/log/zabbix_server.log

# Chmod 777/var/log/zabbix_server.log

# Touch/var/log/zabbix_agentd.log

# Chmod 777/var/log/zabbix_agentd.log


7. Start the daemon (server, agent)

Start zabbix_server on the server

# Zabbix_server

Server startup port 10051

Run zabbix_agentd on all monitored machines.

# Zabbix_agentd

The startup port of agentd is 10050.

Note: If the Server opens the iptables service, you need to add the two ports.

# Iptables-a input-p tcp -- dport 10050-j ACCEPT

# Iptables-a input-p tcp -- dport 10051-j ACCEPT

Note: to restart the service, kill the zabbix process and start it again in accordance with the preceding method.

# Pkill zabbix

# Ps-ef | grep zabbix

Or configure the boot script:

# Cd zabbix-2.0.6

# Cp misc/init. d/tru64/zabbix_server/etc/init. d/zabbix_server

# Cp misc/init. d/tru64/zabbix_agentd/etc/init. d/zabbix_agentd

# Cd/etc/init. d/

# Chmod 755 zabbix _*

# Vi zabbix_server

# Vi zabbix_agentd

#! In the file header #! Add the following two rows under the/bin/sh line:

--------------

# Chkconfig: 35 95 95

# Description: zabbix Agent server

--------------

Note: If the zabbix path is customized during compilation, you need to find the following lines:

DAEMON =/usr/local/sbin/zabbix_server

Change the following parameters to your custom path. This document uses the default path, which does not need to be modified here.

# Chkconfig -- add zabbix_server

# Chkconfig -- add zabbix_agentd

# Chkconfig zabbix_server on

# Chkconfig zabbix_agentd on

Restart the service:

# Service zabbix_server restart

------------------------------------------------------------------------------

Note: If the following error is reported when zabbix_server is started

/Usr/local/zabbix/sbin/zabbix_server: error while loading shared libraries: libmysqlclient. so.18: cannot open shared object file: No such file or directory

Add the mysql lib Library to the system library

# Locate libmysqlclient. so.18

/Usr/local/mysql/lib/libmysqlclient. so.18

/Usr/local/mysql/lib/libmysqlclient. so.18.1.0

# Echo "/usr/local/mysql/lib">/etc/ld. so. conf

# Ldconfig

# Service zabbix_server restart

--------------------------------------------------------------

# Service zabbix_agentd restart


8. Install zabbix web Interface (server)

Copy the zabbix php source code file

Zabbix server programs are written in php. Therefore, a server platform supporting LAMP architecture is required.

Now, copy the php source code file under frontends/php under the ZABBIX installation directory to the html file directory of the web server.

We recommend that you replace the apache html root directory with subdirectories or use the APACHE Virtual Host.

Here I chose the test environment for convenience.

Create a subdirectory, copy the PHP file of the zabbix terminal to the subdirectory, and run the following command:

# Mkdir/usr/local/apache2/htdocs/zabbix

# Cd frontends/php

# Cp-a./usr/local/apache2/htdocs/zabbix


Front-end Installation

Step 1

In your browser, enter url: http: // 192.168.7.201/zabbix, and you will see the first screen of the front-end Installation Wizard.

Step 2

Ensure that all dependent software is correctly installed.

Check the number of non-conforming items

You need to modify the parameters of the PHP file:

# Vi/usr/local/php5/lib/php. ini

Search for the following parameters and modify them:

----------------

Post_max_size = 16 M

Max_execution_time= 300

Max_input_time= 300

----------------

Load the gettext module in PHP

# Cd/root/php-5.4.13/ext/gettext

#/Usr/local/php5/bin/phpize

#./Configure -- with-php-config =/usr/local/php5/bin/php-config

# Make & make install

Load this module

# Vi/usr/local/php5/lib/php. ini

Add the following lines:

Extension = "/usr/local/php5/lib/php/extensions/no-debug-zts-20100525/gettext. so"

Restart the apache service

# Service httpd restart

Refresh page:

Step 3

Enter the zabbix database information set in the MYSQL Background:

DBName = zabbix

DBUser = zabbix

DBPassword = 123456

If an error is reported during connection testing, add the following command:

# Ln-s/var/lib/mysql. sock/tmp/mysql. sock


Step 4

Enter the zabbix server details

Step 5

Check the settings.

Step 6

Download the configuration file and place it in the/usr/local/apache2/htdocs/zabbix/conf/directory.


Step 8

The zabbix front-end is ready. The default user name is Admin and the password is zabbix.

Note: The following error is reported because zabbix data has not been imported to the MYSQL database:

The main interface of zabbix is configured on the server.

Manually Add hosts

 


Success...


Note:

1. display the Simplified Chinese interface

Click: Profile in the upper-right corner.

Select Chinese (zh_CN) and save:


2. Solve the Problem of Chinese garbled characters in zabbix plot:

A. Select a Chinese font from windows Control Panel> font, for example, ""

B. Copy it to the fonts directory of the zabbix web end, for example,/usr/local/apache2/htdocs/zabbix/fonts, and change the suffix of TTF to ttf.

C. Modify zabbix's web end include/defines. inc. php

# Cd/usr/local/apache2/htdocs/zabbix

# Vi include/defines. inc. php

Search for 'destousans'

Use "//" to comment out the system default line and add a new font Parameter Line.

Here, msyh is the font name and does not contain the ttf suffix.

----------------------

// Define ('zbx _ FONT_NAME ', 'javusans ');

Define ('zbx _ FONT_NAME ', 'msyh ');


// Define ('zbx _ GRAPH_FONT_NAME ', 'javusans ');

Define ('zbx _ GRAPH_FONT_NAME ', 'msyh ');


3. windows host monitoring:

: Http://www.zabbix.com/downloads/2.0.6/zabbix_agents_2.0.6.win.zip

Create a zabbix folder under C: \ Program Files \

Decompress the zip package and copy all the Files in bin/win64/to C: \ Program Files \ zabbix.

And create a zabbix_agentd.conf file under the directory. The content is

-------------------

LogFile = C: \ Program Files \ zabbix \ zabbix_agentd.log

Server = 192.168.7.11

UnsafeUserParameters = 1

-------------------

Go to the cmd command line:

# Cd C: \ Program Files \ zabbix

Install the zabbix client:

# Zabbix_agentd.exe-c "c: \ Program Files \ zabbix \ zabbix_agentd.conf"-I

Start zabbix:

# Zabbix_agentd.exe-c "c: \ Program Files \ zabbix \ zabbix_agentd.conf"-s

Parameter description:

-C. specify the location of the configuration file.

-I. Install the client

-S start the client

-X: stops the client.

-D. Uninstall the client.

:


Add the client host monitoring on the server ..


--------------- Success -----------------


ZabbixInConfigureWhen you encounter problems (CentOS) for you to answer:

In CentOS, when zabbix is installed for configure, the following four problems may occur:

./Configure -- enable-server -- enable-agent -- with-mysql -- with-net-snmp -- with-jabber -- with-libcurl

1 configure: error: MySQL library not found

The problem is not installed mysql-devel

 
 
  1. #yum install mysql-devel  
  2.  

2 configure: error: Jabber library not found

The problem is not installed jabber lib

 
 
  1. #wget http://iksemel.googlecode.com/files/iksemel-1.4.tar.gz  
  2.  

After the download is complete, decompress, configure, and install:

 
 
  1. tar zxvf iksemel-1.4.tar.gz  
  2.  
  3. cd iksemel-1.4  
  4.  
  5. configure  
  6.  
  7. make  
  8.  
  9. make install  
  10.  

After zabbix is configured, the problem still persists. You can specify the jabber directory as follows :#. /configure -- enable-server -- enable-agent -- with-mysql -- with-net-snmp -- with-jabber =/usr/local/-- with-libcurl

3 configure: error: Not found curl Library

 
 
  1. # Yum install curl-devel (this item is not tested)
  2.  

4 configure: error: Not found NET-SNMP library

 
 
  1. yum install net-snmp-devel  
  2.  

After reading the above four points, is there the same problem? Let's solve it by following the above steps!



After zabbix server monitoring is deployed, you can change the disk space alarm value. The default value seems to be an alarm when the disk space is less than 10%, and you want to change it to 10 Gb.

Modify the trigger.

Where is the pre-defined key storage location in zabbix?

In zabbix. agentd. conf, the statements at the end of zabbix are keys, which are added according to your own needs.
 

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.