NodeConductor Zabbix

NodeConductor Zabbix

/api/zabbix/

A filter backend that uses django-filter. Supported actions and methods:

/api/zabbix/

Methods: GET, POST

Supported fields for creation:

  • namestring
  • project – link to /api/projects/<uuid>/
  • customerlink to /api/customers/<uuid>/
  • settingslink to /api/service-settings/<uuid>/
  • backend_url – URL (Zabbix API URL (e.g. http://example.com/zabbix/api_jsonrpc.php))
  • username – string (Zabbix user username (e.g. admin))
  • password – string (Zabbix user password (e.g. zabbix))
  • available_for_all – boolean (Service will be automatically added to all customers projects if it is available for all)
  • scope – link to any: /api/zabbix-hosts/<uuid>/, /api/zabbix-itservices/<uuid>/ (VM that contains service)
  • database_parameters – string (Zabbix database parameters (default: {“user”: “admin”, “host”: “localhost”, “password”: “”, “port”: “3306”, “name”: “zabbix”}))
  • templates_names – string (List of Zabbix hosts templates (default: []))
  • interface_parameters – string (Default parameters for hosts interface (will be used if interface is not specified) (default: {“ip”: “0.0.0.0”, “useip”: 1, “dns”: “”, “main”: 1, “type”: 1, “port”: “10050”}))
  • host_group_name – string (Zabbix host group name for registered hosts (default: “nodeconductor”))

Filter fields:

  • ?customer = UUIDFilter
  • ?name = string
  • ?settings = link
  • ?project_uuid = UUIDFilter
  • ?project = link
  • ?tag = ModelMultipleChoiceField
  • ?rtag = ModelMultipleChoiceField
  • ?shared = boolean
  • ?type = ServiceTypeFilter

To list all services without regard to its type, run GET against /api/services/ as an authenticated user.

To list services of specific type issue GET to specific endpoint from a list above as a customer owner. Individual endpoint used for every service type.

To create a service, issue a POST to specific endpoint from a list above as a customer owner. Individual endpoint used for every service type.

You can create service based on shared service settings. Example:

POST /api/digitalocean/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "name": "Common DigitalOcean",
    "customer": "http://example.com/api/customers/1040561ca9e046d2b74268600c7e1105/",
    "settings": "http://example.com/api/service-settings/93ba615d6111466ebe3f792669059cb4/"
}

Or provide your own credentials. Example:

POST /api/oracle/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "name": "My Oracle",
    "customer": "http://example.com/api/customers/1040561ca9e046d2b74268600c7e1105/",
    "backend_url": "https://oracle.example.com:7802/em",
    "username": "admin",
    "password": "secret"
}

/api/zabbix/<uuid>/

Methods: GET, PUT, PATCH, DELETE

Supported fields for update:

  • namestring
  • available_for_all – boolean (Service will be automatically added to all customers projects if it is available for all)

/api/zabbix/<uuid>/credentials/

Methods: GET, POST

On GET request - return superadmin user data. On POST - reset superuser password and return new one.

/api/zabbix/<uuid>/link/

Methods: GET, POST

To get a list of resources available for import, run GET against /<service_endpoint>/link/ as an authenticated user. Optionally project_uuid parameter can be supplied for services requiring it like OpenStack.

To import (link with NodeConductor) resource issue POST against the same endpoint with resource id.

POST /api/openstack/08039f01c9794efc912f1689f4530cf0/link/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "backend_id": "bd5ec24d-9164-440b-a9f2-1b3c807c5df3",
    "project": "http://example.com/api/projects/e5f973af2eb14d2d8c38d62bcbaccb33/"
}

/api/zabbix/<uuid>/managed_resources/

Methods: GET

/api/zabbix/<uuid>/unlink/

Methods: POST

Unlink all related resources, service project link and service itself.

/api/zabbix-users/

A filter backend that uses django-filter. Supported actions and methods:

/api/zabbix-users/

Methods: GET, POST

