Linux monitoring platform construction -- configure zabbix

an active mode and a passive mode

  1. Active or passive is relative to the client
  2. In passive mode, the server will actively connect to the client to obtain monitoring item data, and the client passively accepts the connection and transmits the monitoring information to the server.
  3. In active mode, the client will actively report the monitoring data to the server, and the server is only responsible for receiving it.
  4. When the number of clients is very large, it is recommended to use the active mode, which can reduce the pressure on the server.
  5. The server has a public network ip, and the client only has an internal network ip, but it can connect to the external network. This scenario is suitable for active mode.

Second, add monitoring host

  1. First add the host group lijie-test First, we log in to the monitoring center to configure. Before adding monitoring hosts, we need to add a host group. We need to enter the configuration host group page. Enter image descriptionClick Create host group to enter the following interface, we need Fill in the group name and click the Add buttonEnter image description
  2. Then add a host, write lijie-02 for both the host name and the visible name, this name is the hostname of the 75.134 client. First enter the page to add a host. After Enter image descriptionentering , fill in the following information, and fill in the IP address of the zabbix client we just configured. Enter image descriptionAfter filling in these pieces of information, we click the add button at the bottom of the page to complete the addition, and we can see the host we added on the host page. If you Enter image descriptiondefine active or passive mode, you can click the monitoring item in the above figure to configure
  3. Several concepts: application set, monitoring item, trigger, graph, automatic discovery, web monitoring Application set: is a collection of monitoring items, as shown in the figure below, 64 monitoring items are distributed in 11 application sets Enter image descriptionMonitoring items: this is monitoring All the items in , a total of 64 items Enter image descriptionTrigger : the alarm rule set for each monitoring item, and Enter image descriptionthe alarm level can also be defined Once the login is successful, we will be prompted with the color, and we can easily know where there is a problem. Enter image descriptionGraphics : zabbix can form a picture because zabbix stores historical data. Enter image descriptionAutomatic discovery rules: There are two meanings here, one is disk space The usage and usage ratio of the file system; the other is the traffic of the network card. These are all automatic, and the partitions are automatically discovered. If you manually configure it, it is more troublesome, because the number of partitions and mounts of each machine Points, the number of network cards, network card names, etc. are different, so it needs to be automatically discovered, and then form charts and triggers for us. Enter image descriptionWeb detection: For monitoring a certain website, we can set many rules for monitoring this website, such as a website. There is a problem with each page, and the alarm is issued when the returned status is not 200OKEnter image description

Three add custom templates

  1. It is very useful to customize a common template to facilitate adding monitoring project
    templates to new hosts. When we add some servers with fixed, unique formats and unique groups, we need to add some personalized monitoring projects to these servers. , we need to add these monitoring items to a specific template, and then we will link this template to this group of machines. Every time we add similar machines, we will connect this template, so that it is very convenient to add these Monitoring items, triggers, graphs, auto-discovery rules, etc.

  2. Custom lijie template Regarding the template, we first need to customize a template, install the following image to enter the add template page Enter image descriptionEnter the add template page, fill in the template name, visible name, pay attention to the group should select the Templates template group Enter image descriptionAfter filling in, click Add button at the bottom of the pageEnter image description

  3. Copy some monitoring items (such as cpu, memory, etc.) from other built-in templates to the lijie template.
    At this time, there are no application sets, monitoring items, and triggers in the lijie template. We can go to other built-in targets. Copy the monitoring items inside. The Template OS Linux template is more suitable here. We will copy the monitoring items from here, enter the monitoring item list of the template, select the item we want to copy, and Enter image descriptionthen to enter Go to the following page, select the lijie template under the template, and then click Copy. Enter image descriptionThen we view it in the template. We can see that there are 5 monitoring items in the lijie template. Enter image descriptionWe can also use the same method to copy triggers, graphs, aggregate graphs, add to lijie

  4. define triggers

  5. Add graphics

  6. Auto-discovery, find Template OS Linux, click Auto-discovery on the right, and refer to Mounted filesystem discovery and Network interface discovery to define rules to automatically discover that this option is not copied belowEnter image description

  7. You can directly export and import the template, and then delete the unwanted objects. We can also export this template Enter image descriptionand then download a file with the suffix xml. We can directly edit this file. If you Enter image description
    edit this file, you need to modify the template inside. Name, and then delete unnecessary objects, the workload is relatively large, and it is easy to make mistakes when importing, so this method is generally not recommended.
    At this time, we can use another method. Let's delete the previously copied monitoring items first. Enter image descriptionThen select the template of the link, click the select button, select the template you want to link Template OS Linux in the pop-up page, Enter image descriptionand then we click the add button, the page will look like the following, and then we click the update button. Enter image descriptionAt this time, we can See that the application sets, monitoring items, triggers, graphs, etc. of the template lijie already have data, Enter image descriptionbut because the data we want is automatically discovered data, we need to delete other monitoring items, but if we delete these monitoring directly Items cannot be deleted, because these monitoring item data are linked from another template. Let's look at the linked template page again, and Enter image descriptionwe can see that there are two buttons: Unlink and Unlink and Clean Up Enter image description. The unlink button is to cancel lijie The link relationship between the template and the original Template OS Linux template will not delete the original monitoring item, but the unlink and clean button will cancel the link relationship and delete the original monitoring item. After we use the unlink button, we will come to the monitoring item page. You can see that the name of the link template in the original page is gone. Enter image descriptionAt this time, we can delete the items except for automatic discovery. When deleting, we need to delete the monitoring item first, and then delete the application set
    . When deleting the monitoring item, we first select the required Deleted items, then click the delete button below Enter image descriptionand then prompt the deletion is successfulEnter image descriptionThen delete the application set, as long as the item with the number behind cannot be deleted, select the item without the number, click the delete button below to Enter image descriptionprompt deletion is successful Enter image description, and then delete the trigger, we keep all the items in the trigger, and delete the second item in the graph Enter image descriptionAutomatically It is found that the rules are kept. At this point, our lijie template has been configured OK, and there is no link. The next thing to do is to link the host we previously configured with this template, and then make further refinements

