Add hosts, alarm, and monitoring settings for zabbix monitoring

Source: Internet
Author: User

Based on the experience of using zabbix for so long, we have summarized a set of useful processes for adding hosts and monitoring alarms for your reference.

For how to install, go to: http://www.centoscn.com/image-text/install/2013/0806/1093.html

I. How to add an alarm

Open zabbix management ------ solution ---- create media type:

I used a script to send an alert by sending an email. The Script Name Is mail. py. It refers to the location where the script is stored. My script is placed under the/usr/local/zabbix/bin/directory, where no data pair path of the directory is written, directly write the script name. Its Path settings are set in the configuration file on the zabbix server. In the zabbix_server.conf configuration file, set AlertScriptsPath =/usr/local/zabbix/bin/2: add zabbix users and groups, set their email addresses and other information 1: Open zabbix management ------ user --- Select user group drop-down ---- create user group:

Enter a group name and set the required permissions to save them directly. You do not need to enter or select other permissions. 2: Open zabbix management ------ user --- Select user drop-down ---- create user: enter user information

3: add the alarm media, that is, the alarm method. Because it is an alarm, you do not need to check [information]. The information is generally an alarm when the server information changes. This is generally meaningless, this option is not selected, but you can also select it based on your preferences. If it is a type, select the media used to process the issue and select the media you added. Then, you can save the information and add the user (the Permissions item is not filled in ).

3. Set the action triggered by the alarm trigger. When the trigger in the metric item reaches the alarm value you set, you need to perform the action to send emails and other actions. Specific settings:

1: Enable zabbix's System Configuration --- operation ---- select event source as trigger ------ create action:

2: trigger condition settings:

3: Detailed operation settings, that is, what action is performed after the trigger condition is met. Here, it is generally set to mail and the like, and set the mail receiving user (we recommend that each group correspond to one user, in this way, it is easy to set the sending object when sending an email ):

4. Several key zabbix keys commonly used in zabbix can be understood as zabbix commands. Execute this key to obtain the corresponding results. 1: net. tcp. port [, 3306] of the monitoring port

/Usr/local/zabbix/bin/-s192.168.8.120-knet. tcp. port [, 3306], port 3306 with 192.168.8.120 and port 0 with no

2: proc. num [mysqld] of the monitored process

/Usr/local/zabbix/bin/zabbix_get-s192.168.8.120-kproc. num [mysqld] Return the number of mysqld processes in 192.168.8.120

/Usr/local/zabbix/bin/zabbix_get-s192.168.8.120-kproc. num [] The returned value is the number of all processes in 192.168.8.120.

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

4: view the system startup time and current time: system. boottime and system. localtime return values: system startup time and current time, In the timestamp format

5: view the system's simple information: the system information returned by system. uname is 192.168.8.120, similar to the linux system's uname-a command

6: view the incoming and outgoing traffic of the current network card of the windowns system: net. if. out [{HOST. NAME}, bytes], net. if. in [{HOST. NAME}, bytes] and key: net. if. out [eth0, bytes], net. if. in [eth0, bytes] is the same

/Usr/local/zabbix/bin/zabbix_get-s192.168.8.120-knet. if. in [192.168.8.120, bytes] returns the incoming traffic whose IP address is 192.168.8.120. This value is the Count value, in the unit of bytes, minus the value obtained last time, divided by the time interval for the average traffic in this period.

/Usr/local/zabbix/bin/zabbix_get-s192.168.8.120-knet. if. out [192.168.8.120, bytes] returns outbound traffic whose IP address is 192.168.8.120. This value is the Count value, measured in bytes, minus the value obtained last time. divided by the time interval, the average traffic in this period is

7: view the system memory size: vm. memory. size [total], return value unit: bytes

8: view the file size: vfs. file. size [file], for example, vfs. file. size [/var/log/syslog] returns the size of/var/log/syslog. The unit is bytes.

9: Check whether the file exists: vfs. file. exists [file] If the file exists, 0 is returned. If the file does not exist, 1 is returned.

