Zabbix using its own scripting templates and Zabbix two ways to add monitoring of specified processes and ports

Source: Internet
Author: User

Zabbix Use Write your own script template and Zabbix comes with a template two ways to add monitoring for a specified process and port1. Self-monitoring templates for OS monitoring

Enter /usr/local/zabbix/etc/zabbix_agentd.conf configuration file Modification

Logremotecommands=1 # # # Open script feature

server=192.168.5.129 # # Modify the server that Zabbix points to:

Restart Zabbix_agentd,zabbix_server service

in Configuration -- host -- Add host --

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/A5/75/wKioL1m-JW7za_JeAADZJphjuEA580.png "title=" Picture 1.png "Width=" "height=" 473 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:473px; "alt=" Wkiol1m-jw7za_jeaadzjphjuea580.png "/>

Configure host information host name, group, Agent Agent Interface IP Address

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/A5/75/wKioL1m-JYWiFLeYAACKeOUu1YE259.png "title=" Picture 2.png "Width=" "height=" 405 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:405px; "alt=" Wkiol1m-jywifleyaackeouu1ye259.png "/>

Click the template --Select the template you want--add-- add

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/06/C5/wKiom1m-JhezoVFMAAA9ulgSlIU319.png "title=" Picture 3.png "Width=" "height=" 171 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:171px; "alt=" Wkiom1m-jhezovfmaaa9ulgsliu319.png "/>

Add and then configure -Host to boot the added host

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/06/C5/wKiom1m-JiWhcC2QAACQthjFzoQ916.png "title=" Picture 4.png "Width=" "height=" 118 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:118px; "alt=" Wkiom1m-jiwhcc2qaacqthjfzoq916.png "/>

viewing the detected image detect ---graphics----------Select what you see

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/06/C5/wKiom1m-JpfAmU9HAAKQ3SuivnU067.png "title=" Picture 5.png "Width=" "height=" 443 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:443px; "alt=" Wkiom1m-jpfamu9haakq3suivnu067.png "/>

[Email protected] bin]# pwd

/usr/local/zabbix/bin

[email protected] bin]#/zabbix_get-s 127.0.0.1-k user_num # # # Check the key value

2. Write your own script template for OS monitoring

Write yourself a shell script that detects the OS:

[Email protected] bin]# cd/usr/local/zabbix/scripts/

[[email protected] scripts]# ls

Mem_free mem_total nginx_monitor.sh os.monitor.sh tcp_monitor.sh user_num

[email protected] scripts]# cat os.monitor.sh

#!/bin/bash

###########

#name =linux View System resource Scripts

#auth =CML

#time: 2017/8/10

###########

Check_cpu_num () {

cpu= ' Cat/proc/cpuinfo | grep Processor | Wc-l '

Echo $CPU

}

Check_load () {

Load= ' W | awk ' nr==1 {print $} ' | Awk-f '. ' ' {print '} '

Echo $LOAD

}

Check_mem_free () {

Free= ' Free-b | awk ' nr==2 {print $4} '

Cache= ' Free-b | awk ' nr==2 {print $7} '

Mem= ' echo $[free+cache] '

Echo $mem

}

Check_tcp () {

Listen= ' Netstat-an | awk '/^tcp/{a[$NF]++}end{for (i in a) print I,a[i]} ' | awk ' nr==2 {print $} '

Echo $listen

}

Check_disk () {

root_disk= ' Df-h | awk ' Nr==3{print $4} ' | Awk-f "%" ' {print '} '

Echo $root _disk

}

$

[Email protected] scripts]#

Open The Zabbix script function, I am now used to put the implementation of the key, placed in another path, after the document more good distinction, it is recommended that you do this:

Enter /usr/local/zabbix/etc/zabbix_agentd.conf configuration file Modification

Logremotecommands=1 # # # Open script feature

[Email protected] zabbix]# CD etc/zabbix_agentd.conf.d/

[[email protected] zabbix_agentd.conf.d]# ls

nginx.conf os.conf tcp.conf

[email protected] zabbix_agentd.conf.d]# cat os.conf

Userparameter=os[*],/usr/local/zabbix/scripts/os.monitor.sh $

Configure-- templates on http://192.168.5.129/php/index.php-- Create templates

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/A5/75/wKioL1m-KNayF0xNAABLNS7xtk8501.png "title=" Image 6.png "width=" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:85px; "alt=" Wkiol1m-knayf0xnaablns7xtk8501.png "/>

Configure template name, group

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/06/C5/wKiom1m-KRyw6hFrAABRLqom1x8259.png "title=" Image 8.png "width=" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:95px "" alt= " Wkiom1m-kryw6hfraabrlqom1x8259.png "/>

Configuring monitoring items on the os template

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/06/C5/wKiom1m-KYOxwl9OAABRLqom1x8229.png "title=" Image 8.png "width=" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:95px "" alt= " Wkiom1m-kyoxwl9oaabrlqom1x8229.png "/>

Create a Monitor box item configuration name, key value (corresponding when the key value is configured [email protected] zabbix_agentd.conf.d]# cat os.conf

Userparameter=os[*],/usr/local/zabbix/scripts/os.monitor.sh the configured os[*] format, and Check_ Cpu_num is the parameter in the corresponding shell script) to continue adding several monitoring items

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/06/C5/wKiom1m-Ka3A6nNJAADNPQqAZX4032.png "title=" Picture 9.png "Width=" "height=" 438 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:438px; "alt=" Wkiom1m-ka3a6nnjaadnpqqazx4032.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/06/C5/wKiom1m-KcHCj-feAAEGI-kO9GM591.png "title=" Picture 10.png "Width=" "height=" 387 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:700PX;HEIGHT:387PX; "alt=" Wkiom1m-kchcj-feaaegi-ko9gm591.png "/>

In addition to the configuration image (because it is not perfect to add only monitoring items without pictures)

Click image Create a graphic Add the monitoring item in

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/06/C5/wKiom1m-KdOx3_3LAACuj2bhnkA371.png "title=" Image 11.png "width=" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:440px; "alt=" Wkiom1m-kdox3_3laacuj2bhnka371.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/A5/75/wKioL1m-KbWxl3oQAABmubZAtP8369.png "title=" Picture 12.png "Width=" "height=" 198 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:198px; "alt=" Wkiol1m-kbwxl3oqaabmubzatp8369.png "/>

adding templates to the host Configuring - --- templates

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/06/C5/wKiom1m-KfPB4M6SAACng0o1AWw616.png "title=" Picture 13.png "Width=" "height=" 275 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:275px; "alt=" Wkiom1m-kfpb4m6saacng0o1aww616.png "/>

Check the image there are several more detections we just added

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/A5/75/wKioL1m-KdXBTUPrAAKd8yUajkA937.png "title=" Picture 14.png "Width=" "height=" 387 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:700PX;HEIGHT:387PX; "alt=" Wkiol1m-kdxbtupraakd8yuajka937.png "/>

A simple custom template has been completed


This article is from the "First Legehappy51cto blog" blog, be sure to keep this source http://legehappy.blog.51cto.com/13251607/1966054

Zabbix using its own scripting templates and Zabbix two ways to add monitoring of specified processes and ports

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.