Four dealing with garbled characters in graphics

  1. After setting to Chinese, the Chinese text of the zabbix graphics will display small boxes
    . We link the host lijie-02 to the template lijie, and then switch to the CPU load item of the host. After Enter image descriptionswitching , we see some small squares below the preview interface. Enter image descriptionThese small boxes The square is actually Chinese, the garbled code is because there is no Chinese font in the font library of zabbix, you need to borrow one from windows
  2. The server opens the configuration file that defines the font
vim /usr/share/zabbix/include/defines.inc.php //搜索ZBX_FONTPATH 

Enter image description

  1. The path defined by ZBX_FONTPATH ​​is "fonts", which is a relative path, the absolute path is /usr/share/zabbix/fonts, there is a file "graphfont.ttf" under this path, and this file is finally a soft link to /usr /share/fonts/dejavu/DejaVuSans.ttf file, the font file DejaVuSans.ttf does not support Chinese
[root@lijie-01 ~]# vim /usr/share/zabbix/include/defines.inc.php
[root@lijie-01 ~]# ls /usr/share/zabbix/fonts
graphfont.ttf
[root@lijie-01 ~]# ll !$
ll /usr/share/zabbix/fonts
总用量 0
lrwxrwxrwx. 1 root root 33 4月  12 16:27 graphfont.ttf -> /etc/alternatives/zabbix-web-font
[root@lijie-01 ~]# ll /etc/alternatives/zabbix-web-font
lrwxrwxrwx. 1 root root 38 4月  12 16:27 /etc/alternatives/zabbix-web-font -> /usr/share/fonts/dejavu/DejaVuSans.ttf
[root@lijie-01 ~]# 

The font file is "graphfont" defined by "ZBX_GRAPH_FONT_NAME", which is a file with an absolute path of /usr/share/zabbix/fonts/graphfont. What we need to do now is to softly link the file defined by ZBX_GRAPH_FONT_NAME under the ZBX_FONTPATH ​​path Go to a font that supports Chinese with Chinese

  1. The Windows font path is "C:\Windows\Fonts\", find the font with Chinese, such as Lishu, Enter image descriptioncopy this file to our windows desktop, and then use sftp to put this file, that is, SIMLI.ttf, on linux Enter image descriptionThen move the file to /usr/share/zabbix/fonts/ in linux, and rename it to graphfont.ttf, you can also softly link the graphfont.ttf file to SIMLI.ttf
[root@lijie-01 ~]# ls
11.txt  1.txt~  anaconda-ks.cfg  bb.txt  lijie.txt  ??????.pdf  SIMLI.TTF
123     1.txz~  a.txt            b.txt   log        sed         sim.pid
1.txt   3.txt   awk              grep    logs       shell       temp
[root@lijie-01 ~]# mv SIMLI.TTF /usr/share/zabbix/fonts/
[root@lijie-01 ~]# cd !$
cd /usr/share/zabbix/fonts/
[root@lijie-01 fonts]# ls
graphfont.ttf  SIMLI.TTF
[root@lijie-01 fonts]# ln -s graphfont.ttf SIMLI.TTF 
ln: 无法创建符号链接"SIMLI.TTF": 文件已存在
[root@lijie-01 fonts]# mv graphfont.ttf  graphfont.ttf.bak
[root@lijie-01 fonts]# ls
graphfont.ttf.bak  SIMLI.TTF
[root@lijie-01 fonts]# ln -s SIMLI.TTF graphfont.ttf
[root@lijie-01 fonts]# 

At this time, we refresh the graphical preview interface of the host, and we can see that the original small square has been displayed in Chinese.Enter image description

Extended
zabbix monitoring switch (Cisco) http://tryrus.blog.51cto.com/10914693/1789847
zabbix remote execution command http://www.ywnds.com/?p=6610
zabbix distributed deployment http://sfzhang88. blog.51cto.com/4995876/1364399 zabbix
monitoring tomcat (the version is a bit old, you only need to refer to the steps, you can't copy it) http://www.jianshu.com/p/e3825a885a1b http://www.fblinux.com/? p=616

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324455732&siteId=291194637