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

Docs/specs/ZBXNEXT-20

From Zabbix.org
Jump to: navigation, search

Web monitoring based on templates

ZBXNEXT-20

Status: v1.11

Owner: Alexei Vladishev

Summary

Zabbix should support creation of web scenarios based on templates.

Specification

It should be possible to attach a web scenario to a host template. The web scenario will be inherited by all hosts linked to the template.

Details

General
  • Web scenarios could be created for both templates and hosts.
  • A web scenario created for a template will be automatically created for all linked hosts (like templated items, triggers, graphs).
  • Web scenario name is unique on host and template level.
  • Dashboard web monitoring widget and screen element should display status of host scenarios only.
  • Web scenarios should be exposed in global search results.
  • This functionality will be supported by both Zabbix server and proxy.
  • If item with the same key already exists, API/front-end/server should fail adding or editing web scenario.
Template linkage
  • Host template linkage should respect web scenarios, i.e. must be automatically created/removed/etc depending on template linkage. It affects both front-end (API) and server.
  • Web scenario linkage criteria: web scenario name + all web step names & order are the same (case sensitive).
    • Scenario and step properties will NOT be overwritten in case of linkage of existing web scenario
  • Web scenario uniqueness criteria: web scenario name (case sensitive)
    • Zabbix will complain when trying to add a new scenario with existing name
Proxy side changes
  • Zabbix proxy will use new database structure
  • Only configuration of host level web scenarios will be stored in the Zabbix proxy database
Change of existing functionality
  • Web scenarios will be linked directly to a host or template
  • Web scenario can be optionally linked to one application
Editing of templated web scenarios
  • Cannot be overwritten on host level: web scenario name, web step names and order
  • Only modified properties are overwritten in downstream linked web scenarios and steps.
Support of new macros
  • {HOST.CONN}, {HOST.DNS}, {HOST.HOST}, {HOST.IP}, {HOST.NAME}, {$MACRO}
    • Web scenario: name, variables
    • Web step: name, URL, POST, required string
  • For {HOST.CONN}, {HOST.DNS} and {HOST.IP} macro will use the main agent interface, however, if it is not present, main SNMP interface will be used. If SNMP is also not present, main JMX interface will be used. If JMX is not present either, main IPMI interface will be used.
  • {$MACRO}
    • Web scenario: agent, basic and NTLM authentication username and password
    • Web step: required status codes
  • Monitoring -> Web
    • Web scenario names and step names should resolve all supported macros
  • Configuration -> Web
    • No macros should be resolved
Front-end changes
  • Web scenario form
    • Host selection element should be added as a first field. It will be disabled when editing existing web scenario (like in item form).
    • In templated scenarios, "Parent scenarios" should be added at the very top. It should work the same as in other templated entities (for example, items).
    • Application selection field will be under web scenario name.
    • Application selection field is changed to single value dropdown.
    • New application field will be added like in host item form.
  • Configuration
    • Configuration -> Web will be removed
    • Configuration -> Templates and Configuration -> Hosts will be extended to have a link to web scenarios
      • New column Web will be displayed after Discovery
      • Number of web scenarios will be displayed for each host and template, for example, Web (3), Web (0)
      • The Web will be clickable with navigation to the list of web scenarios of selected host or template
      • List of web scenarios will be designed similar to the list of triggers with host navigation panel on top
      • The host navigation panel will be extended to have a link to the list of web scenarios called Web scenarios (N)
  • In the scenario list, templated scenarios should be prefixed with template name in the same way as other entities (for example, items).
  • Clone/full clone
    • No changes in cloning hosts and templates, no cloning of web scenarios will be performed there
  • Web scenarios are added in global search reasults
    • Links to configuration and monitoring are added for hosts (last in each section - after Screens for monitoring, after Graphs for configuration)
    • Link to configuration is added for templates (last, after Screens)
    • Link name is Web; count is displayed in parenthesis for configuration links same as for other entities
  • In Configuration -> Web and Monitoring -> Web, grouping by applications is removed
  • Available mass update actions (enable/disable/clear history/delete) do not change (for example, web scenario copying is out of scope)
XML import/export
  • Import/export of web scenarios will not be developed in this issue.

API

The following changes have to be made to the API. Additional changes may be made if needed.

httptest

