chore: Move schema directory away from src; Migrate extensions to schema directory, update Dockerfile and configuration paths
This commit is contained in:
parent
c6314fbda0
commit
70e64448e5
14 changed files with 90 additions and 46 deletions
110
schema/api_commons.graphql
Normal file
110
schema/api_commons.graphql
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
########################################################
|
||||
# Request/response
|
||||
########################################################
|
||||
|
||||
type GenericResponse {
|
||||
result: [JSONObject!]
|
||||
error: ApiError
|
||||
}
|
||||
|
||||
type ApiError implements Error {
|
||||
code: Int
|
||||
message: String
|
||||
data: JSONObject
|
||||
path: String
|
||||
args: JSONObject
|
||||
}
|
||||
|
||||
interface Error {
|
||||
code: Int
|
||||
message: String
|
||||
data: JSONObject
|
||||
}
|
||||
|
||||
|
||||
########################################################
|
||||
# User permissions
|
||||
########################################################
|
||||
|
||||
input PermissionRequest {
|
||||
permission: Permission!,
|
||||
"""
|
||||
objectName maps to name / path suffix of the template group representing the permission in Zabbix:
|
||||
Permissions/{objectName}
|
||||
"""
|
||||
objectName: String!
|
||||
}
|
||||
|
||||
"""
|
||||
READ, READ_WRITE or DENY:
|
||||
describes the rights related to an objectName
|
||||
There is no EXECUTE or anything else in Zabbix,
|
||||
i.e. objectName - Tree has to be designed accordingly in order to represent the perform actions.
|
||||
|
||||
E.g.
|
||||
|
||||
Let's assume a button called "button1", used in application "app1", having a label which shows "do something". Instead of model the action "do something" the idea is
|
||||
to model the effect of this action - do something will result in a status change. Let's further assume that the button will only
|
||||
be displayed if the user is allowed to see the current status.
|
||||
|
||||
Permissions/app1/button1/status
|
||||
|
||||
The following PermissionRequests would be used by the frontend:
|
||||
|
||||
1. Should the button (and its status) be displayed at all?
|
||||
button1.displayed = hasPermissions(
|
||||
{
|
||||
objectName: "app1/button1/status"
|
||||
permission: READ
|
||||
})
|
||||
2. Should the user be able to press the button (enabled)?
|
||||
button1.displayed = hasPermissions(
|
||||
{
|
||||
objectName: "app1/button1/status"
|
||||
permission: READ_WRITE
|
||||
})
|
||||
|
||||
|
||||
Usage Example for this pattern: Activation/Deactivation of a control program - the button
|
||||
shows the possible action. If the program is active it shows "Deactivate". If the program is inactive it shows "Activate".
|
||||
From this label the user learns something about the current state - therefore the status - read - permission is needed in order
|
||||
to display the button at all. The status write permission is needed in order to enable the button (i.e. allow the user to press it).
|
||||
in order to model the permissions to press / see a button "button1" belonging to application "app1"
|
||||
the following template group could be modelled in Zabbix
|
||||
"""
|
||||
enum Permission {
|
||||
"""
|
||||
DENY superseeds anything else - i.e. if in Zabbix there is a DENY and READ at the same time the result will be DENY
|
||||
"""
|
||||
DENY
|
||||
"""
|
||||
READ superseeds READ_WRITE - i.e. if in Zabbix there is a READ_WRITE and READ at the same time the resulting permission
|
||||
level will be READ
|
||||
"""
|
||||
READ
|
||||
"""
|
||||
READ_WRITE implies the READ permission. Do not set both READ and READ_WRITE at the same time if you want to achieve
|
||||
READ + WRITE permission, because in this case READ will superseed the READ_WRITE and the resulting permission level will be READ
|
||||
"""
|
||||
READ_WRITE
|
||||
}
|
||||
|
||||
type UserPermission {
|
||||
permission: Permission!,
|
||||
"""
|
||||
objectName maps to name / path suffix of the template group representing the permission in Zabbix:
|
||||
Permissions/{objectName}
|
||||
"""
|
||||
objectName: String!
|
||||
}
|
||||
|
||||
|
||||
############################################################################
|
||||
# General purpose types + enums
|
||||
############################################################################
|
||||
enum SortOrder {
|
||||
"Deliver values in ascending order"
|
||||
asc
|
||||
"Deliver values in descending order"
|
||||
desc
|
||||
}
|
||||
49
schema/device_value_commons.graphql
Normal file
49
schema/device_value_commons.graphql
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
"""
|
||||
Represents a message containing information about a specific device and its associated data value.
|
||||
The interface is designed to be extended by other types that define more structured or specialized types
|
||||
of device value messages.
|
||||
"""
|
||||
interface DeviceValueMessage {
|
||||
"""
|
||||
A unique identifier used to distinguish a specific device within the system.
|
||||
This field is commonly used to associate messages, configurations, or data values
|
||||
with a particular device.
|
||||
"""
|
||||
deviceKey: String
|
||||
|
||||
"""
|
||||
Represents the timestamp at which a specific event, message, or data point was created or recorded.
|
||||
The format should align with standard expectations (e.g., ISO 8601).
|
||||
"""
|
||||
timestamp: String
|
||||
|
||||
"""
|
||||
Represents the name assigned to a set of values that are submitted together with a single timestamp.
|
||||
This name is associated with a well-defined data structure.
|
||||
"""
|
||||
attributeName: String
|
||||
|
||||
"""
|
||||
Represents the name of the sub-topic to which the attribute is submitted.
|
||||
Classification or grouping of data within a broader topic structure.
|
||||
"""
|
||||
topicName: String
|
||||
|
||||
"""
|
||||
Specifies the type or category of the device. Used to define the classification
|
||||
of a device in the system (capabilities, functionalities, or purpose).
|
||||
"""
|
||||
deviceType: String
|
||||
|
||||
"""
|
||||
Retrieves the value associated with the current instance of the object.
|
||||
"""
|
||||
value: DeviceValue
|
||||
}
|
||||
|
||||
"""
|
||||
Marker-interface for device-related data values.
|
||||
"""
|
||||
interface DeviceValue {
|
||||
_empty: String
|
||||
}
|
||||
58
schema/devices.graphql
Normal file
58
schema/devices.graphql
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
"""
|
||||
(IoT / Edge - ) Devices are hosts having a state containing the "output" / the business data which is exposed
|
||||
besides monitoring information.
|
||||
"""
|
||||
interface Device implements Host {
|
||||
hostid: ID!
|
||||
"""
|
||||
Per convention a uuid is used as hostname to identify devices if they do not have a unique hostname
|
||||
"""
|
||||
host: String!
|
||||
deviceType: String
|
||||
hostgroups: [HostGroup!]
|
||||
name: String
|
||||
tags: JSONObject
|
||||
state: DeviceState
|
||||
}
|
||||
type OperationalDeviceData {
|
||||
temperature: Float
|
||||
voltage: Float
|
||||
signalstrength: Float
|
||||
location: Location
|
||||
timestamp: DateTime
|
||||
error: [ErrorPayload!]
|
||||
}
|
||||
|
||||
type ErrorPayload {
|
||||
code: Int!
|
||||
message: String
|
||||
additionalInfo: JSONObject
|
||||
}
|
||||
|
||||
interface DeviceState {
|
||||
operational: OperationalDeviceData
|
||||
}
|
||||
|
||||
# Generic IoT devices with "generic" current state - mapping all "values"
|
||||
type GenericDeviceState implements DeviceState {
|
||||
operational: OperationalDeviceData
|
||||
current: JSONObject
|
||||
}
|
||||
|
||||
|
||||
"""
|
||||
Device represents generic IoT / Edge - devices providing their state as generic "state.current" - JSON Object
|
||||
"""
|
||||
type GenericDevice implements Host & Device {
|
||||
hostid: ID!
|
||||
"""
|
||||
Per convention a uuid is used as hostname to identify devices if they do not have a unique hostname
|
||||
"""
|
||||
host: String!
|
||||
deviceType: String
|
||||
hostgroups: [HostGroup!]
|
||||
name: String
|
||||
tags: JSONObject
|
||||
state: GenericDeviceState
|
||||
}
|
||||
74
schema/extensions/display_devices.graphql
Normal file
74
schema/extensions/display_devices.graphql
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
"""
|
||||
SinglePanelDevice represents a device which can display a single picture, e.g. using LED technology.
|
||||
The picture is represented either by a displaySign (a numeric value e.g. the index of the picture)
|
||||
or a contentKey, which is usually the hash of the bitmap which shall be displayed.
|
||||
"""
|
||||
type SinglePanelDevice implements Host & Device {
|
||||
hostid: ID!
|
||||
"""
|
||||
Per convention a uuid is used as hostname to identify devices if they do not have a unique hostname
|
||||
"""
|
||||
host: String!
|
||||
deviceType: String
|
||||
hostgroups: [HostGroup!]
|
||||
name: String
|
||||
tags: JSONObject
|
||||
state: PanelState
|
||||
}
|
||||
|
||||
type PanelState implements DeviceState {
|
||||
operational: OperationalDeviceData
|
||||
current: PanelCurrentState
|
||||
}
|
||||
|
||||
type PanelCurrentState {
|
||||
values: PanelValues
|
||||
}
|
||||
|
||||
type PanelValues {
|
||||
"""
|
||||
Index of the bitmap which is displayed
|
||||
"""
|
||||
contentIndex: Int
|
||||
"""
|
||||
Hash of the bitmap which is displayed
|
||||
"""
|
||||
contentKey: String
|
||||
"""
|
||||
Text representation of what is displayed
|
||||
"""
|
||||
contentText: String
|
||||
}
|
||||
|
||||
"""
|
||||
The FourPanelDevice is a panel which allows to define pictures in 4
|
||||
subpanels, called TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT
|
||||
"""
|
||||
type FourPanelDevice implements Host & Device {
|
||||
hostid: ID!
|
||||
"""
|
||||
Per convention a uuid is used as hostname to identify devices if they do not have a unique hostname
|
||||
"""
|
||||
host: String!
|
||||
deviceType: String
|
||||
hostgroups: [HostGroup!]
|
||||
name: String
|
||||
tags: JSONObject
|
||||
state: FourPanelState
|
||||
}
|
||||
|
||||
type FourPanelState implements DeviceState {
|
||||
operational: OperationalDeviceData
|
||||
current: FourPanelCurrentState
|
||||
}
|
||||
|
||||
type FourPanelCurrentState {
|
||||
values: FourPanelValues
|
||||
}
|
||||
|
||||
type FourPanelValues {
|
||||
TOP_LEFT: PanelValues
|
||||
TOP_RIGHT: PanelValues
|
||||
BOTTOM_LEFT: PanelValues
|
||||
BOTTOM_RIGHT: PanelValues
|
||||
}
|
||||
60
schema/extensions/location_tracker_commons.graphql
Normal file
60
schema/extensions/location_tracker_commons.graphql
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
|
||||
|
||||
"""
|
||||
Represents the payload for a sensor distance measurement.
|
||||
"""
|
||||
type SensorDistanceValue implements DeviceValue {
|
||||
"""
|
||||
Represents the name of the device that reports or provides distance sensor data.
|
||||
Uniquely identifies the device within the context of the SensorDistanceValue.
|
||||
"""
|
||||
deviceName: String
|
||||
|
||||
"""
|
||||
Represents the MAC address of the device. Typically formatted as a 12-character
|
||||
hexadecimal string (e.g., "00:1A:2B:3C:4D:5E").
|
||||
"""
|
||||
mac: String
|
||||
|
||||
"""
|
||||
Represents the measured or calculated distance value, typically in meters.
|
||||
Should be non-negative.
|
||||
"""
|
||||
distance: Float
|
||||
|
||||
"""
|
||||
Represents the time at which the sensor measurement was recorded.
|
||||
"""
|
||||
time: String
|
||||
|
||||
_empty: String
|
||||
}
|
||||
|
||||
"""
|
||||
Represents a coordinate in 3D space with x, y, and z components.
|
||||
"""
|
||||
type Position {
|
||||
x: Float
|
||||
y: Float
|
||||
z: Float
|
||||
}
|
||||
|
||||
"""
|
||||
Represents the result of a position calculation, including the calculated position and accuracy.
|
||||
"""
|
||||
type PositionCalculatorResult {
|
||||
position: Position
|
||||
accuracy: Float
|
||||
}
|
||||
|
||||
"""
|
||||
Concrete implementation of a DeviceValueMessage for sensor distance data.
|
||||
"""
|
||||
type SensorDistanceMessage implements DeviceValueMessage {
|
||||
deviceKey: String
|
||||
timestamp: String
|
||||
attributeName: String
|
||||
topicName: String
|
||||
deviceType: String
|
||||
value: SensorDistanceValue
|
||||
}
|
||||
45
schema/extensions/location_tracker_devices.graphql
Normal file
45
schema/extensions/location_tracker_devices.graphql
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
"""
|
||||
DistanceTracker represents a device which can detect other devices around itself and estimate
|
||||
the distances, e.g. by using Bluetooth scanning technology and estimating the distance by .
|
||||
Optionally the
|
||||
"""
|
||||
type DistanceTrackerDevice implements Host & Device {
|
||||
hostid: ID!
|
||||
"""
|
||||
Per convention a uuid is used as hostname to identify devices if they do not have a unique hostname
|
||||
"""
|
||||
host: String!
|
||||
deviceType: String
|
||||
hostgroups: [HostGroup!]
|
||||
name: String
|
||||
tags: JSONObject
|
||||
state: DistanceTrackerState
|
||||
}
|
||||
|
||||
type DistanceTrackerState implements DeviceState {
|
||||
operational: OperationalDeviceData
|
||||
current: DistanceTrackerValues
|
||||
}
|
||||
|
||||
"""
|
||||
Aggregated information of devices detected around the tracker
|
||||
"""
|
||||
type DistanceTrackerValues {
|
||||
"""
|
||||
Start of time interval for the delivered device counting value
|
||||
"""
|
||||
timeFrom: Time
|
||||
"""
|
||||
End of time interval for the delivered device counting value
|
||||
"""
|
||||
timeUntil: Time
|
||||
|
||||
"""
|
||||
Number of unique deviceKeys detected between timeFrom and timeUnti
|
||||
"""
|
||||
count: Int
|
||||
"""
|
||||
Detailed information about devices detected nearby
|
||||
"""
|
||||
distances: [SensorDistanceValue!]
|
||||
}
|
||||
171
schema/mutations.graphql
Normal file
171
schema/mutations.graphql
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
type Mutation {
|
||||
|
||||
"""
|
||||
Authentication: By zbx_session - cookie or zabbix-auth-token - header
|
||||
"""
|
||||
createHost(host: String!, hostgroupids:[Int!]!, templateids: [Int!]!,
|
||||
location: LocationInput): CreateHostResponse
|
||||
|
||||
"""
|
||||
(Mass) Import zabbix groups
|
||||
and assign them to the corresponding hosts by groupid or groupName.
|
||||
|
||||
Return value: If no error occurs a groupid be returned for each created group,
|
||||
otherwise the return object will contain an error message
|
||||
|
||||
Authentication: By zbx_session - cookie or zabbix-auth-token - header
|
||||
"""
|
||||
importHostGroups(hostGroups: [CreateHostGroup!]!):[CreateHostGroupResponse!]
|
||||
|
||||
|
||||
"""
|
||||
(Mass) Import hosts and assign them to host groups by groupid or groupName.
|
||||
|
||||
Return value: If no error occurs a hostid will be returned for each created host,
|
||||
otherwise the return object will contain an error message.
|
||||
|
||||
Authentication: By zbx_session - cookie or zabbix-auth-token - header
|
||||
"""
|
||||
importHosts(hosts: [CreateHost!]!):[ImportHostResponse!]
|
||||
|
||||
importUserRights(input: UserRightsInput!, dryRun: Boolean! = true): ImportUserRightsResult
|
||||
}
|
||||
|
||||
####################################################################
|
||||
# Input types used for importXXX - and storeXXX - Mutations
|
||||
####################################################################
|
||||
|
||||
input CreateHostGroup {
|
||||
"""
|
||||
Name of the host group
|
||||
"""
|
||||
groupName: String!
|
||||
"""
|
||||
Internally used unique id
|
||||
(will be assigned by Zabbix if empty)
|
||||
"""
|
||||
uuid: String
|
||||
}
|
||||
type ImportHostResponse {
|
||||
deviceKey: String!
|
||||
hostid: String
|
||||
message: String
|
||||
error: ApiError
|
||||
}
|
||||
|
||||
|
||||
type CreateHostGroupResponse {
|
||||
groupName: String!
|
||||
groupid: Int
|
||||
message: String
|
||||
error: ApiError
|
||||
}
|
||||
|
||||
input CreateHost {
|
||||
deviceKey: String!
|
||||
"""
|
||||
Optional display name of the device (must be unique if provided - default is to set display name to deviceKey)
|
||||
"""
|
||||
name: String
|
||||
deviceType: String!
|
||||
"""
|
||||
groupNames is used to assign the created object
|
||||
to a host group. It is mandatory but
|
||||
can also be blank. This is usefull in case of
|
||||
passing a groupid instead which is
|
||||
the zabbix internal key for storing the group.
|
||||
If a groupid is provided the passed groupName is ignored
|
||||
"""
|
||||
groupNames: [String!]!
|
||||
"""
|
||||
Optionally the internal groupids can be passed - in this case the
|
||||
groupName is ignored
|
||||
"""
|
||||
groupids: [Int]
|
||||
location: LocationInput
|
||||
}
|
||||
|
||||
type CreateHostResponse {
|
||||
hostids: [Int]
|
||||
itemids: [Int]
|
||||
error: ApiError
|
||||
}
|
||||
input LocationInput {
|
||||
name: String
|
||||
location_lat: String
|
||||
location_lon: String
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Permission related input
|
||||
#######################################
|
||||
input UserRightsInput {
|
||||
userRoles: [UserRoleInput!]
|
||||
userGroups: [UserGroupInput!]
|
||||
}
|
||||
|
||||
input UserRoleInput {
|
||||
name: String
|
||||
type: Int
|
||||
readonly: Int
|
||||
rules: UserRoleRulesInput
|
||||
}
|
||||
|
||||
input UserRoleRulesInput {
|
||||
ui: [UserRoleRuleInput!]
|
||||
ui_default_access: Int
|
||||
modules:[UserRoleModuleInput!]
|
||||
modules_default_access: Int
|
||||
api_access: Int
|
||||
api_mode: Int
|
||||
api: [String!]
|
||||
actions: [UserRoleRuleInput!]
|
||||
actions_default_access: Int
|
||||
}
|
||||
|
||||
input UserRoleRuleInput {
|
||||
name: String
|
||||
status: Int
|
||||
}
|
||||
input UserRoleModuleInput {
|
||||
moduleid: String
|
||||
status: Int
|
||||
id: String
|
||||
}
|
||||
|
||||
input UserGroupInput {
|
||||
name: String!
|
||||
gui_access: Int
|
||||
users_status: Int
|
||||
hostgroup_rights: [ZabbixGroupRightInput!]
|
||||
templategroup_rights: [ZabbixGroupRightInput!]
|
||||
}
|
||||
|
||||
|
||||
input ZabbixGroupRightInput {
|
||||
uuid: String
|
||||
"""
|
||||
name may optionally be specified for documentation purpose,
|
||||
but the master for setting the user right is the uuid.
|
||||
If a uuid is found and the corresponding group
|
||||
has a deviating name this will be documented within a message
|
||||
with errorcode = 0 (OK) but the permission will be set (
|
||||
the reason is that names for groups may deviate between several
|
||||
instances of the control center although the semantic is the same -
|
||||
while the semantic is identified by uuid.
|
||||
"""
|
||||
name: String
|
||||
permission: Permission
|
||||
}
|
||||
|
||||
type ImportUserRightsResult {
|
||||
userRoles: [ImportUserRightResult!]
|
||||
userGroups: [ImportUserRightResult!]
|
||||
}
|
||||
type ImportUserRightResult {
|
||||
id: String
|
||||
name: String
|
||||
message: String
|
||||
errors: [ApiError!]
|
||||
}
|
||||
|
||||
107
schema/queries.graphql
Normal file
107
schema/queries.graphql
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
# Scalars resolved by package "graphql-scalars"
|
||||
scalar DateTime
|
||||
scalar Time
|
||||
scalar JSONObject
|
||||
|
||||
type Query {
|
||||
"Get api (build) version"
|
||||
apiVersion: String!
|
||||
"Get zabbix version"
|
||||
zabbixVersion: String
|
||||
"""
|
||||
Login to zabbix - provided for debugging and testing purpose. The result of the login operation is
|
||||
authentication token returned may be passed as
|
||||
header 'zabbix-auth-token' for authenticating future API requests.
|
||||
As an alternative to the cookie 'zbx_session' may be set which is automatically set after login to
|
||||
the cockpit - this is the standard way to authenticate api calls initiated by the cockpit frontend
|
||||
because the frontend is always embedded into the Zabbix portal which is only accessible after logging in and
|
||||
obtainind the zbx_session - cookie.
|
||||
"""
|
||||
login(username: String!, password: String!): String
|
||||
|
||||
"""
|
||||
Logout from zabbix - provided for debugging and testing purpose. This invalidates the token received by the login
|
||||
operation. Returns true on success
|
||||
"""
|
||||
logout: Boolean
|
||||
|
||||
"""
|
||||
Get all hosts + corresponding items. If with_items==true only hosts with attached items are delivered
|
||||
name_pattern: If provided this will perform a LIKE "%…%" search on the name attribute within the database.
|
||||
|
||||
Authentication: By zbx_session - cookie or zabbix-auth-token - header
|
||||
"""
|
||||
allHosts(name_pattern: String = "", filter_host: String = null, hostids: Int,
|
||||
groupids:[Int!] = null, with_items: Boolean = false, tag_deviceType:[String]=[], tag_hostType:[String!]): [Host]
|
||||
|
||||
"""
|
||||
Get all host groups.
|
||||
If with_hosts==true only groups with attached hosts are delivered.
|
||||
|
||||
Authentication: By zbx_session - cookie or zabbix-auth-token - header
|
||||
"""
|
||||
allHostGroups(search_name: String, with_hosts: Boolean = true): [HostGroup]
|
||||
|
||||
|
||||
"""
|
||||
Get all locations used by hosts.
|
||||
distinct_by_name=true means that the result is filtered for distinct names (default)
|
||||
name_pattern: If provided this will perform a Regex search on the name attribute within the database.
|
||||
|
||||
Authentication: By zbx_session - cookie or zabbix-auth-token - header
|
||||
"""
|
||||
locations(name_pattern: String = "", distinct_by_name: Boolean = true, templateids:[String] = null): [Location]
|
||||
|
||||
"""
|
||||
Export history from Zabbix items
|
||||
|
||||
Authentication: By zbx_session - cookie or zabbix-auth-token - header
|
||||
"""
|
||||
exportHostValueHistory(
|
||||
"(Optional) list of hostnames to be included in the result"
|
||||
host_filter: [String!],
|
||||
"(Optional) list of item keys to be included in the result"
|
||||
itemKey_filter: [String!],
|
||||
"""
|
||||
(Optional) timestamp of earliest value"""
|
||||
time_from: DateTime,
|
||||
"""(Optional) timestamp of last value """
|
||||
time_until: DateTime,
|
||||
"""Results are sorted by timestamps - ascending or descending order may be specified
|
||||
using this parameter"""
|
||||
sortOrder: SortOrder=desc,
|
||||
"""
|
||||
Maximum number of records to be delivered. Hint: This might be useful, because the
|
||||
current version of Zabbix delivers a 500 - error in case of requesting too much data
|
||||
"""
|
||||
limit: Int
|
||||
"""
|
||||
As values are stored in different data structures depending on their type
|
||||
the type information must be specified in advance, although
|
||||
each value (also if number) is converted into a string afterwards
|
||||
"""
|
||||
type: StorageItemType = FLOAT
|
||||
|
||||
):GenericResponse
|
||||
|
||||
"""
|
||||
Return all user permissions. If objectNames is provided return only the permissions related to the objects within
|
||||
the objectNames - list
|
||||
"""
|
||||
userPermissions(objectNames: [String!]): [UserPermission!]
|
||||
|
||||
"""
|
||||
Return true if and only if the current user (identified by token / cookie)
|
||||
has all requested permissions (minimum - if READ is requested and the user has READ_WRITE
|
||||
the response will be true)
|
||||
"""
|
||||
hasPermissions(permissions: [PermissionRequest!]!): Boolean
|
||||
|
||||
|
||||
"""
|
||||
name_pattern: If provided this will perform a LIKE "%…%" search on the name attribute within the database.
|
||||
exclude_groups_pattern: Regex allowing to exclude all matching hostgroups from group permissions
|
||||
"""
|
||||
exportUserRights(name_pattern: String = "" exclude_hostgroups_pattern: String = ""): UserRights
|
||||
}
|
||||
|
||||
165
schema/zabbix.graphql
Normal file
165
schema/zabbix.graphql
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
###################################
|
||||
# Hosts, items + groups, templates
|
||||
###################################
|
||||
|
||||
type HostGroup {
|
||||
groupid: ID!
|
||||
name: String
|
||||
}
|
||||
|
||||
interface Host {
|
||||
hostid: ID!
|
||||
"""
|
||||
The host field contains the "hostname" in Zabbix
|
||||
"""
|
||||
host: String!
|
||||
hostgroups: [HostGroup!]
|
||||
name: String
|
||||
tags: JSONObject
|
||||
"""
|
||||
Specifies the type or category of the device. Used to define the classification
|
||||
of a device in the system (capabilities, functionalities, or purpose).
|
||||
"""
|
||||
deviceType: String
|
||||
}
|
||||
|
||||
type ZabbixItem {
|
||||
itemid: Int!
|
||||
name: String!
|
||||
key_: String!
|
||||
hostid: Int
|
||||
lastclock: Int
|
||||
lastvalue: String
|
||||
value_type: Int!
|
||||
attributeName: String
|
||||
status: DeviceStatus
|
||||
type: DeviceCommunicationType
|
||||
hosts: [Host!]
|
||||
}
|
||||
|
||||
enum DeviceCommunicationType {
|
||||
ZABBIX_AGENT
|
||||
ZABBIX_AGENT_ACTIVE
|
||||
ZABBIX_TRAP
|
||||
ZABBIX_INTERNAL_ITEM
|
||||
SIMPLE_CHECK
|
||||
DEPENDANT_ITEM
|
||||
SIMULATOR_CALCULATED
|
||||
SIMULATOR_JAVASCRIPT
|
||||
HTTP_AGENT
|
||||
IPMI_AGENT
|
||||
JMX_AGENT
|
||||
SNMP_AGENT
|
||||
SNMP_TRAP
|
||||
DATABASE_MONITOR
|
||||
}
|
||||
|
||||
type ZabbixHost implements Host {
|
||||
hostid: ID!
|
||||
host: String!
|
||||
hostgroups: [HostGroup!]
|
||||
name: String
|
||||
tags: JSONObject
|
||||
|
||||
"""
|
||||
Specifies the type or category of the device. Used to define the classification
|
||||
of a device in the system (capabilities, functionalities, or purpose).
|
||||
"""
|
||||
deviceType: String
|
||||
|
||||
items: [ZabbixItem!]
|
||||
inventory: Inventory
|
||||
parentTemplates: [Template!]
|
||||
}
|
||||
|
||||
|
||||
type Template {
|
||||
templateid: String!
|
||||
name: String
|
||||
}
|
||||
|
||||
type Inventory {
|
||||
location: Location
|
||||
}
|
||||
|
||||
"""
|
||||
Hint: WGS84[dd.ddddd] coordinates are used
|
||||
"""
|
||||
interface GpsPosition {
|
||||
latitude: Float
|
||||
longitude: Float
|
||||
}
|
||||
type Location implements GpsPosition {
|
||||
name: String
|
||||
latitude: Float
|
||||
longitude: Float
|
||||
}
|
||||
|
||||
enum DeviceStatus {
|
||||
ENABLED
|
||||
DISABLED
|
||||
}
|
||||
|
||||
########################################################
|
||||
# History / Values
|
||||
########################################################
|
||||
|
||||
enum StorageItemType {
|
||||
FLOAT
|
||||
INT
|
||||
TEXT
|
||||
}
|
||||
############################
|
||||
# Permissions
|
||||
############################
|
||||
type UserRights {
|
||||
userGroups: [UserGroup!]
|
||||
userRoles: [UserRole!]
|
||||
}
|
||||
|
||||
type UserRole {
|
||||
roleid: Int!
|
||||
name: String
|
||||
type: Int
|
||||
readonly: Int
|
||||
rules: UserRoleRules
|
||||
}
|
||||
|
||||
type UserRoleRules {
|
||||
ui: [UserRoleRule!]
|
||||
ui_default_access: Int
|
||||
modules:[UserRoleModule!]
|
||||
modules_default_access: Int
|
||||
api_access: Int
|
||||
api_mode: Int
|
||||
api: [String!]
|
||||
actions: [UserRoleRule!]
|
||||
actions_default_access: Int
|
||||
}
|
||||
|
||||
type UserRoleRule {
|
||||
name: String
|
||||
status: Int
|
||||
}
|
||||
type UserRoleModule {
|
||||
moduleid: String
|
||||
status: Int
|
||||
id: String
|
||||
relative_path: String
|
||||
}
|
||||
|
||||
type UserGroup {
|
||||
usrgrpid: Int!
|
||||
name: String!
|
||||
gui_access: Int
|
||||
users_status: Int
|
||||
hostgroup_rights: [ZabbixGroupRight!]
|
||||
templategroup_rights: [ZabbixGroupRight!]
|
||||
}
|
||||
|
||||
type ZabbixGroupRight {
|
||||
id: Int!
|
||||
uuid: String
|
||||
name: String
|
||||
permission: Permission
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue