zabbix-graphql-api/schema/devices.graphql
Andreas Hilbig 5da4a17e36 feat: implement weather sensor extension and enhance device interfaces
This change introduces the Weather Sensor device type which retrieves data from public APIs, and enhances the core Host/Device interfaces to provide consistent access to inventory and items across all specialized device types. It also improves search logic and fixes several bugs identified during implementation.

- Weather Sensor Extension: Added schema and recipe for a device retrieving weather data via Zabbix HTTP agent items.

- Interface Enhancements: Added inventory and items fields to Host and Device interfaces to ensure all device specialized types have consistent access to monitoring and inventory data.

- Search Logic Improvements: Enhanced ParsedArgs to support searchByAny and technical name (host) searches when a name pattern is provided.

- Bug Fixes:

  - Fixed getLocations argument order in the Zabbix API datasource.

  - Implemented deduplication for groupids and templateids in HostImporter to prevent Zabbix duplicate value errors.

  - Added missing url field to CreateTemplateItem for HTTP Agent item support.

- Testing:

  - Extended the regression test suite with 4 new automated checks covering the fixed bugs.

  - Updated Jest tests to accommodate the improved search parameters.

- Documentation: Updated cookbook and test specifications to reflect new features and regression testing obligations.
2026-02-01 06:56:23 +01:00

147 lines
3.9 KiB
GraphQL

"""
(IoT / Edge - ) Devices are hosts having a state containing the "output" / the business data which is exposed
besides monitoring information.
"""
interface Device implements Host {
"""Internal Zabbix ID of the device."""
hostid: ID!
"""
Per convention a uuid is used as hostname to identify devices if they do not have a unique hostname.
"""
host: String!
"""Classification of the device."""
deviceType: String
"""List of host groups this device belongs to."""
hostgroups: [HostGroup!]
"""Visible name of the device."""
name: String
"""Device configuration tags."""
tags: DeviceConfig
"""Host inventory data."""
inventory: Inventory
"""List of monitored items for this host."""
items: [ZabbixItem!]
"""State of the device."""
state: DeviceState
}
"""
Configuration settings for a device.
"""
type DeviceConfig {
"""
Configuration for the device widget preview in the cockpit.
"""
deviceWidgetPreview: WidgetPreview
}
"""
Represents the configuration for a 4-field widget preview.
"""
type WidgetPreview {
"""Top-left field specification."""
TOP_LEFT: DisplayFieldSpec
"""Top-right field specification."""
TOP_RIGHT: DisplayFieldSpec
"""Bottom-left field specification."""
BOTTOM_LEFT: DisplayFieldSpec
"""Bottom-right field specification."""
BOTTOM_RIGHT: DisplayFieldSpec
}
"""
Specification for a display field in a widget.
"""
type DisplayFieldSpec {
"""Key of the data to display."""
key: String,
"""Value to display if the data is missing."""
emptyValue: String
"""Unit string to append to the value."""
unit: String,
"""Font size for the value."""
value_font_size: String
"""Optional transformation for the value."""
g_value_transform: String
"""Font size for the unit."""
unit_font_size: String
"""Optional transformation for the unit."""
g_unit_transform: String
}
"""
Operational data common to most devices.
"""
type OperationalDeviceData {
"""Device temperature."""
temperature: Float
"""Device voltage."""
voltage: Float
"""Signal strength (e.g. WiFi or GSM)."""
signalstrength: Float
"""Current location of the device."""
location: Location
"""Timestamp of the operational data."""
timestamp: DateTime
"""List of active errors or status messages."""
error: [ErrorPayload!]
}
"""
Payload for a single error or status message.
"""
type ErrorPayload {
"""Error code."""
code: Int!
"""Human-readable error message."""
message: String
"""Additional contextual information about the error."""
additionalInfo: JSONObject
}
"""
Common interface for device state.
"""
interface DeviceState {
"""Operational data (telemetry)."""
operational: OperationalDeviceData
}
"""
Generic implementation of device state using a JSON object for current values.
"""
type GenericDeviceState implements DeviceState {
"""Operational data (telemetry)."""
operational: OperationalDeviceData
"""Current business data as a generic JSON object."""
current: JSONObject
}
"""
Device represents generic IoT / Edge - devices providing their state as generic "state.current" - JSON Object.
"""
type GenericDevice implements Host & Device {
"""Internal Zabbix ID of the device."""
hostid: ID!
"""
Per convention a uuid is used as hostname to identify devices if they do not have a unique hostname.
"""
host: String!
"""Classification of the device."""
deviceType: String
"""List of host groups this device belongs to."""
hostgroups: [HostGroup!]
"""Visible name of the device."""
name: String
"""Device configuration tags."""
tags: DeviceConfig
"""Host inventory data."""
inventory: Inventory
"""List of monitored items for this host."""
items: [ZabbixItem!]
"""State of the generic device."""
state: GenericDeviceState
}