Zabbix Documentation 3.4

2.23.03.4In development:4.0Unsupported versions:1.82.02.43.2

User Tools

Site Tools


manual:discovery:low_level_discovery

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
manual:discovery:low_level_discovery [2018/02/09 10:48]
martins-v user parameter limit for custom lld
manual:discovery:low_level_discovery [2018/05/18 06:52] (current)
martins-v moving item/trigger/graph prototype info to top level of lld documentation
Line 17: Line 17:
 When the server receives a value for a discovery item, it looks at the macro -> value pairs and for each pair generates real items, triggers, and graphs, based on their prototypes. In the example with "​net.if.discovery"​ above, the server would generate one set of items, triggers, and graphs for the loopback interface "​lo",​ and another set for interface "​eth0"​. When the server receives a value for a discovery item, it looks at the macro -> value pairs and for each pair generates real items, triggers, and graphs, based on their prototypes. In the example with "​net.if.discovery"​ above, the server would generate one set of items, triggers, and graphs for the loopback interface "​lo",​ and another set for interface "​eth0"​.
  
-For more detail ​on the process described above see the following sections ​with how-tos for performing all types of out-of-the-box discovery:+=== Configuring low-level discovery === 
 + 
 +We will illustrate low-level discovery based on an example of file system discovery. 
 + 
 +To configure the discovery, do the following:​ 
 + 
 +  * Go to: //​Configuration//​ -> //​Templates//​  
 +  * Click on //​Discovery//​ in the row of an appropriate template 
 + 
 +{{manual:​discovery:​low_level_discovery:​fs_templates.png|}} 
 + 
 +  * Click on //Create discovery rule// in the upper right corner of the screen 
 +  * Fill in the discovery rule form with the required details 
 + 
 +=== Discovery rule === 
 + 
 +The **Discovery rule** tab contains general discovery rule attributes:  
 + 
 +{{manual:​discovery:​low_level_discovery:​lld_rule_fs.png|}} 
 + 
 +^Parameter^Description^ 
 +|//​Name// ​ |Name of discovery rule.  | 
 +|//​Type// ​ |The type of check to perform discovery; should be //Zabbix agent// or //Zabbix agent (active)// for file system discovery. ​ | 
 +|//​Key// ​ |An item with "​vfs.fs.discovery"​ key is built into Zabbix agent since version 2.0 on many platforms (see [[manual:​appendix:​items:​supported_by_platform|supported item key list]] for details), and will return a JSON with the list of file systems present on the computer and their types. ​ | 
 +|//Update interval// ​ |This field specifies how often Zabbix performs discovery. In the beginning, when you are just setting up file system discovery, you might wish to set it to a small interval, but once you know it works you can set it to 30 minutes or more, because file systems usually do not change very often.\\ [[:​manual/​appendix/​suffixes|Time suffixes]] are supported, e.g. 30s, 1m, 2h, 1d, since Zabbix 3.4.0.\\ [[:​manual/​config/​macros/​usermacros|User macros]] are supported, since Zabbix 3.4.0.\\ //Note//: If set to '​0',​ the item will not be polled. However, if a flexible interval also exists with a non-zero value, the item will be polled during the flexible interval duration. ​ | 
 +|//Custom intervals// ​ |You can create custom rules for checking the item:\\ **Flexible** - create an exception to the //Update interval// (interval with different frequency)\\ **Scheduling** - create a custom polling schedule.\\ ​For detailed information see [[manual:​config:​items:​item:​custom_intervals|Custom intervals]]. Scheduling is supported since Zabix 3.0.0. ​ | 
 +|//Keep lost resources period// ​ |This field allows you to specify the duration for how long the discovered entity will be retained (won't be deleted) once its discovery status becomes "Not discovered anymore"​ (min 1 hour, max 25 years).\\ [[:​manual/​appendix/​suffixes|Time suffixes]] are supported, e.g. 2h, 1d, since Zabbix 3.4.0.\\ [[:​manual/​config/​macros/​usermacros|User macros]] are supported, since Zabbix 3.4.0.\\ //Note:// If set to "​0",​ entities will be deleted immediately. Using "​0"​ is not recommended,​ since just wrongly editing the filter may end up in the entity being deleted with all the historical data.   | 
 +|//​Description// ​ |Enter a description. ​ | 
 +|//​Enabled// ​ |If checked, the rule will be processed. ​ | 
 + 
 +=== Discovery rule filter === 
 + 
 +The **Filters** tab contains discovery rule filter definitions:​  
 + 
 +{{manual:​discovery:​low_level_discovery:​lld_rule_fs2.png|}} 
 + 
 +^Parameter^Description^ 
 +|//Type of calculation// ​ |The following options for calculating filters are available:​\\ **And** - all filters must be passed;\\ **Or** - enough if one filter is passed;\\ **And/Or** - uses //And// with different macro names and //Or// with the same macro name;\\ **Custom expression** - offers the possibility to define a custom calculation of filters. The formula must include all filters in the list. Limited to 255 symbols. ​ | 
 +|//​Filters// ​ |A filter can be used to generate real items, triggers, and graphs only for certain file systems. It expects a [[https://​en.wikipedia.org/​wiki/​Perl_Compatible_Regular_Expressions|Perl Compatible Regular Expression]] (PCRE). For instance, if you are only interested in C:, D:, and E: file systems, you could put {#FSNAME} into "​Macro"​ and <​nowiki>"​^C|^D|^E"</​nowiki>​ regular expression into "​Regular expression"​ text fields. Filtering is also possible by file system types using {#FSTYPE} macro (e.g. <​nowiki>"​^ext|^reiserfs"</​nowiki>​) and by drive types (supported only by Windows agent) using {#​FSDRIVETYPE} macro (e.g., <​nowiki>"​fixed"</​nowiki>​).\\ You can enter a regular expression or reference a global [[manual:​regular_expressions|regular expression]] in "​Regular expression"​ field.\\ In order to test a regular expression you can use "grep -E", for example: <code bash>for f in ext2 nfs reiserfs smbfs; do echo $f | grep -E '​^ext|^reiserfs'​ || echo "SKIP: $f"; done</​code>​{#​FSDRIVETYPE} macro on Windows is supported since Zabbix **3.0.0**.\\ Defining several filters is supported since Zabbix **2.4.0**.\\ Note that if some macro from the filter is missing in the response, the found entity will be ignored. ​ | 
 + 
 +<note important>​Zabbix database in MySQL must be created as case-sensitive if file system names that differ only by case are to be discovered correctly.</​note>​ 
 + 
 +<note important>​The mistake or typo in regex used in LLD rule may cause deleting thousands of configuration elements, historical values and events for many hosts. For example, incorrect "File systems for discovery"​ regular expression may cause deleting thousands of items, triggers, historical values and events.</​note>​ 
 + 
 +<​note>​Discovery rule history is not preserved.</​note>​ 
 + 
 +=== Item prototypes === 
 + 
 +Once a rule is created, go to the items for that rule and press "​Create prototype"​ to create an item prototype. Note how macro {#FSNAME} is used where a file system name is required. When the discovery rule is processed, this macro will be substituted with the discovered file system. 
 + 
 +{{manual:​discovery:​low_level_discovery:​item_prototype_fs.png|}} 
 + 
 +Attributes that are specific for item prototypes:​ 
 + 
 +^Parameter^Description^ 
 +|//New application prototype// ​ |You may define a new application prototype.\\ In application prototypes you can use low-level discovery macros that, after discovery, will be substituted with real values to create applications that are specific for the discovered entity. See also [[manual:​discovery:​low_level_discovery:​notes|application discovery notes]] for more specific information. ​ | 
 +|//​Application prototypes// ​ |Select from the existing application prototypes. ​ | 
 +|//Create enabled// ​ |If checked the item will be added in an enabled state.\\ If unchecked, the item will be added to a discovered entity, but in a disabled state. ​ | 
 + 
 +We can create several item prototypes for each file system metric we are interested in: 
 + 
 +{{manual:​discovery:​low_level_discovery:​item_prototypes_fs.png|}} 
 + 
 +=== Trigger prototypes === 
 + 
 +We create trigger prototypes in a similar way as item prototypes:​ 
 + 
 +{{manual:​discovery:​low_level_discovery:​trigger_prototype_fs.png|}} 
 + 
 +Attributes that are specific for trigger prototypes:​ 
 + 
 +^Parameter^Description^ 
 +|//Create enabled// ​ |If checked the trigger will be added in an enabled state.\\ If unchecked, the trigger will be added to a discovered entity, but in a disabled state. ​ | 
 + 
 +When real triggers are created from the prototypes, there may be a need to be flexible as to what constant ('​20'​ in our example) is used for comparison in the expression. See how [[:​manual/​discovery/​low_level_discovery#​using_lld_macros_in_user_macro_contexts|user macros with context]] can be useful to accomplish such flexibility. 
 + 
 +You can define [[:​manual/​config/​triggers/​dependencies|dependencies]] between trigger prototypes as well (supported since Zabbix 3.0). To do that, go to the //​Dependencies//​ tab. A trigger prototype may depend ​on another trigger prototype from the same low-level discovery (LLD) rule or on a regular trigger. A trigger prototype may not depend on a trigger prototype from a different LLD rule or on a trigger created from trigger prototype. Host trigger prototype cannot depend on a trigger from a template. 
 + 
 +{{manual:​discovery:​low_level_discovery:​trigger_prototypes_fs.png|}} 
 + 
 +=== Graph prototypes === 
 + 
 +We can create graph prototypes, too: 
 + 
 +{{manual:​discovery:​low_level_discovery:​graph_prototype_fs.png|}} 
 + 
 +{{manual:​discovery:​low_level_discovery:​graph_prototypes_fs.png|}} 
 + 
 +Finally, we have created a discovery rule that looks like shown below. It has five item prototypes, two trigger prototypes, and one graph prototype. 
 + 
 +{{manual:​discovery:​low_level_discovery:​lld_rules_fs.png|}} 
 + 
 +//Note//: For configuring host prototypes, ​see the section about [[:​manual/​vm_monitoring#​host_prototypes|host prototype]] configuration in virtual machine monitoring. 
 + 
 +== Discovered entities == 
 + 
 +The screenshots below illustrate how discovered items, triggers, and graphs look like in the host's configuration. Discovered entities are prefixed ​with an orange link to a discovery rule they come from. 
 + 
 +{{manual:​discovery:​low_level_discovery:​discovered_items.png|}} 
 + 
 +Note that discovered entities will not be created in case there are already existing entities with the same uniqueness criteria, for example, an item with the same key or graph with the same name. 
 + 
 +Items (similarly, triggers and graphs) created by a low-level discovery rule will be deleted automatically if a discovered entity (file system, interface, etc) stops being discovered (or does not pass the filter anymore). In this case the items, triggers and graphs will be deleted after the days defined in the //Keep lost resources period// field pass. 
 + 
 +When discovered entities become 'Not discovered anymore',​ a lifetime indicator is displayed in the item list. Move your mouse pointer over it and a message will be displayed indicating ​how many days are left until the item is deleted. 
 + 
 +{{:​manual:​discovery:​low_level_discovery:​not_discovered_message.png|}} 
 + 
 +If entities were marked for deletion, but were not deleted at the expected time (disabled discovery rule or item host), they will be deleted the next time the discovery rule is processed. 
 + 
 +Entities containing other entities, which are marked for deletion, will not update if changed on the discovery rule level. For example, LLD-based triggers will not update if they contain items that are marked ​for deletion. 
 + 
 +{{manual:​discovery:​low_level_discovery:​discovered_triggers.png|}} 
 + 
 +{{manual:​discovery:​low_level_discovery:​discovered_graphs.png|}} 
 + 
 +=== Other types of discovery === 
 + 
 +More detail and how-tos on other types of out-of-the-box discovery ​is available in the following sections:
  
-  * discovery of [[:​manual/​discovery/​low_level_discovery/​filesystems|file systems]]; 
   * discovery of [[:​manual/​discovery/​low_level_discovery/​network_interfaces|network interfaces]];​   * discovery of [[:​manual/​discovery/​low_level_discovery/​network_interfaces|network interfaces]];​
   * discovery of [[:​manual/​discovery/​low_level_discovery/​cpu|CPUs and CPU cores]];   * discovery of [[:​manual/​discovery/​low_level_discovery/​cpu|CPUs and CPU cores]];