zabbix environment to build the deployment of (a)

zabbix environment to build the deployment of (a)

 Monitoring alarm reliable operation and maintenance  2 years ago (2017-11-30)  4845 ° C for  0 comments    

A, zabbix Introduction

zabbix official website: https://www.zabbix.com/

zabbix download page: https://www.zabbix.com/download

zabbix rpm package download page: http: //repo.zabbix.com/zabbix/

About 1.1 zabbix

zabbix is based on providing a distributed system monitoring and network monitoring capabilities WEB interface, enterprise-class open source solutions.
zabbix can monitor various network parameters to ensure safe operation of the server system; and to provide a flexible notification mechanism to allow system administrators to quickly locate / solve problems.
zabbix consists of two parts, zabbix server and optional components zabbix agent.
zabbix server can provide monitoring, data collection and other functions on the remote server / network status through SNMP, zabbix agent, ping, port monitoring and other methods, it can run on Linux, Solaris, HP-UX, AIX, Free BSD, Open BSD, OS X and other platforms.

Said bluntly, is zabbix we are all familiar, is now more popular with a distributed control system, of course, people are now Open-Falcon (millet monitoring) is now used more and more.

1.2 zabbix components

zabbix consists of the following component parts:

Zabbix Server: agent responsible for receiving information sent by the core component of the report, all configuration, statistical and operational data will be held by their organization.
Database Storage: dedicated to storing all the configuration information, and data collected by zabbix.
Web interface: zabbix the GUI interface, usually on the same host Server running.
Proxy: optional components commonly used in the distributed monitoring environment, the proxy Server collects monitoring data terminal section monitored and sent to the Server unified end (to achieve non-essential components of a distributed monitoring dedicated components are excessive or across the room monitoring server can use this components.)

Agent: deployed on the monitored host, is responsible for collecting local data and sent to the Proxy Server side or end.
Note: zabbix node is zabbix one kind of server. But now it has basically abandoned.

1.3 zabbix monitoring environment related terms

Host (host): to monitor network devices, designated by the IP or DNS name

Host group (host group): the host logical container may contain a host and template, but within the same organization and the master template can not be linked to each other; host group commonly used in assigning monitoring privileges to users or user groups