10: view the file's MD5: vfs. file. md5sum [file]: Check the MD5 of a small file and return the MD5 value (as if only version 2.0 and later has this key) 11: two keys: net. if. discovery, vfs. fs. this template is available in the discovery, windows, and linux monitoring templates (Version 2.0 and later). The application can be a commonly used key, in fact, the monitoring server is nothing more than memory, hard disk usage, CPU load, traffic, servers and ports. If you want to monitor others, you can use custom keys. I like custom keys and write a script to return the desired monitoring results. zabbix is doing very well in this field, highly scalable and supports various scripts to implement custom keys. To enable the custom key, enable the UnsafeUserParameters = 1 parameter in the client configuration file, and then define the key at the bottom of the configuration file, for example, UserParameter = free. disk,/usr/local/zabbix/bin/disk. pyfree. disk is the name of the key,/usr/local/zabbix/bin/disk. py calls free for the server. the script executed when disk is the key. The result is free. disk return value. Scripts can be any script language that can run. 5. Creating monitoring templates and monitoring metrics after the zabbix server is installed, many built-in monitoring templates can basically meet the needs of popular monitoring, however, many of them do not have necessary monitoring items or are not of interest to them. They are redundant. Therefore, if you need to do a good job of monitoring, you should also customize templates and monitoring items, this monitoring template can be modified or created by yourself in the zabbix system. You can create a monitoring template as follows. 1: create a monitoring template:

Open zabbix's System Configuration --- template ---- create template:

Enter the Template Name and save the template in the group.

2: Create a metric:

Open zabbix's System Configuration --- template --- Select the metric item in the corresponding template --- create item:

3: Create a trigger for a metric:

Open zabbix's System Configuration --- template --- Select the trigger in the corresponding template --- create trigger:

Here, we will describe the size of this N value. For example, if the number of httpd processes on the monitored end is 9, then the value of this N can be set to N = 9, when the last value detected by lastvalue is less than N, that is, less than 9, this trigger will be triggered. 6. There are two ways to add a host and apply the template to add a host. One is to manually add the host, and the other is to automatically add the host through zabbix's automatic discovery. 1: After you manually add hosts, it is easy to add hosts. Open the zabbix System Configuration --- host-create host:

In this step, only enter the host name, display name, and IP address in the agent interface, and select the group where the host is located.

Select the template to confirm and save the host. Other options do not need to be set. By default, the host can be added. For example, if the availability is green, it is normal, the red color is not monitored (mainly because the network is disconnected or the zabbix client is not installed), and the gray color is the status of zabbix being detected:

2: automatically add hosts through automatic discovery:

Enable zabbix's System Configuration --- automatic discovery-create discovery rule:

You need to add the name, IP address segment (this address segment should overwrite the minimum IP address segment of all your IP addresses), checks. Among them, checks is the most important. There are three items in total. Only the key is entered. Here, the key system. uname is used. Click Add and save. This means that the zabbix server side scans the zabbix client in this network segment (the client port is 10050 by default) and obtains the system of the client after scanning. uname value. The returned value is similar to the uname-a command in linux. The value is in the following format:

This is mainly used to automatically allocate the host to the corresponding group (such as the linux Group or windowns group) after discovering the host, and apply the corresponding monitoring template. Of course, this key value does not necessarily use system. uname, you can also use other keys. First, the zabbix client supports this key, which can be used to distinguish different types of hosts and facilitate grouping and application of monitoring templates.

Open zabbix's System Configuration --- operation ------- select Auto-discovery from the event source drop-down menu-create action:

These items mean that when the zabbix client is found automatically and the key contains linux characters, it is added to the linux_servers group and the linux_server template is applied. Wait for a while to view the automatically discovered results. The result can be found at the bottom of the zabbix homepage, or in the zabbix status statistics-automatic discovery, you can see how much is found and how much is monitored. So far, zabbix's monitoring settings have been described.

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.