Linux Monitoring Platform

Source: Internet
Author: User

1. Installing Zabbix
Official website Www.zabbix.com/download
wget repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
RPM-IVH zabbix-release-3.2-1.el7.noarch.rpm
Yum install-y zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql//zabbix-agent client software; zabbix-get Server-side tools, you can obtain client data through the command line; zabbix-server-mysql files related to MySQL; Zabbix-web web interface; zabbix-web-mysql Web-related files for MySQL
Installation Results
has been installed:
zabbix-agent.x86_64 0:3.2.11-1.el7 zabbix-get.x86_64 0:3.2.11-1.el7 zabbix-server-mysql.x86_64 0:3.2.11-1.el7 Zabbix-web.noarch 0:3.2.11-1.EL7
Zabbix-web-mysql.noarch 0:3.2.11-1.EL7

To be installed as a dependency:
openipmi-libs.x86_64 0:2.0.19-15.el7 openipmi-modalias.x86_64 0:2.0.19-15.el7 dejavu-fonts-common.noarch 0:2.33-6. El7 Dejavu-sans-fonts.noarch 0:2.33-6.el7
Fontpackages-filesystem.noarch 0:1.44-8.el7 fping.x86_64 0:3.10-4.el7 iksemel.x86_64 0:1.4-6.el7 libX11.x86_64 0:1.6.5-1.el7
Libx11-common.noarch 0:1.6.5-1.el7 libxau.x86_64 0:1.0.8-2.1.el7 libxpm.x86_64 0:3.5.12-1.el7 libxcb.x86_64 0:1.12-1. El7
libzip.x86_64 0:0.10.1-8.el7 php.x86_64 0:5.4.16-43.el7_4.1 php-bcmath.x86_64 0:5.4.16-43.el7_4.1 php-cli.x86_64 0:5.4.16-43.el7_4.1
php-common.x86_64 0:5.4.16-43.el7_4.1 php-gd.x86_64 0:5.4.16-43.el7_4.1 php-ldap.x86_64 0:5.4.16-43.el7_4.1 Php-mbstring.x86_64 0:5.4.16-43.el7_4.1
php-mysql.x86_64 0:5.4.16-43.el7_4.1 php-pdo.x86_64 0:5.4.16-43.el7_4.1 php-xml.x86_64 0:5.4.16-43.el7_4.1 t1lib.x86 _64 0:5.1.2-14.EL7
Unixodbc.x86_64 0:2.3.1-11.EL7

Will install httpd and PHP
VIM/ETC/MY.CNF//need to add configuration
Character_set_server = UTF8 for Web pages to display Chinese
After restarting the MYSQLD service, go to the MySQL command line and create the Zabbix library
Create database Zabbix character set UTF8;
Re-create User
Grant all on Zabbix. * to ' Zabbix ' @ ' 127.0.0.1 ' identified by ' 123456 ';
Import data
cd/usr/share/doc/zabbix-server-mysql-3.2.11
Gzip-d create.sql.gz
Mysql-uroot-pxxx Zabbix < Create.sql
Systemctl start httpd; Systemctl Enable httpd
vim/etc/zabbix/zabbix_server.conf//Modify or add
dbhost=127.0.0.1//Added above Dbname=zabbix, corresponding to the previous text
dbpassword=123456//Added below Dbuser, corresponding to the previous text
Systemctl Start Zabbix-server
Systemctl Enable Zabbix-server
Log file:/var/log/zabbix/zabbix_server.log
NETSTAT-LNTP |grep Zabbix//view listening port
Zabbix Monitoring 10051 ports
The browser accesses the Http://ip/zabbix/web interface under configuration Zabbix

Install the Web page step by step (appears php option "Date.timezone" unknown Fail, need to set the time zone: Vi/etc/php.ini settings Timezone=asia/shanghai)
User name Admin password Zabbix
The first thing to do in the background is to change the password
If you have forgotten your password:
Go to MySQL command line and select Zabbix Library
Mysql-uroot-p Zabbix
Update users set PASSWD=MD5 (' newpasswd ') where alias= ' Admin ';
This changes the password for the Admin user
Client Installation
wget repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
RPM-IVH zabbix-release-3.2-1.el7.noarch.rpm
Yum Install-y zabbix-agent
vim/etc/zabbix/zabbix_agentd.conf//Modify the following configuration
server=127.0.0.1 modified to server=192.168.133.130//define the IP of the server (passive mode)
serveractive=127.0.0.1 modified to serveractive=192.168.133.130//define IP (Active mode) for the server
Hostname=zabbix Server modified to hostname=slx-123//This is a custom hostname, and you will need to set the same host name under the Web interface.
Systemctl Start Zabbix-agent
Systemctl Enable Zabbix-agent
Monitoring port is 10050

2. Working mode
Active or passive is relative to the client
Passive mode, the server will actively connect to the client to obtain monitoring project data, the client passively accept the connection, and to pass the monitoring information to the server
Active mode, the client will proactively report the monitoring data to the service side, the server is only responsible for receiving.
When the number of clients is very large, it is recommended to use active mode, which can reduce the pressure on the service side.
Server has a public network IP, the client only intranet IP, but can connect the network, this scenario is suitable for active mode

