- Implement query optimization (reduced output, parameter skipping) to minimize Zabbix API traffic. - Add indirect dependency handling: deviceType implies tags and state implies items. - Move schema extensions to samples/extensions/ to clarify their role as samples. - Enhance DistanceTrackerDevice with String time fields to support optional date portions. - Ensure allDevices strictly filters by deviceType and populates the field in results. - Refactor runAllRegressionTests mutation to use internal unique names and improve stability. - Fix unnecessary Zabbix API calls for item preprocessing during template and host imports. - Update documentation including cookbook recipes, test specifications, and optimization guides. - Add extensive unit, integration, and regression tests covering all implemented changes. - Update docker-compose.yml to mount the samples/ directory as a volume. - Update IntelliJ .idea run configurations to reflect the new sample extension paths.
118 lines
3.2 KiB
GraphQL
118 lines
3.2 KiB
GraphQL
### Query
|
|
This query demonstrates how to retrieve data from multiple sources, including specialized device types like `DistanceTrackerDevice`.
|
|
|
|
> **Precondition**: This query will only work if the GraphQL schema has been extended with the `DistanceTrackerDevice` type (see the sample in `samples/extensions/location_tracker_devices.graphql`).
|
|
|
|
```graphql
|
|
query DistanceTrackerDeviceTest {
|
|
apiVersion
|
|
zabbixVersion
|
|
allHostGroups(search_name: "Roadwork/Devices/*") {
|
|
groupid
|
|
name
|
|
}
|
|
allDevices {
|
|
deviceType
|
|
host
|
|
name
|
|
... on DistanceTrackerDevice {
|
|
state {
|
|
current {
|
|
count
|
|
timeFrom
|
|
timeUntil
|
|
}
|
|
}
|
|
}
|
|
}
|
|
allHosts {
|
|
hostid
|
|
host
|
|
name
|
|
deviceType
|
|
... on Device {
|
|
tags {
|
|
deviceWidgetPreview {
|
|
TOP_LEFT {
|
|
key
|
|
emptyValue
|
|
unit
|
|
value_font_size
|
|
g_value_transform
|
|
unit_font_size
|
|
g_unit_transform
|
|
}
|
|
TOP_RIGHT {
|
|
key
|
|
emptyValue
|
|
unit
|
|
value_font_size
|
|
g_value_transform
|
|
unit_font_size
|
|
g_unit_transform
|
|
}
|
|
BOTTOM_LEFT {
|
|
key
|
|
emptyValue
|
|
unit
|
|
value_font_size
|
|
g_value_transform
|
|
unit_font_size
|
|
g_unit_transform
|
|
}
|
|
BOTTOM_RIGHT {
|
|
key
|
|
emptyValue
|
|
unit
|
|
value_font_size
|
|
g_value_transform
|
|
unit_font_size
|
|
g_unit_transform
|
|
}
|
|
}
|
|
}
|
|
}
|
|
... on DistanceTrackerDevice {
|
|
state {
|
|
current {
|
|
count
|
|
timeFrom
|
|
timeUntil
|
|
}
|
|
}
|
|
}
|
|
... on ZabbixHost {
|
|
items {
|
|
itemid
|
|
name
|
|
key_
|
|
hostid
|
|
lastclock
|
|
lastvalue
|
|
value_type
|
|
attributeName
|
|
status
|
|
type
|
|
}
|
|
}
|
|
... on GenericDevice {
|
|
deviceType
|
|
state {
|
|
generic: current
|
|
}
|
|
}
|
|
... on SinglePanelDevice {
|
|
deviceType
|
|
state {
|
|
current {
|
|
values {
|
|
contentIndex
|
|
contentKey
|
|
contentText
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|