Zabbix 3.0.3 Study Notes

Source: Internet
Author: User
Tags windows download

I. Installing Zabbix and resolving diagrams characters

1. Install the Zabbix (configure the relevant Yum source, solve the package dependency problem, refer to the official documentation)

Yum install zabbix-agent zabbix-server-mysql zabbix-web-mysql mariadb-server-y


2. Change the time zone of PHP

Vim/etc/php.ini

Data.timezone = "Asia/shanghai"


3. Configure MySQL to solve coding problems

Vim/etc/my.cnf

Character-set-server=utf8

Mysql-uroot-p<password>

Mysql> CREATE database Zabbix character set UTF8 collate utf8_bin;

Mysql> Grant all privileges the zabbix.* to [e-mail protected] identified by ' Zabbix ';


cd/usr/share/doc/zabbix-server-mysql-3.0.3/

Zcat create.sql.gz | Mysql-uroot Zabbix


Vi/etc/zabbix/zabbix_server.conf

Dbhost=localhost

Dbname=zabbix

Dbuser=zabbix

Dbpassword=zabbix


4. Other configurations

Close Sellinx

Firewall-cmd--add-service=http

Firewall-cmd--add-service=http--permanent


5. Troubleshoot Chinese language status preview characters

/usr/share/zabbix/fonts (Linux Zabbix font save path) to Windows download font to this directory font the TTF suffix changed to lowercase

/usr/share/zabbix/include/defines.inc.php #修改字体的配置文件

Define (' Zbx_graph_font_name ', ' Simkai '); Font file name


Two. adding monitored hosts

1. Installing the Client

Yum Install zabbix-agent.x86_64

2. Configure the Client

/etc/zabbix/zabbix_agentd.conf

server=192.168.178.134

serveractive=192.168.178.134

Hostname=centos7 #和服务器主机名称保持一致


3. Server Configuration

Configuration--host--Create host

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/684e648527d6d49bec05279732ceb0a52861d6.png "width=" "height=" 1035 "alt=" 684E648527D6D49BEC05279732CEB0A52861D6.P "/>



Three. Define the monitoring item, and customize the key

1. Create a monitoring item on the host

Configuration--host--monitoring items--Creating monitoring items

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/d867a1f35bd9a29b0ab71968ad5439e1287425.png "width=" 752 "height=" 966 "alt=" D867A1F35BD9A29B0AB71968AD5439E1287425.P "/>

Use of 2.key

Proc.num[<name>,<user>,<state>,<cmdline>]

proc.num[,,,] # name,user,state is the default value

Proc.num # View all mileage, the client has installed the agent, the agent will automatically monitor a lot of information in the system

3. Install Zabbix-get to get client data

Yum Install Zabbix-get-y # needs to be well configured Yum source

Use of 4.zabbix_get

Zabbix_get-s is monitored by server address-K monitoring key

Zabbix_get-s 192.168.178.132-k proc.num[,,,]

Zabbix_get-s 192.168.178.132-k Proc.num[,zabbix,] # Four, not used after the number,, can not write, the front, the number can not be ignored

Zabbix_get-s 192.168.178.132-k proc.num[,,, Pro] # Pro is a fourth value (cmdline), matching keyword contains pro process

Cmdline--> Write a keyword, such as Write Pro, then in PS aux inside the command part of the pro process is matched

5. Create a host diagram on the server

Configure---Host---create graphics

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/f8ba7d0723c9a832cfd25400de031e3f55b9f1.jpg "width=" 1091 "height=" 613 "alt=" F8BA7D0723C9A832CFD25400DE031E3F55B9F1.J "/>

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

Testing multi-process monitoring scripts

#!/bin/bash

While:

Do

Echo 1 >/dev/null

Done

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

#!/bin/bash