3. Configuring the Host
In the Web interface: Configure-to-host groups to add host groups
Configure-Host Add host
Click on the following items to view each group of information


Apply set as a collection of monitoring items

Monitoring Project

A trigger is an alarm rule set on a monitoring project

Graphs are charts based on historical data.

Auto-discovery rules automatically configure appropriate partitions and network cards

Web Detection monitoring URLs

4. Add a custom template


Custom Template group to select Templates

Custom templates can be created without applying sets, monitoring items, and so on, you can copy from other existing templates
or simply select the linked template at creation time. Then cancel the link (cancel the original contact but not empty), delete the unwanted items (if not unlink, you cannot delete)
5. Handle garbled characters in graphics

The small square is originally a Chinese character, because the missing font
is set to Chinese, The Chinese text of the Zabbix graphic displays a small box
This is because there is no Chinese font in the Zabbix font library and needs to be borrowed from Windows
vim/usr/share/zabbix/include/ defines.inc.php//Search Zbx_fontpath
The path it defines is "fonts", which is a relative path, the absolute path is/usr/share/zabbix/fonts, and the font file is "Zbx_graph_font_ NAME "Graphfont", which is a file with an absolute path of/usr/share/zabbix/fonts/graphfont
Windows font path of "C:\Windows\Fonts\", find " Simfang.ttf "(actually that is the imitation Simplified), first copy it to the desktop, and then upload to the Linux/usr/share/zabbix/fonts/, and renamed to Graphfont.ttf


The result found that the font is not good, replaced by bold ... The procedure is the same as

6. Autodiscover Settings

Point in to make changes

can change the time interval for easy monitoring

Restart the Zabbix server and client, refresh the Web, the graphics appear new projects, The source is auto-discovery (the time interval has been changed to 60s, the refresh appears, but considering the load, it is better to increase the interval time)

7. Add custom monitoring items (not in the template, need to be customized on Linux)
Requirements: Monitor the number of 80-port connections for a web and figure out
Two-step: 1) Zabbix Monitoring Center to create a monitoring project; 2) graphical representation of the monitoring project
For the first step, you need to define the script to the client
vim/usr/local/sbin/estab.sh//content is as follows (the file location can be customized, but the requirements are the same as in the following userparameters)
#!/bin/bash
# #获取80端口并发连接数
Netstat-ant |grep ': |grep-c established//80 There are spaces behind, avoid matching to 8080 other ports
chmod 755/usr/local/sbin/estab.sh//In order to give Zabbix user permission to execute

Edit Profile on client vim/etc/zabbix/zabbix_agentd.conf//add
Unsafeuserparameters=1//means using a custom script
userparameter=my.estab.count[*],/usr/local/sbin/estab.sh//The key for the custom monitoring entry is My.estab.count, and the parameters of the script are written in the following [*] (separated by commas), If there are no parameters, you can omit the script as/usr/local/sbin/estab.sh
Restart Zabbix-agent Service Systemctl restart Zabbix-agent
First to the server authentication, execute the command
Zabbix_get-s 192.168.86.130-p 10050-k ' My.estab.count '

Then add monitoring items in the Zabbix Monitoring Center (browser) configuration
Key-Value Write My.estab.count (can also be customized, but same as the previous article)

After adding the item, go to "monitoring" and "latest data" to see if the item you just added has data appearing
With the data, you can add graphics.
"Configure"-"host"--"graphics" and "Create Graphics" (add and select the monitoring item you just created)

8. Configuring alarms
Use 163 or QQ mailbox to send alert mail
First login 163 mailbox, set on POP3, IMAP, SMTP service
Open and record Authorization code
Then set the email alert to the monitoring center.
"Manage"-"alarm media type"-"Create Media type"

Three parameters refer to: Recipient, message subject, message content
Create an alarm script mail.py
vim/usr/lib/zabbix/alertscripts/mail.py//Content Reference Https://coding.net/u/aminglinux/p/aminglinux-book/git/blob/master /d22z/mail.py
chmod 755/usr/lib/zabbix/alertscripts/mail.py
Create an alert email user, "manage", "user", "Create User", "Alarm Media", select "Gaojing", note the user's permissions, if there is no need to set permissions to the user group (default is None, need to set to read and write)

Set the action, "config", "action", "Create action", name write "SendMail" (Custom), "action" page, the content is as follows
Host:{host.name} {HOST. IP}//Host name
Time:{event. DATE} {EVENT. TIME}//Occurrence
Level:{trigger. SEVERITY}//Warning level
Name:{trigger.name}//Trigger Name
Messages:{item.name}:{item. VALUE}//Display information
Id:{event.id}//Event ID
"New Trigger condition", a maintenance state not in maintenance, B trigger warning degree >= not classified


Click on the "new"

Click on the "add" below

Switch to "restore operation" and change the information to the following
Host:{host.name} {HOST. IP}
Time:{event. DATE} {EVENT. TIME}
Level:{trigger. SEVERITY}
Name:{trigger.name}
Messages:{item.name}:{item. VALUE}
Id:{event.id}

Click "New", "Action", select the sending user for the user just created, send only to select "Gaojing"

Linux Monitoring Platform

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.