Supported fields for creation:

  • aliasstring
  • namestring
  • surnamestring
  • typechoice('admin', 'default', 'superadmin')
  • groupslist of [{name: string, settings: link to /api/service-settings/<uuid>/}]
  • settingslink to /api/service-settings/<uuid>/
  • phone – string

Filter fields:

  • ?alias = string
  • ?surname = string
  • ?name = string
  • ?settings_uuid = UUIDFilter
  • ?settings = link

/api/zabbix-users/<uuid>/

Methods: GET, PUT, PATCH, DELETE

Supported fields for update:

  • aliasstring
  • namestring
  • surnamestring
  • typechoice('admin', 'default', 'superadmin')
  • groupslist of [{name: string, settings: link to /api/service-settings/<uuid>/}]
  • phone – string

/api/zabbix-users/<uuid>/password/

Methods: POST

/api/zabbix-user-groups/

A filter backend that uses django-filter. Supported actions and methods:

/api/zabbix-user-groups/

Methods: GET

Filter fields:

  • ?name = string
  • ?settings_uuid = UUIDFilter
  • ?settings = link

/api/zabbix-user-groups/<uuid>/

Methods: GET

/api/zabbix-triggers/

A filter backend that uses django-filter. Supported actions and methods:

/api/zabbix-triggers/

Methods: GET

Filter fields:

  • ?template_uuid = UUIDFilter
  • ?template = link
  • ?name = string
  • ?settings_uuid = UUIDFilter
  • ?settings = link

/api/zabbix-triggers/<uuid>/

Methods: GET

/api/zabbix-templates/

A filter backend that uses django-filter. Supported actions and methods:

/api/zabbix-templates/

Methods: GET

Filter fields:

  • ?name = string
  • ?settings_uuid = UUIDFilter
  • ?settings = link

/api/zabbix-templates/<uuid>/

Methods: GET

/api/zabbix-itservices/

SLA filter

Allows to filter or sort resources by actual_sla Default period is current year and month.

Example query parameters for filtering list of OpenStack instances:

/api/openstack-instances/?actual_sla=90&period=2016-02

Example query parameters for sorting list of OpenStack instances:

/api/openstack-instances/?o=actual_sla&period=2016-02

Monitoring filter

Filter and order resources by monitoring item. For example, given query dictionary

{
    'monitoring__installation_state': True
}

it produces following query

{
    'monitoring_item__name': 'installation_state',
    'monitoring_item__value': True
}

Example query parameters for sorting list of OpenStack instances:

/api/openstack-instances/?o=monitoring__installation_state

Tags ordering. Filtering for complex tags.

Example:
?tag__license-os=centos7 - will filter objects with tag “license-os:centos7”.
Allow to define next parameters in view:
  • tags_filter_db_field - name of tags field in database. Default: tags.
  • tags_filter_request_field - name of tags in request. Default: tag.

In PostgreSQL NULL values come last with ascending sort order. In MySQL NULL values come first with ascending sort order. This filter provides unified sorting for both databases. Supported actions and methods:

/api/zabbix-itservices/

Methods: GET, POST

Supported fields for creation:

  • namestring
  • description – string
  • service_project_linklink to /api/zabbix-service-project-link/<pk>/
  • hostlink to /api/zabbix-hosts/<uuid>/
  • algorithmchoice('do not calculate', 'problem, if all children have problems', 'problem, if at least one child has a problem')
  • sort_order – integer
  • agreed_sla – float
  • triggerlink to /api/zabbix-triggers/<uuid>/
  • is_main – boolean (Main IT service SLA will be added to hosts resource as monitoring item.)

/api/zabbix-itservices/<uuid>/

Methods: GET, PUT, PATCH, DELETE

Supported fields for update:

  • namestring
  • description – string
  • hostlink to /api/zabbix-hosts/<uuid>/
  • algorithmchoice('do not calculate', 'problem, if all children have problems', 'problem, if at least one child has a problem')
  • sort_order – integer
  • agreed_sla – float
  • triggerlink to /api/zabbix-triggers/<uuid>/
  • is_main – boolean (Main IT service SLA will be added to hosts resource as monitoring item.)