If [$#-ne 1]; Then

Echo ' must follow a number '

Exit 1

Fi

echo "Terminate the test, press CTRL + C continuously"

Trap ' killall-9 sh &>/dev/null; Rm-rf/tmp/aa*.sh ' INT


For i in ' seq 1 $ '

Do

cp/root/aa.sh/tmp/aa${i}.sh

Sh/tmp/aa${i}.sh &

Done

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

6. Custom Key

setting on the client

/etc/zabbix/zabbix_agentd.conf

Include=/etc/zabbix/zabbix_agentd.d/# Writing a custom script in this directory

Syntax: Name of Userparameter=key, command

Example: Userparameter=num-of,ps aux--no-header | Wc-l

Zabbix_get-s 192.168.178.132-k num-of # Executes a command or script that triggers a client execution num-of on the server and passes the results back to the server

Syntax: Name of Userparameter=key [*], command $

Example: Userparameter=pro[*],echo $

Zabbix_get-s 192.168.178.132-k Pro[1]


Configuration--host--monitoring items--Creating monitoring items

Custom key value in Select button list is not found key value, need to manually input

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/199425496da7de36547196e181c0faa87c5135.jpg "width=" 715 "height=" 806 "alt=" 199425496DA7DE36547196E181C0FAA87C5135.J "/>


Four. Use of triggers and alarms

1. Trigger creation, for a particular monitoring item

Configuration--host--Create triggers

Just creating a trigger is not enough, you must create an action when the trigger's condition is met, and then what to do

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/774322c42289f6b7705051ee00690cfdba2dd1.png "width=" "height=" 703 "alt=" 774322C42289F6B7705051EE00690CFDBA2DD1.P "/>


2. Dynamic creation

Configure---Action--event source [trigger]--Create action

Creates an action---> sends the message to the specified person when the trigger is triggered

This condition is triggered when the centos7.1 process exceeds 100, triggering an action that generates some information and sends the message to the specified person.

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/64a7f5b417f06e6f576811582d16d0429385cb.png "width=" 965 "height=" 482 "alt=" 64A7F5B417F06E6F576811582D16D0429385CB.P "/>


3. User Management

Management--User

Decide what to do when the admin receives the information and decide how to use the alarm:

A. Mail

Decide what email address the user will use as the sender of the admin.

B. Scripts

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/f337aec5916eec17996737618984fcf608f3eb.jpg "width=" 1020 "height=" 404 "alt=" F337AEC5916EEC17996737618984FCF608F3EB.J "/>


4. Creation and modification of media types

Management--Alarm media type--Create media type

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/c2ba9d99815bad6835791716d64a78110d7eeb.jpg "width=" 805 "height=" 576 "alt=" C2BA9D99815BAD6835791716D64A78110D7EEB.J "/>

5. Alarm (Corporate public number)

Configure a trigger with the alarm when the CPU exceeds 80%

/etc/zabbix/zabbix_server.conf

Alertscriptspath=/usr/lib/zabbix/alertscripts # Put the script in this directory

/usr/lib/zabbix/alertscripts/weixin-private-api/config.php # Modify this file

/usr/lib/zabbix/alertscripts/weixin-private-api/test.php

$testFakeId = "$argv [1]"; # sent to the specified user

$msg = "$argv [3]"; # Content of messages sent

./weixin "Owzmqwsvafm1rmayvmadhoaemodu" "' Hello Lincx ' # test message send

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/15aa58b899cc159668f4072d07e158a464c59e.jpg "width=" 998 "height=" 795 "alt=" 15AA58B899CC159668F4072D07E158A464C59E.J "/>


Five. Other settings

1. Definition of application Set

Define an application set of related monitoring items and classify the monitoring items

Configuration--host--app set--Create an app set


2. Host group definition

Classify servers based on servers and group them with the same type of server


3. Creation of templates (application sets, monitoring items, triggers, graphs, aggregate graphics, Autodiscover, web monitoring, collection of elements referenced by host)


4. Use of aggregated graphics (graphics-based)


5. Use of slides (automatically switch multiple aggregated graphics every time)


6. Network topology diagram

Insert a background map (manage--general--image--create picture) for topological location-sensitive


7. Macro definition

{$ variable name} # generally uses uppercase letters, global references

Global Settings

Host-level variables

Management--general--macro--Add--Update

The name of the monitoring item, the parameter of the key value can refer to the custom macro xx[,{$AA},]

Network topology diagrams cannot reference this variable, using built-in variables such as {host,name}

Zabbix has a lot of built-in macros (query related information)

Configuration--host--Create host--macro definition (only for this host, other hosts cannot use this host custom macro)

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/44411d557d4ffcf15856698589dda8ae8aee2c.jpg "width=" 937 "height=" 469 "alt=" 44411D557D4FFCF15856698589DDA8AE8AEE2C.J "/>


Seven. Automation

1. Network Discovery: Zabbix Server actively scan the environment of the host, to meet the conditions, the automatic add come

Use of third-party software

Puppet

Saltstack

Configuration-Auto Discovery-Create auto discovery

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/493782f10f5f9aa985c63518a0a4a44e4326f1.jpg "width=" 698 "height=" 648 "alt=" 493782F10F5F9AA985C63518A0A4A44E4326F1.J "/>

2. Creation of automatic discovery actions

How to add a host, which template to use, etc. in which host group after the discovery of the host

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/f47425b0261dab5889a7652a72ea4bdb4a75dd.png "width=" "height=" 853 "alt=" F47425B0261DAB5889A7652A72EA4BDB4A75DD.P "/>

2.1. Configuration--action--event source [Autodiscover]--Create action

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/132838f8429a9e5fdef74142bf06c231cd04cb.jpg "width=" 1184 "height=" 880 "alt=" 132838F8429A9E5FDEF74142BF06C231CD04CB.J "/>

3. Autoenrollment: Zabbix server is not active, but the client actively to Zabbix server to send a request, request registration

The server needs to set an action to specify which clients can add in

Configuration--action--event source [autoenrollment]--Create action

/etc/zabbix/zabbix_agentd.conf

HOSTMETADATA=XX # XX Client matches the server string

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/516a1bd1146e5d95111288c4e3171b4497cbbc.png "width=" "Height=" 832 "alt=" 516A1BD1146E5D95111288C4E3171B4497CBBC.P "/>

4. Low-level discovery (low-level discovery):

Allows it to automatically discover what the client is monitoring.

For example, the partitioning of different machines for monitoring partitions is definitely not the same.

Vfs.fs.size[/boot,used]

Vfs.fs.size[/,used]

Different machine partitions need to be set up one by one, you can let Zabbix automatically discover the client's partition, and then according to the actual situation to automatically define the monitoring items

Zabbix_get-s 192.168.178.132-k Vfs.fs.discovery # Dynamically gets the partition type of the monitored machine

{#FSNAME}---> mount point

{#FSTYPE}---> File system type

Low-level discovery is template-based, and in this template there is no need to define specific monitoring items, which need to be defined as prototypes, monitoring items prototypes, chart prototypes

When a host uses this template, it transforms the monitoring item prototype into a monitoring item and a chart prototype into a chart.


4.1. Configuration--template--Create template--auto Discovery--Create discovery Rule

All file system Information of the client can be obtained through vfs.fs.discovery

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/24ec3b5300fdd9c4fc713281f6dbaf3deb5e50.jpg "width=" "height=" 633 "alt=" 24EC3B5300FDD9C4FC713281F6DBAF3DEB5E50.J "/>

4.2. Configuration--template--automatic discovery--monitoring item prototype--Creating a monitoring item prototype

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/c1b15e2860b713480d2178ec6c0a004630ba0c.png "width=" 952 "height=" 958 "alt=" C1B15E2860B713480D2178EC6C0A004630BA0C.P "/>

4.3. Configuration--template--auto-discovery--Graphical item prototype--Create a graphical prototype

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/1679f6733868dd76b782534d102a671f891504.jpg "width=" 1079 "height=" 608 "alt=" 1679F6733868DD76B782534D102A671F891504.J "/>


Eight. Distributed

1. Installing Zabbix-proxy

Configure the relevant Yum sources.

Yum Install Zabbix-proxy Zabbix-proxy-mysql mariadb-server-y

2. Configure MySQL to solve coding problems

Vim/etc/my.cnf

Character-set-server=utf8


Mysql-uroot-p<password>

Mysql> CREATE database Zabbix character set UTF8 collate utf8_bin;

Mysql> Grant all privileges the zabbix.* to [e-mail protected] identified by ' Zabbix ';


cd/usr/share/doc/zabbix-proxy-mysql-3.0.3/

Shell> mysql-uzabbix-p<password> Zabbix < Images.sql

Shell> mysql-uzabbix-p<password> Zabbix < Data.sql


3. Proxy server configuration file related modifications

/etc/zabbix/zabbix_proxy.conf

SERVER=192.168.178.134 # Zabbix Server IP

Dbhost=localhost

Dbpassword=zabbix

Hostname=zabbix Proxy

sourceip=192.168.178.132 # Proxy Server's own IP


Restart Service

Systemctl Restart Zabbix_proxy

4. Configuration of the agent

Manage---agents---create agents

Clear Log

Cat/dev/nul >/var/log/zabbix/zabbix_agentd.log

650) this.width=650; "src=" Http://s1.51cto.com/images/201607/38095658978eac5a955974d43c2893c0c1abcd.jpg "width=" "height=" 518 "alt=" 38095658978EAC5A955974D43C2893C0C1ABCD.J "/>


This article is from "Forget the cold and cold" blog, please make sure to keep this source http://speedy.blog.51cto.com/389078/1826098

Zabbix 3.0.3 Study Notes

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.