See www.zabbix.com for the official Zabbix site.

Docs/specs/ZBXNEXT-1219

From Zabbix.org
Jump to: navigation, search

Support of LLD macros for applications

ZBXNEXT-1219

Status: v1.1

Owner: Alexei, Sasha

Summary

The proposed functionality allows to create new applications based on values of LLD macros.

Specification

Application prototypes could be defined for item prototypes but visible for all item prototypes of that discovery rule. Discovered items will be linked to applications created based on the application prototypes.

Like other discovered entities applications follow the lifetime defined in discovery rule ('keep lost resources period' setting) - they are removed after not being discovered for the specified number of days.

Item-application link is removed either when application is not discovered anymore or when item-application prototype link is removed and the linked item is still being discovered.

Application prototypes may contain LLD macros.

In case if there are no item prototypes for an application prototype, the application prototype will be automatically removed.

In case if an application prototype changed its value Zabbix Server should create new application, unlink old application from discovered items and remove the old application.

An application prototype can discover multiple applications, however no application can be discovered by several prototypes inside one discovery rule. If an application is discovered by more than one prototype inside one discovery rule, then the first application prototype item link prototypes are processed and an LLD error is reported about application naming conflict.

Two (or more) discovery rules can result in discovering the same application name. In this case one application is created, items from both discovery rules are linked to this application and one application discovery record for each discovery rule is created.

Template linking must also support application and item-application prototypes.

Template unlinking must remove discovered applications if they are not discovered also by LLD rules defined in other templates.

Server-side changes

Server will support application prototype linkage like for normal applications.

Front-end changes

Two new controls will be added to the Item Prototype configuration form after Applications:

 New application prototype [    ] # same size as for 'New application'
 Application prototypes    [    ] # list to select Application prototypes, same size as for Applications

Validation:

 New application prototype: can contain normal strings, LLD macros and combination of both. For example: MySQL, {#PORTNUM}, APP_{#APPNAME}_{#PORTNUM}
 Application prototype: none, one or more selected application prototypes

Changes in views:

  • Applications column in Item prototype list will show only normal applications and there will be no additional column for application prototypes.
  • Applications list in Item prototype configuration form and Web scenarios configuration form will contain only normal applications. Item configuration form will contain normal applications and discovered applications.
  • Front-end should mark 'lost' applications. An info column should be added to applications list to show '!' icon for lost resources with a tooltip displaying the resource remove time.

API changes

itemprototype
  • itemprototype.get will support the new parameter:
    • selectApplicationPrototypes - array, will return application prototypes linked to the item prototypes;
  • itemprototype.create will support the new parameter:
    • applicationPrototypes - array, application prototypes to link for the item prototype; new application prototype will also be created on a host;
  • itemprototype.update will support the new parameter:
    • applicationPrototypes - array, application prototypes to replace for the item prototype; new application prototype will also be created on a host; unused item prototypes will be deleted from a host;
application
  • application.get will support new parameters:
    • selectDiscoveryRule - query, return the LLD rule that created the application in the discoveryRule property.
    • selectApplicationDiscovery - query, return the application discovery object in the applicationDiscovery property. The application discovery object links the application to an application prototype from which it was created.
applicationPrototype property
 ,-------------------------+--------+----------------------------------------------------------,
 | application_prototypeid | string | (readonly) ID of the application prototype id            |
 | name                    | string | name of the application prototype                        |
 | templateid              | string | (readonly) ID of the parent application prototype        |
 '-------------------------+--------+----------------------------------------------------------'
template linkage

All template linkage operations will support the application prototypes.

XML import/export

XML import/export will support new property <application_prototypes> for each item prototype. It will contain list of <application_prototype> and which contains <name>:

 <item_prototypes>
   <item_prototype>
     ...
     <application_prototypes>
       <application_prototype>
          <name>MySQL</name>
       </application_prototype>
       <application_prototype>
          <name>{#PORTNUM}</name>
       </application_prototype>
       <application_prototype>
          <name>APP_{#APPNAME}_{#PORTNUM}</name>
       </application_prototype>
     </application_prototypes>
   </item_prototype>
   ...
 </item_prototypes>

Translation strings

  • New application prototype
  • Application prototypes
  • Cannot add a discovered application "%1$s" to a web scenario.
  • The application is not discovered anymore and will be deleted the next time discovery rule is processed.
  • The application is not discovered anymore and will be deleted in %1$s (on %2$s at %3$s).
  • Cannot set "templateid" field for application prototype in item prototype "%1$s".
  • Duplicate "name" value "%1$s" for application prototype in item prototype "%2$s".
  • Missing "name" field for application prototype in item prototype "%1$s".
  • Cannot update discovered application "%1$s".
  • Cannot delete discovered application "%1$s".

Database changes

New table 'application_prototype':

 TABLE|application_prototype|application_prototypeid|ZBX_DATA
 FIELD   |application_prototypeid |t_id          |    |NOT NULL |0
 FIELD   |itemid                  |t_id          |    |NOT NULL |0 |1|items
 FIELD   |templateid              |t_id          |    |NULL     |0 |2|application_prototype|application_prototypeid
 FIELD   |name                    |t_varchar(255)|''  |NOT NULL |0
 INDEX   |1 |itemid
 INDEX   |2 |templateid

New table 'application_discovery':

 TABLE|application_discovery|application_discoveryid|ZBX_DATA
 FIELD   |application_discoveryid |t_id          |    |NOT NULL |0          |1|applications
 FIELD   |applicationid           |t_id          |    |NOT NULL |0          |1|applications
 FIELD   |application_prototypeid |t_id          |    |NOT NULL |0          |2|application_prototype
 FIELD   |name                    |t_varchar(255)|''  |NOT NULL |ZBX_NODATA
 FIELD   |lastcheck               |t_integer     |'0' |NOT NULL |ZBX_NODATA
 FIELD   |ts_delete               |t_time        |'0' |NOT NULL |ZBX_NODATA
 INDEX   |1 |applicationid
 INDEX   |2 |application_prototypeid

New table 'item_application_prototype':

 TABLE|item_application_prototype|item_application_prototypeid|ZBX_DATA
 FIELD   |item_application_prototypeid |t_id     |    |NOT NULL |0
 FIELD   |application_prototypeid      |t_id     |    |NOT NULL |0 |1|application_prototype
 FIELD   |itemid                       |t_id     |    |NOT NULL |0 |2|items
 UNIQUE  |1 |application_prototypeid,itemid
 INDEX   |2 |itemid

new field for table 'applications':

 FIELD		|flags		|t_integer	|'0'	|NOT NULL	|0

Documentation

  • What's new in Zabbix 3.0
  • Zabbix Manual
    • API
    • API changelog
    • XML changelog (export format changes in the internal docs)

Also discussed

  • Creation of the multiple application prototypes will not be supported, same as for normal applications currently.
  • We continue to support any characters in application name.

ChangeLog

  • v1.1 changed rules of discovered application removal
  • v1.0 first release