Monitoring item (item): a specific data related to monitoring indicators; these data from the monitored object; zabbix item is at the heart of data collection, relative to a monitored object, each item by "key" to identify
the trigger ( trigger): an expression within a particular data item is received for assessing whether the monitored object is within a reasonable range, i.e. the threshold value; when the received data is larger than the threshold value, a trigger condition from "OK" to " Problem ", when the data is once again restored to a reasonable range, but also into" OK "
event (event): trigger a matter of concern, such as triggers state transition, the new agent or automatic re-register on-line agent and other
actions (action ): means for processing a specific event defined in advance, such as sending a notification, the operation performed when
an alarm upgrade (Escalation): transmitting an alarm or execute remote commands custom program, such as an alert sent once every five minutes, a total of five transmission other
media (media): means for sending the notification or channel, such as Email, Jabber, or the like SMS
notification (notification : The information about a selected media event sent to the user
remote command (remote command): predefined commands can be executed automatically at a certain time under certain conditions in the monitored host
template (template): for quick definition is a collection of pre-entry monitoring host, usually containing the item, trigger, graph, screen, application , and low-level discovery rule; templates can be linked directly to a host
application (application): a group item of the collection
web scene (web scennario ): a web site for detecting the availability of a plurality of HTTP requests or

Front end (frontend): Zabbix the web interface

Two, zabbix installation

2.1 server installation (Centos6)

 (1). Yum install the necessary environment

# yum install httpd php http-devel php-devel php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp-devel curl-devel unixODBC-devel OpenIPMI-devel java-devel -y

# yum install -y libssh2-devel

# yum install -y openldap openldap-devel

Note (There are two separate lists yum come, because our translation parameters are more, not yum two lines of the above words will complain):

Bash
如果报错:configure: error: SSH2 library not found
就yum install -y libssh2-devel
如果报错:configure: error: Invalid LDAP directory - unable to find ldap.h
就:yum install openldap openldap-devel

(2). 配置php环境
sed -i “s/;date.timezone =/date.timezone = Asia\/Shanghai/g” /etc/php.ini
sed -i “s#max_execution_time = 30#max_execution_time = 300#g” /etc/php.ini
sed -i “s#post_max_size = 8M#post_max_size = 32M#g” /etc/php.ini
sed -i “s#max_input_time = 60#max_input_time = 300#g” /etc/php.ini
sed -i “s#memory_limit = 128M#memory_limit = 128M#g” /etc/php.ini
sed -i “s/;mbstring.func_overload = 0/mbstring.func_overload = 0\n/” /etc/php.ini

(3) Install the server zabbix

# wget prdownloads.sourceforge.net/zabbix/zabbix-2.4.8.tar.gz
# groupadd zabbix -g 201
# useradd -g zabbix -u 201 -m zabbix

# tar zxf zabbix-2.4.8.tar.gz
# cd zabbix-2.4.8

# ./configure –prefix=/usr/local/zabbix-2.4.8 –sysconfdir=/etc/zabbix –enable-server –enable-proxy –enable-agent –enable-ipv6 –with-mysql=/usr/bin/mysql_config –with-net-snmp –with-libcurl –with-openipmi –with-unixodbc –with-ldap –with-ssh2 –enable-java
# make && make install  #其实make install就可以了

# ln -s /usr/local/zabbix-2.4.8 /usr/local/zabbix

(4) Add the file system services to zabbix

# Cat / etc / services | grep zabbix # can look at, not to add default have been added

Bash
zabbix-agent    10050/tcp               # Zabbix Agent
zabbix-agent    10050/udp               # Zabbix Agent
zabbix-trapper  10051/tcp               # Zabbix Trapper
zabbix-trapper  10051/udp               # Zabbix Trapper

(5) .mysql configuration

# Vi /etc/my.cnf # Configure what mysql configuration file, allowed to use utf-8, and to do innodb settings, because the main function is to write

Bash
[client]
port=3306
socket=/var/lib/mysql/mysql.sock
[mysqld] port=3306 socket=/var/lib/mysql/mysql.sock default-storage-engine=innodb default-table-type=innodb ignore-builtin-innodb plugin-load=innodb=ha_innodb_plugin.so plugin_dir=/usr/local//mysql/lib/plugin/ datadir=/mysqldata skip-external-locking character-set-server = utf8 collation-server=utf8_general_ci #logs slow_query_log slow_query_log_file =/var/log/mysql/slowquery.log long_query_time=2 log_error=/var/log/mysql/mysql-error.log #limits skip-name-resolve max_connections=5000 back_log=300 table-cache=4096 max_allowed_packet =32M max_heap_table_size =128M key_buffer_size=128M sort-buffer-size=16M join-buffer-size=16M net_buffer_length=8K read_buffer_size=256K read_rnd_buffer_size=256K myisam_sort_buffer_size=8M thread-cache-size=16 thread-concurrency=24 query-cache-size=2048M query-cache-limit=4M tmp_table_size=256M log_warnings #innodb innodb_file_per_table=1 innodb_file_io_threads=4 innodb_open_files=2048 innodb_buffer_pool_size=5G innodb_additional_mem_pool_size=128M innodb_thread_concurrency=16 innodb_max_dirty_pages_pct=90 user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 [mysqldump] quick max_allowed_packet=16M [myisamchk] key_buffer_size=20M sort_buffer_size=20M read_buffer=2M write_buffer=2M [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid

# mkdir /mysqldata
# chown mysql:mysql /mysqldata/
# /etc/init.d/mysqld restart

(6). Zabbix import database

# Mysqladmin -uroot password '123456' #mysql initial password is no, we are here to set up a simple bar code, the actual production is very complicated password
# MySQL-uroot--p123456 -e 'the Create Database Character zabbix the SET utf8;'
# MySQL - -e -p123456 -uroot "Grant All privileges ON * zabbix to zabbix @ localhost IDENTIFIED by 'zabbix';."
# MySQL-uroot--p123456 -e "flush privileges;"
# MySQL -uzabbix -pzabbix zabbix </ root / zabbix- 2.4.8 / database / mysql / schema.sql # sql the import file can not change the order, or to be given
# MySQL -uzabbix -pzabbix ZABBIX </root/zabbix-2.4.8/database/mysql/images.sql
# MySQL -pzabbix ZABBIX -uzabbix </root/zabbix-2.4.8/database/mysql/data.sql
(. 7). startup script and copy configuration

# cp /root/zabbix-2.4.8/misc/init.d/fedora/core/zabbix_* /etc/init.d/
# sed -i “s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#” /etc/init.d/zabbix_server

# sed -i “s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#” /etc/init.d/zabbix_agentd

(8) .zabbix master profile modification

# Cat /etc/zabbix/zabbix_server.conf|grep -v "^ #" | grep -v "^ $" # simple configuration a bit, mainly to configure account and password to connect database

Bash
LogFile=/var/zabbix/zabbix_server.log
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
ListenIP=127.0.0.1

Mkdir # / var / zabbix
# chown zabbix: zabbix / var / zabbix /
(9) a copy of the page file to the web site directory.

Cp -r /root/zabbix-2.4.8/frontends/php # / var / the WWW / HTML / zabbix
# chown the Apache: the Apache / var / the WWW / HTML / conf # zabbix under this directory, the program to be created / a php, of course, not authorized, then wait until the installation department where, under php files can also be downloaded.

(10). Zabbix configured via a web page

http://192.168.1.102/zabbix   # access url format is IP / zabbix format

# Then follow the prompts to the next step, what to fill it fill what, this web guide installation interface is relatively simple.

Pictures .png

# After successful installation, visit the above url again, is the login page, the default account is admin, password is zabbix.

2.2 server installation (Centos7)

Now more and more online with Centos7 system, zabbix version also becomes the 3 series, although I was online zabbix 2.4 series, but with a new version of a trend, are back with a new version of the operating Example.

 (1). Yum install the necessary environment

# Yum install httpd php php-devel php-pear php-xmlrpc php-bcmath mariadb mariadb-server mariadb-devel httpd-manual mod_ssl php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath libdbi -dbd-mysql net-snmp-devel curl-devel unixODBC-devel OpenIPMI-devel java-devel -y # the main difference here is the mysql changed mariadb.

# yum install -y libssh2-devel

# yum install -y openldap openldap-devel

(2). 配置php环境
sed -i “s/;date.timezone =/date.timezone = Asia\/Shanghai/g” /etc/php.ini
sed -i “s#max_execution_time = 30#max_execution_time = 300#g” /etc/php.ini
sed -i “s#post_max_size = 8M#post_max_size = 32M#g” /etc/php.ini
sed -i “s#max_input_time = 60#max_input_time = 300#g” /etc/php.ini
sed -i “s#memory_limit = 128M#memory_limit = 128M#g” /etc/php.ini
sed -i “s/;mbstring.func_overload = 0/mbstring.func_overload = 0\n/” /etc/php.ini

(3) Install the server zabbix

# wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.2.6/zabbix-3.2.6.tar.gz

# groupadd zabbix -g 201
# useradd -g zabbix -u 201 -m zabbix

# tar zxf zabbix-3.2.6.tar.gz
#cd zabbix-3.2.6
# ./configure –prefix=/usr/local/zabbix-3.2.6  –sysconfdir=/etc/zabbix  –enable-server  –enable-proxy  –enable-agent  –enable-ipv6  –with-mysql=/usr/bin/mysql_config  –with-net-snmp  –with-libcurl  –with-openipmi  –with-unixodbc  –with-ldap  –with-ssh2  –enable-java
# make install
# ln -s /usr/local/zabbix-3.2.6 /usr/local/zabbix

Note: To support the monitoring zabbix vmware at compile time, there must configure -with-libxml2 -with-libcurl, the former calling for parsing XML SOAP interface has returned, which used to call vcenter the SOAP interface.

Let us understand the parameters under ./configure behind with meanings:

# ./configure  –help

Bash
可选功能:
--enable-static  #构建静态链接的二进制文件
--enable-server  #打开Zabbix服务器的构建
--enable-proxy   #打开Zabbix代理的构建
--enable-agent   #打开Zabbix代理和客户端实用程序的构建
--enable-java    #打开Zabbix支持监控java,zabbix 监控jmx 需要--enable-java --enable-ipv6 #打开zabbix对ipv6的支持 可选包: --with-mysql[=ARG] #使用MySQL客户端库[default = no],可选指定mysql_config的路径 --with-jabber[=DIR] #包括Jabber支持[default = no]。 DIR是iksemel库安装目录。如果要使用Jabber协议进行消息传递. --with-libxml2[=ARG] #使用libxml2客户端库[default = no],可选地指定xml2-config的路径.如果要使用XML库 --with-unixodbc[=ARG] #使用ODBC驱动程序对unixODBC包[default = no],可选地指定odbc_config二进制的完整路径。如果要使用unixODBC库 --with-net-snmp[=ARG] #使用Net-SNMP包[default = no],可选地指定net-snmp-config的路径.如果要使用Net-SNMP库 --with-ssh2[=DIR] #使用SSH2包[default = no],DIR是SSH2库的安装目录。如果要使用基于SSH2的检查 --with-openipmi[=DIR] #包括OPENIPMI支持[default = no]。 DIR是OPENIPMI基本安装目录,默认是通过OPENIPMI文件的一些常见位置进行搜索。如果要检查IPMI设备 --with-mbedtls[=DIR] #使用mbed TLS(PolarSSL)软件包[default = no],DIR是libpolarssl安装目录。如果要使用由mbed TLS(PolarSSL)库提供的加密 --with-gnutls[=DIR] #使用GnuTLS包[default = no],DIR是libgnutls的安装目录。如果要使用GnuTLS库提供的加密 --with-openssl[=DIR] #使用OpenSSL包[default = no],DIR是libssl和libcrypto的安装目录。如果要使用OpenSSL库提供的加密 --with-ldap[=DIR] #包括LDAP支持[default = no]。DIR是LDAP基本安装目录,默认是通过LDAP文件的多个常见位置进行搜索。如果要检查LDAP服务器. --with-libcurl[=DIR] #使用cURL包[default = no],可选地指定curl-config的路径.如果要使用cURL库 如果要指定iconv安装目录: --with-iconv=[DIR] #使用iconv从给定的基本安装目录(DIR),默认是通过一些常见的地方搜索iconv文件。 --with-iconv-include=[DIR] #使用iconv包含给定路径的头。 --with-iconv-lib=[DIR] #从给定的路径使用iconv库。

(4) Import database zabbix

# systemctl start mariadb.service

# mysqladmin -uroot password ’123456′

# mysql -uroot -p123456 -e ‘create database zabbix character set utf8;’
# mysql -uroot -p123456 -e “grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix’;”
# mysql -uroot -p123456 -e “flush privileges;”

# mysql -uzabbix -pzabbix zabbix </root/zabbix-3.2.6/database/mysql/schema.sql

# mysql -uzabbix -pzabbix zabbix </root/zabbix-3.2.6/database/mysql/images.sql

# mysql -uzabbix -pzabbix zabbix </root/zabbix-3.2.6/database/mysql/data.sql

(5) copies of the startup scripts and configuration

# cp /root/zabbix-3.2.6/misc/init.d/fedora/core/zabbix_* /etc/init.d/
# sed -i “s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#” /etc/init.d/zabbix_server

# sed -i “s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#” /etc/init.d/zabbix_agentd

(6) .zabbix master profile modification

# Cat /etc/zabbix/zabbix_server.conf|grep -v "^ #" | grep -v "^ $" # simple configuration a bit, mainly to configure account and password to connect database

Bash
LogFile=/var/zabbix/zabbix_server.log
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
ListenIP=127.0.0.1

# mkdir /var/zabbix
# chown zabbix:zabbix /var/zabbix/

(7). Web page copy files to the web site directory

Cp -r /root/zabbix-3.2.6/frontends/php # / var / the WWW / HTML / zabbix
# chown the Apache: the Apache / var / the WWW / HTML / conf # zabbix under this directory, the program to be created / a php, of course, not authorized, then wait until the installation department where, under php files can also be downloaded.

(8). Zabbix configured via a web page

http://192.168.1.103/zabbix   # access url format is IP / zabbix format

Pictures .png

Pictures .png

Pictures .png

Pictures .png

Pictures .png

Pictures .png

# And then jump to the login screen, the user name is admin, password is zabbix

How to display Chinese 2.3 server web show

Pictures .png

Click the icon in the top right corner of the villain #

Pictures .png

# /Etc/init.d/zabbix_server start # start zabbix_server Service

agent # /etc/init.d/zabbix_agentd start # also start up the machine, in order to see the effect in FIG.

Pictures .png

# Home from it all has become Chinese.

# But there is a problem see below:

Pictures .png

# Can be seen from the figure, all the characters are white frame is not shown.

Solution:

Windos into the local directory: C: \ Windows \ Fonts (with Microsoft elegant black msyh.ttf for example).

The windows side msyh.ttf upload files to the server's / var / www / html / zabbix / fonts directory.

#ls -l /var/www/html/zabbix/fonts/msyh.ttf # look really exist

Bash
-rw-r--r-- 1 root root 21767952 6月  11 2009 /var/www/html/zabbix/fonts/msyh.ttf

# vim /var/www/html/zabbix/include/defines.inc.php +45

define(‘ZBX_GRAPH_FONT_NAME’,           ‘DejaVuSans’);  替换为:define(‘ZBX_GRAPH_FONT_NAME’,           ‘msyh’);   #就是DejaVuSans替换为msyh

Pictures .png

#再次刷新web页面,在数据图上面的中文字体也就都显示出来了。

2.4 zabbix客户端的安装

# wget prdownloads.sourceforge.net/zabbix/zabbix-3.2.6.tar.gz
# groupadd zabbix -g 201
# useradd -g zabbix -u 201 -m zabbix
# tar zxf zabbix-3.2.6.tar.gz
# cd zabbix-3.2.6

# ./configure –prefix=/usr/local/zabbix-3.2.6 –sysconfdir=/etc/zabbix  –enable-agent

# make install
# ln -s /usr/local/zabbix-3.2.6 /usr/local/zabbix

# cp /root/zabbix-3.2.6/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
# sed -i “s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#” /etc/init.d/zabbix_agentd

# vim /etc/zabbix/zabbix_agentd.conf  #就先修改一个地方,让Server端指向zabbix_server的IP地址
Server=192.168.1.103
# /etc/init.d/zabbix_agentd restart
2.5 zabbix服务器端添加刚刚添加的zabbix客户端主机

首先创建一个主机组

配置==》主机群组==》创建主机群组(web页面右上角)==》添加组名,如:Zabbix agents(在弹出框中输入组名)==>添加

添加一个主机

配置==》主机==》右上角在群组那里选择Zabbix agents==》点击创建主机   #如下图

Pictures .png

下面是主机的添加过程:

Pictures .png

给此主机引用一条模板:

在上面那张图片中可以看到主机的右边有个模板,点击模板,链接指示器那一栏点击选择按钮,然后选择你要添加的模板,点击添加,然后返回到模板界面之后,再点击下面的添加按钮,然后点击更新。

Pictures .png

下面是添加完的效果图:

Pictures .png

最后看下图形效果:

检测中==》图形==》然后就是选择要看什么了,如下图:

Pictures .png

到此一个简单的zabbix服务端监控一个客户端的操作就算结束了。

有一个小问题:

Too many processes on Zabbix server

Too many processes on 192.168.1.104

Pictures .png

配置==》模板==》Template OS Linux ==》触发器 ==>Too many processes on {HOST.NAME}(点击)==》表达式改为:{Template OS Linux:proc.num[].avg(5m)}>1000==>更新

#因为原来触发器里面的进程数太少了,zabbix本身就会启动二三十个左右的进程,所以很容易就超了,把进程监控调大一点。

Pictures .png

 

Reproduced please specify: reliable operation and maintenance  >>  zabbix environment to build the deployment of (a)

Like ( 4) or shared ( 0)

Guess you like

Origin www.cnblogs.com/xiexun/p/10965639.html