Demo Zabbix LLD (low-level Discovery) how to use

Source: Internet
Author: User
Tags couchbase

Demo Zabbix LLD (low-level Discovery) how to use

2016/11/30


Objective: To monitor the needs of multiple buckets on couchbase to illustrate how Zabbix LLD works.

About LLD, the article on the network is also quite a lot of, I hope I can write a simple and clear howto to help beginners.


First, the preparatory work

1, "Zabbix-agent"

1) Script Example

[[email protected] scripts]# cat monitor_couchbase.sh   #!/bin/bash# #2016/ 11/25#v1.3#pc#echo  "[' Date '] $1 $2 $3"  >>/tmp/test.logcb_opts= '-c  127.0.0.1:8091 -u administrator -p xxx ' curl_opts= '-s -u administrator:xxx  Http://127.0.0.1:8091/pools/default/buckets ' # #usage () {    cat <<_eofusage:   $0  [cluster_info|cluster_list|cluster_healthy]         $0  [node_healthy|node_active]        $0   [bucket_list|bucket_info|bucket_lld]_eof}###### cb cluster details ##### #cb_cluster_ info () {    /opt/couchbase/bin/couchbase-cli server-info  $CB _opts}cb_cluster_list () {    /opt/couchbase/bin/couchbase-cli server-list  $CB _opts}cb_cluster_healthy ( ) {&NBSP;&NBSP;&NBSP;&NBSP;CB_CLUster_list |grep -o  ' 8091 healthy active '  |wc -l}###### cb current  node status ##### #cb_node_healthy () {    local stat= ' Cb_cluster_info  |jq  '. Status '  |cut -d  ' '  -f2 '     if [  ' X$stat '  ==  "Xhealthy"  ]; then echo 1; else echo 0;fi}cb_node_active () {     local stat= ' cb_cluster_info |jq  '. Clustermembership '  |cut -d   ' '  -f2 '     if [  ' x$stat '  ==  ' xactive '  ]; then  echo 1; else echo 0;fi}###### cb bucket details ##### #cb_bucket_ List () {    /opt/couchbase/bin/couchbase-cli bucket-list  $CB _opts |sed  -e  '/(buckettype|authtype|saslpassword|proxyport|numreplicas|ramquota|ramused)/d '}cb_bucket_info () {     # exp:    # memused, dataused, diskused, itemcount,  diskfetches, opspersec, quotapercentused    local bucket_name=$1     curl  $curl _opts/$bucket _name |jq  ". basicstats.$2"  |cut -d  "'  -f2}cb_bucket_lld_pre () {    local buckets= ' cb_bucket_list '      echo  $buckets  |grep -o  ' ERROR '  >/dev/null && exit 2      for i in  $buckets     do         printf  ' \t\t{\n '         echo - e  "\t\t\t\" {#BUCKETNAME}\ ":  \" $i \ ""         printf  "\t\t },\n '     done}cb_bucket_lld () {    printf  ' {\ n '      printf  ' \ t ' data:  [\N '     cb_bucket_lld_pre |sed  ' $d '     printf  ' \t\t}\n '     printf  ' \t]\n '     printf  '}\n '}# #case  $1 in     cluster_info|cluster_list|cluster_healthy|node_healthy|node_active|bucket_list|bucket_ INFO|BUCKET_LLD)         cb_$1 $2 $3         ;;     *)         usage         ;; Esac


2) zabbix-agent Configuration Example

[Email protected] scripts]# cat/etc/zabbix/zabbix_agentd.d/userparameter_couchbase.conf # # Clusteruserparameter= Couchbase.cluster.healthy[*],/bin/bash/etc/zabbix/scripts/monitor_couchbase.sh cluster_healthy## Nodeuserparameter=couchbase.node.healthy[*],/bin/bash/etc/zabbix/scripts/monitor_couchbase.sh node_ Healthyuserparameter=couchbase.node.active[*],/bin/bash/etc/zabbix/scripts/monitor_couchbase.sh node_active## Bucketuserparameter=couchbase.bucket.discovery[*],/bin/bash/etc/zabbix/scripts/monitor_couchbase.sh bucket_ Llduserparameter=couchbase.bucket.get[*],/bin/bash/etc/zabbix/scripts/monitor_couchbase.sh bucket_info


