Zabbix introduction of linux--Monitoring System (II.)

Source: Internet
Author: User
Tags syslog

We introduced the Zabbix installation configuration steps and simple actions, triggers, modules and other functions in the previous blog, we are here to introduce the following Zabbix automatic discovery, automatic registration, web monitoring, custom monitoring and other functions!

One, custom key value

Let's start by defining a template to facilitate the configuration of the later experiment.

    • Create a template named Test template

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/28/4D/wKiom1N3GZPAmh5jAAIhbUyyMxQ751.jpg "title=" QQ pinyin unnamed. jpg "alt=" wkiom1n3gzpamh5jaaihbuyymxq751.jpg "/>

    • Add a monitoring item and use a custom key value

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/28/4D/wKioL1N3GkWgD-bHAANoCZVbUFI573.jpg "title=" QQ pinyin unnamed. jpg "alt=" wkiol1n3gkwgd-bhaanoczvbufi573.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/28/4D/wKioL1N3Gp3ipJcoAAKzuQPqwSc083.jpg "style=" float: none; "title=" QQ Pinyin unnamed 1.jpg "alt=" Wkiol1n3gp3ipjcoaakzuqpqwsc083.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/28/4D/wKiom1N3GsvCBF7-AAL0FnTb-gs542.jpg "style=" float: none; "title=" QQ Pinyin unnamed 2.jpg "alt=" Wkiom1n3gsvcbf7-aal0fntb-gs542.jpg "/>


Edit/usr/local/zabbix/etc/zabbix_agentd.conf configuration file, define key

[[email protected] ~]# vim/usr/local/zabbix/etc/zabbix_agentd.conf//Add this content at the end: userparameter=memory.usage[*],/bin/ Cat/proc/meminfo | awk '/^$1:/{print $$2} '


In this way, the custom key is defined and can be called!

(Note: If you want to increase the number of hosts to use a custom key, you need to add the Userparameter statement in the agent configuration file on each host)


OK, let's continue to refine this template!

    • Add a Trigger!

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/28/4D/wKiom1N3HIXzHPDQAANSTansIgM266.jpg "title=" QQ Pinyin unnamed 3.jpg "alt=" Wkiom1n3hixzhpdqaanstansigm266.jpg "/>


    • Add a graphic.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/28/4D/wKiom1N3HSjh4YmtAAM2JZsTF3Q961.jpg "title=" QQ Pinyin unnamed 4.jpg "alt=" Wkiom1n3hsjh4ymtaam2jzstf3q961.jpg "/>

To this, the template based on the custom key has been configured to complete!


Here is a brief introduction to the key and custom keys used by Zabbix

1, monitoring port: net.tcp.port[,3306]

Net.tcp.port [, 3306] returns 1 for 3306 ports present, 0 for non-existent


2, the monitoring process: proc.num[mysqld]

Proc.num [MYSQLD] Returns the number of processes with a value of mysqld


3. Check the number of CPU cores:system.cpu.num return value is the number of cores for the server CPU


4, check the system start time and current time:system.boottime, System.localtime return value is the system start time and the current time, timestamp format


5, see the system simple information:system.uname return value for system information, similar to the Linux system uname-a command


6, check the windowns system current network card access and flow:

Net.if.out[{host.name},bytes], Net.if.in[{host.name},bytes] and Linux system key:Net.if.out[eth0,bytes], net.if.in[ Eth0,bytes] like


7. Check the system memory Size: vm.memory.size[total], return value Unit bytes


8, the size of the view file: Vfs.file.size[file] such as: Vfs.file.size[/var/log/syslog] returned is the size of/var/log/syslog, the unit is: bytes


9. Check if the file exists:vfs.file.exists[file] file If there is a return of 0, there is no return 1


10, view the file MD5:Vfs.file.md5sum[file] View the MD5 of the small file, return to the MD5 value (as if only 2.0 of the version has this key)


11, automatically discover the network card and monitor the traffic and auto-discovery partition and partition mount two key:net.if.discovery,vfs.fs.discovery, the Windows and Linux monitoring templates have this template (more than 2.0 version) , the application can

The above is a common key, in fact, the monitoring server is nothing more than memory, hard disk occupancy, CPU load, traffic, servers and ports and so on. If you want to monitor the other can be customized key to achieve, I like to customize key, write a script back, get their own desired monitoring results, Zabbix in this piece do very good, very extensibility, support a variety of scripts to implement a custom key.


12. Custom Key

To enable a custom key, you need the agent to enable the Unsafeuserparameters=1 parameter in the client's configuration file and then define the key at the bottom of the configuration file, such as:

userparameter=free.disk,/usr/local/zabbix/bin/disk.py

Free.disk is the name of key,/usr/local/zabbix/bin/disk.py is the script that executes when the server side calls Free.disk this key, and the result is the return value of Free.disk. The script can be any scripting language that can be run.

Note: The script to use absolute path, note the permissions of the script, write the script return value to be as simple as possible, so as to facilitate setting the alarm value.