The web scenario API must implement all of the functionality to work with template objects.

  • existing webcheck will be renamed to httptest with webcheck remaining as an alias of httptest;
  • httptest properties:
    • hostid - can only be set when calling httptest.create;
    • templateid - readonly;
    • applicationid - must always belong to the WwebEB scenario's host.
  • httptest.get:
    • Additional parameters:
      • templateids - string/array, return web scenarios that belong to the given templates;
      • inherited - boolean, if set to true, return only inherited web scenarios;
      • templated - boolean, if set to true, return only web scenarios that belong to templates
      • expandName - flag, expand macros in the name;
      • expandStepName - flag, expand macros in step names;
    • selectSteps result should have 'httpstepid' field. 'webstepid' is marked as deprecated.
  • httptest.create:
    • To avoid breaking compatibility, hostid can be omitted when calling httptest.create if applicationid is given. In this case, we fallback to the application's host.
  • httptest.update:
    • httptest.update should silently ignore fields that cannot be changed for inherited web scenarios.
    • An error must be triggered when trying to add or remove web step for inherited web scenarios.
  • httptest.delete:
    • Inherited web scenarios cannot be deleted.
  • Do not add a public syncTemplates() method.
host
  • host.get
    • Additional parameters:
      • selectHttpTests - query, return host's web scenarios; must support shorten, extend, refer, count and arrays of properties;
        • returned array key is 'httpTests'.
      • Preferably the httptestids parameter should not be added.
template
  • template.get
    • Additional parameters:
      • selectHttpTests - query, return templates's web scenarios; must support shorten, extend, refer, count and arrays of properties;
        • returned array key is 'httpTests'.
      • with_httptests - flag, return only templates that have web scenarios;
      • Preferably the httptestids parameter should not be added.

Database changes

  • httptest
    • New field: hostid
      • FIELD |hostid |t_id | |NOT NULL |ZBX_SYNC,ZBX_PROXY |2|hosts
    • New field: templateid
      • FIELD |templateid |t_id | |NULL |ZBX_SYNC |3|httptest
    • Modified field: applicationid
      • FIELD |applicationid |t_id | |NULL |ZBX_SYNC |1|applications
  • Database patch must fill httptest.hostid with correct hostid.
  • Indexes
    • existing httptest_2 (name) index will be removed
    • new unique index httptest_2 (hostid,name) will be added
    • new index httptest_4 (templateid) will be added
    • "ON DELETE CASCADE" action will be removed from "c_httptest_1" foreign key

Documentation

Test cases

  • Linking a template creates new web scenario on host (both frontend and server)
  • Linking a template updates existing scenario (all properties except scenario name, step names and order) on host (both frontend and server)
  • Unlinking a template unlinks web scenario, but leaves it on lower level templates and hosts (both frontend and server)
  • Unlinking and clearing a template unlinks web scenario and deletes it on lower level templates and hosts (frontend; what about server?)
  • Linking a web scenario to template that is linked to a host creates web scenario on both lower level template and host (both frontend and server)
  • Linking a web scenario to template that is linked to a host which already has such a web scenario creates web scenario on lower level template and updates on host (both frontend and server)
  • Deleting a scenario on template that is linked to other templates and hosts deletes the scenario on all lower level templates and hosts
  • Deleting a template that has web scenario and is linked to other hosts and templates deletes that scenario on all lower level templates and hosts
  • Modifying template properties downstream does not override these properties if other properties are edited upstream
    • Also includes web scenario enabling/disabling from web scenario list in configuration (both single scenario and mass update)
  • Linking a template with web scenario to a host that has scenario with same name but different steps fails
  • Linking a template with web scenario to a template that is linked to a host that has scenario with same name but different steps fails

ChangeLog

  • v1.1
    • Added information about indexes
  • v1.2
    • Added key name for returned array of http tests for host.get and template.get.
  • v1.3
    • Added a note about webcheck remaining as an alias of httptest
  • v1.4
    • Added a note about removing applications grouping from http test lists in frontend
  • v1.5
    • Added a note about application selection field in http test form
  • v1.6
    • Added a note for httptest.get 'selectSteps' param
  • v1.7
    • Added test cases
    • Clarified that mass update actions do not change
  • v1.8
    • Removed selectHost option from httptest.get
  • v1.9
    • Added expandStepName option
  • v1.10
    • Alexei, Sasha: added section 'Proxy side changes'
  • v1.11
    • Richlv: listed adding of links to global search results