3) Restart Zabbix-agent

[Email protected] scripts]# service zabbix-agent restart


2, "Zabbix-server"

1) test the data obtained from the discovery

[[email protected] ~]# zabbix_get -s 10.50.200.33 -k  ' Couchbase.bucket.discovery '                    {         "Data": [                 {                           "{#BUCKETNAME}":  "account"                  },                 {                          "{#BUCKETNAME}":  "BBS"                  },                 {                          "{#BUCKETNAME}":  "Client"                  },                 {                          "{#BUCKETNAME}":   "Pay" &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;},                 {                           "{#BUCKETNAME} ":  Shop"                  }        ]}


2) The format shown above is the data expected from the execution of the Zabbix LLD.




Ii. Configuring templates and corresponding LLD rules on the Zabbix web

1) Create a new template: Zbx_couchbase


2) in the template, select "Discovery Rules", add a rule name: "Couchbase.bucket.discovery", the focus is:

A. In "Key", fill in the name defined in the previous section in Zabbix-agent: "Couchbase.bucket.discovery"

B. Add a Macro to the section "Filters": {#BUCKETNAME} (this name is defined in the script in the previous section and can be customized)


3) The next step is to add a few "item prototypes" to the difference between the normal item: the Macro defined in the previous step is referenced in Key, example:

Name:couchbase bucket [{#BUCKETNAME}]-quotapercentusedkey:couchbase.bucket.get[{#BUCKETNAME},quotapercentused]


Note: After the LLD executes, the corresponding value of each {#BUCKETNAME} will be obtained and automatically generate the corresponding Item, which can be understood as a looping operation.

4) The next step is to create the corresponding "Trigger prototypes", which is not mentioned here;

5) Of course, you can also add a few ordinary items,triggers,graphs in this template, this is omitted;

6) Please refer to the example of the accompanying drawings.

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/8A/E5/wKiom1g-dlrRoCT5AABVL-isj3k765.png "style=" float: none; "title=" Lld_01.png "alt=" Wkiom1g-dlrroct5aabvl-isj3k765.png "/>

F-01

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/8A/E1/wKioL1g-dlqShMddAABqg7rnu20525.png "style=" float: none; "title=" Lld_02.png "alt=" Wkiol1g-dlqshmddaabqg7rnu20525.png "/>

F-02

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/8A/E5/wKiom1g-dlryILvBAAA3STlroWQ360.png "style=" float: none; "title=" Lld_03.png "alt=" Wkiom1g-dlryilvbaaa3stlrowq360.png "/>

F-03

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/8A/E1/wKioL1g-dluCKx69AAE4dvroGSo813.png "style=" float: none; "title=" Lld_04.png "alt=" Wkiol1g-dluckx69aae4dvrogso813.png "/>

F-04

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/8A/E5/wKiom1g-dlvhEKvNAAB4zJDzfzo653.png "style=" float: none; "title=" Lld_05.png "alt=" Wkiom1g-dlvhekvnaab4zjdzfzo653.png "/>

F-05

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/8A/E5/wKiom1g-dlyxoMKjAACRwE8Zza8929.png "style=" float: none; "title=" Lld_06.png "alt=" Wkiom1g-dlyxomkjaacrwe8zza8929.png "/>

F-06

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/8A/E1/wKioL1g-dlyQR5UcAACEFKbJrng025.png "style=" float: none; "title=" Lld_07.png "alt=" Wkiol1g-dlyqr5ucaacefkbjrng025.png "/>

F-07

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/8A/E5/wKiom1g-dl2gpFmQAAB5ZrYN6xU466.png "style=" float: none; "title=" Lld_08.png "alt=" Wkiom1g-dl2gpfmqaab5zryn6xu466.png "/>

F-08





Demo Zabbix LLD (low-level Discovery) how to use

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.