/api/zabbix-itservices/<uuid>/events/

Methods: GET

/api/zabbix-hosts/

Representation of Zabbix hosts and related actions.

SLA filter

Allows to filter or sort resources by actual_sla Default period is current year and month.

Example query parameters for filtering list of OpenStack instances:

/api/openstack-instances/?actual_sla=90&period=2016-02

Example query parameters for sorting list of OpenStack instances:

/api/openstack-instances/?o=actual_sla&period=2016-02

Monitoring filter

Filter and order resources by monitoring item. For example, given query dictionary

{
    'monitoring__installation_state': True
}

it produces following query

{
    'monitoring_item__name': 'installation_state',
    'monitoring_item__value': True
}

Example query parameters for sorting list of OpenStack instances:

/api/openstack-instances/?o=monitoring__installation_state

Tags ordering. Filtering for complex tags.

Example:
?tag__license-os=centos7 - will filter objects with tag “license-os:centos7”.
Allow to define next parameters in view:
  • tags_filter_db_field - name of tags field in database. Default: tags.
  • tags_filter_request_field - name of tags in request. Default: tag.

In PostgreSQL NULL values come last with ascending sort order. In MySQL NULL values come first with ascending sort order. This filter provides unified sorting for both databases.

Supported actions and methods:

/api/zabbix-hosts/

Methods: GET, POST

Supported fields for creation:

  • namestring
  • description – string
  • service_project_linklink to /api/zabbix-service-project-link/<pk>/
  • visible_name – string
  • host_group_name – string
  • scope – link to any: /api/zabbix-hosts/<uuid>/, /api/zabbix-itservices/<uuid>/
  • templates – list of [{parents: list of [link to /api/zabbix-templates/<uuid>/], children: list of [link to /api/zabbix-templates/<uuid>/], name: string, settings: link to /api/service-settings/<uuid>/}]
  • interface_ip – IP address (IP of host interface.)

Representation of Zabbix hosts and related actions.

/api/zabbix-hosts/aggregated_items_history/

Methods: GET

Representation of Zabbix hosts and related actions. Get sum of hosts historical values.

Request should specify host filtering parameters, datetime points, and items. Host filtering parameters are the same as for /api/zabbix-hosts/ endpoint. Input/output format is the same as for /api/zabbix-hosts/<host_uuid>/items_history/ endpoint.

/api/zabbix-hosts/items_aggregated_values/

Methods: GET

Representation of Zabbix hosts and related actions. Get sum of aggregated hosts values.

Request parameters:
  • ?start - start of aggregation period as timestamp. Default: 1 hour ago.
  • ?end - end of aggregation period as timestamp. Default: now.
  • ?method - aggregation method. Default: MAX. Choices: MIN, MAX.
  • ?item - item key. Can be list. Required.

Response format: {<item key>: <aggregated value>, ...}

Endpoint will return status 400 if there are no hosts or items that match request parameters.

/api/zabbix-hosts/<uuid>/

Methods: GET, POST, PUT, PATCH, DELETE

Representation of Zabbix hosts and related actions.

/api/zabbix-hosts/<uuid>/items_history/

Methods: GET

Representation of Zabbix hosts and related actions. Get host items historical values.

Request should specify datetime points and items. There are two ways to define datetime points for historical data.

  1. Send ?point=<timestamp> parameter that can list. Response will contain historical data for each given point in the same order.
  2. Send ?start=<timestamp>, ?end=<timestamp>, ?points_count=<integer> parameters. Result will contain <points_count> points from <start> to <end>.

Also you should specify one or more name of host template items, for example ‘openstack.instance.cpu_util’

Response is list of datapoints, each of which is dictionary with following fields:
  • ‘point’ - timestamp;
  • ‘value’ - values are converted from bytes to megabytes, if possible;
  • ‘item’ - key of host template item;
  • ‘item_name’ - name of host template item.

/api/zabbix-hosts/<uuid>/items_values/

Methods: GET

Representation of Zabbix hosts and related actions. The same as items_aggregated_values, only for one host