Second, the automatic discovery of Zabbix

    • Add Discovery Rule

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/28/4E/wKiom1N3IheBtfqbAAQXgU9oWXY190.jpg "title=" QQ Pinyin unnamed 5.jpg "alt=" Wkiom1n3ihebtfqbaaqxgu9owxy190.jpg "/>

Introduction to Parameters:

Name: The name of the automatic rebate rule

IP range: The address segment where the host is automatically discovered

Latency: The time interval for scanning a network segment

Check: Detect hosts that meet the following rules

Device Uniqueness: Device authentication ID for adding the name of the discovered host


    • Add a discovery action to add a host

When the host is found, you can automatically add the host and link the template, so that it quickly on-line monitoring!

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/28/4F/wKioL1N3I1zTi2oJAASSgj_-24o109.jpg "title=" QQ Pinyin unnamed 6.jpg "alt=" Wkiol1n3i1zti2ojaassgj_-24o109.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/28/51/wKioL1N3JWrzSsnzAAJJExCzUxI434.jpg "title=" QQ Pinyin unnamed 8.jpg "alt=" Wkiol1n3jwrzssnzaajjexczuxi434.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/28/51/wKiom1N3JaSB9X3tAALh0nBWCr0581.jpg "title=" QQ Pinyin unnamed 9.jpg "alt=" Wkiom1n3jasb9x3taalh0nbwcr0581.jpg "/>


    • Add Remove action

When the host is not in line, we need to let it go offline, so we have to add a remove action

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/28/51/wKioL1N3JpaTDs7BAAOLLbNrHsg405.jpg "style=" float: none; "title=" QQ Pinyin unnamed 10.jpg "alt=" Wkiol1n3jpatds7baaollbnrhsg405.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/28/51/wKioL1N3JpmSsMwQAAOpzD5_080909.jpg "style=" float: none; "title=" QQ Pinyin unnamed 11.jpg "alt=" Wkiol1n3jpmssmwqaaopzd5_080909.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/28/51/wKiom1N3JsngXXVRAALMgnb7iis442.jpg "style=" float: none; "title=" QQ Pinyin unnamed 12.jpg "alt=" Wkiom1n3jsngxxvraalmgnb7iis442.jpg "/>


    • Defining Auto-Registration actions

Test found that when the host Agent service offline, the above rules can not automatically re-online monitoring, so also need to add an automatic registration action, so that its host failure repair, you can automatically register to continue online!

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/28/51/wKiom1N3KLPS5FNHAANCa9lqgNM161.jpg "title=" QQ Pinyin unnamed 14.jpg "alt=" Wkiom1n3klps5fnhaanca9lqgnm161.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/28/51/wKioL1N3KJmiaCrbAAO0E50BiWo683.jpg "title=" QQ Pinyin unnamed 15.jpg "alt=" Wkiol1n3kjmiacrbaao0e50biwo683.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/28/51/wKiom1N3KNXSyZOLAAMHGoy3nKE190.jpg "title=" QQ Pinyin unnamed 16.jpg "alt=" Wkiom1n3knxsyzolaamhgoy3nke190.jpg "/>


    • Test

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/28/51/wKiom1N3KZPxvuI5AAN87i3KQfE984.jpg "title=" QQ Pinyin unnamed 17.jpg "alt=" Wkiom1n3kzpxvui5aan87i3kqfe984.jpg "/>

Note : If there is a previously automatically added host, you can first delete the host, and then see if he automatically discovered, and add the host


    • We let one of the agent service stop to see if the automatic downline!

[Email protected] ~]# Killall ZABBIX_AGENTD

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/28/51/wKioL1N3K1qRWAtQAAKtmgsSgVs613.jpg "style=" float: none; "title=" QQ Pinyin unnamed 18.jpg "alt=" Wkiol1n3k1qrwatqaaktmgssgvs613.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/28/51/wKiom1N3K4iTt9hYAALIK4iTc60196.jpg "style=" float: none; "title=" QQ Pinyin unnamed 19.jpg "alt=" Wkiom1n3k4itt9hyaalik4itc60196.jpg "/>

As seen from the figure, has been automatically offline!


    • Let the agent service start to see if it is automatically registered!

[Email protected] ~]# cd/usr/local/zabbix/sbin/[[email protected] sbin]#./zabbix_agentd

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/28/51/wKiom1N3LKfD8QkrAAIVkNEXLA0079.jpg "style=" float: none; "title=" QQ Pinyin unnamed 20.jpg "alt=" Wkiom1n3lkfd8qkraaivknexla0079.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/28/51/wKioL1N3LH_gr5Q8AALYLfd-ojQ636.jpg "style=" float: none; "title=" QQ Pinyin unnamed 21.jpg "alt=" Wkiol1n3lh_gr5q8aalylfd-ojq636.jpg "/>

It seems that auto-registration has been implemented!


At this point, the basic function of Zabbix monitoring has been basically introduced, because I level limited, deficiencies, please more guidance!

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.