Blog: Blog Garden personal
I did before RDS monitor , because RDS More examples , Manual addition is not efficient , So it's changed to LLD(Low-level discovery) Way to monitor .
What is? LLD
LLD(Low-level discovery), That is, low-level discovery , It provides a way to automatically create monitoring items for different entities on the computer , Trigger and graphic methods . for example ,Zabbix You can start monitoring the file system or network interface automatically on your machine , Instead of manually creating monitoring items for each file system or network interface . Besides , You can configure the Zabbix According to the actual results after regular implementation of the discovery , To remove unwanted monitoring .
Users can define their own discovery types , As long as they follow specific JSON agreement .
Collect data script
Call alicloud Api, collection RDS related data , For relevant configurations, please refer to Previous post , Collection script omitted .
Need to put Api Processing of returned data , Change the field to {#MACRO}
Formal LLD macro , The last generation json Formatted data :
for example :
[{
"{#DBINSTANCEID}": "rr-XXX",
"{#DBNAME}": "XXX"
}, {
"{#DBINSTANCEID}": "rm-XXX",
"{#DBNAME}": "XXX"
}, {
"{#DBINSTANCEID}": "rm-XXX",
"{#DBNAME}": "XXX"
}]
explain :
{#DBINSTANCEID}
:RDS example ID{#DBNAME}
:RDS Instance name
Tips:LLD Macros must be capitalized , Otherwise, an error will be reported .
The configuration template
New template , Create autodiscover rules :
explain :
Parameters | explain |
---|---|
name | Rule name |
type | Types of inspections found |
Key value | It can be a built-in key value , It can also be customized |
Update interval | Time interval between discovery execution |
Custom time interval | Non essential election , flexible : Allows you to redefine the default update interval , Dispatch : It can make the monitored item effective at a specific time or time series |
Insufficient resource cycle | Resource expiration time , If the resource fails, delete , If set to “0”, The entity will be deleted immediately . Not recommended “0” |
Create a monitoring prototype :
Create trigger prototype :
Create graphic prototypes :
And so on , Add all the items that need to be monitored .
See the effect :
summary
LLD The way , It greatly reduces the burden of artificially adding monitoring ,RDS There is no need to add, delete and monitor the changes of instances , Truly achieve automatic monitoring .
But it also brings some problems , For example, performance problems , The more examples , The more prototypes you monitor , The more monitoring and collection script processes executed at the same time , The greater the load pressure on the server , And frequently call Alibaba cloud Api It will also bring some costs .
therefore , This monitoring scheme is limited to Alibaba cloud RDS Scenarios with a small number of instances . If there are many instances , Consider increasing the cache , Read data once , Store data in cache , Then monitor the client to read data from the cache , Reduce the frequency of invoking collection scripts .