UNPKG

sc-zabbix-api

Version:

TypeScript client for Zabbix JSON-RPC API with token authentication

1,298 lines (1,297 loc) 38.1 kB
export interface ZabbixApiConfig { url: string; token?: string; username?: string; password?: string; timeout?: number; retries?: number; retryDelay?: number; loginTimeout?: number; } export interface ZabbixApiResponse<T> { jsonrpc: string; result: T; id: number; } export interface ZabbixApiError { jsonrpc: string; error: { code: number; message: string; data: string; }; id: number; } export interface ZabbixConnectionError extends Error { code?: string; type: "TIMEOUT" | "CONNECTION_REFUSED" | "NETWORK_ERROR" | "AUTH_ERROR" | "UNKNOWN"; originalError?: any; retryAttempt?: number; } export interface UserLoginParams { username?: string; password?: string; userData?: boolean; } export interface UserLoginResponseObject { sessionid: string; userid?: string; username?: string; name?: string; surname?: string; url?: string; autologin?: string; autologout?: string; lang?: string; refresh?: string; theme?: string; attempt_failed?: string; attempt_ip?: string; attempt_clock?: string; rows_per_page?: string; timezone?: string; roleid?: string; userdirectoryid?: string; ts_provisioned?: string; } export type UserLoginResponse = string | UserLoginResponseObject; export interface UserCheckAuthenticationParams { sessionid?: string; token?: string; extend?: boolean; } export interface UserCheckAuthenticationResponse { userid: string; username?: string; name?: string; surname?: string; url?: string; autologin?: string; autologout?: string; lang?: string; refresh?: string; theme?: string; attempt_failed?: string; attempt_ip?: string; attempt_clock?: string; rows_per_page?: string; timezone?: string; roleid?: string; userdirectoryid?: string; ts_provisioned?: string; } type HostGetParamsOutput = "hostid" | "proxy_hostid" | "host" | "status" | "lastaccess" | "ipmi_authtype" | "ipmi_privilege" | "ipmi_username" | "ipmi_password" | "maintenanceid" | "maintenance_status" | "maintenance_type" | "maintenance_from" | "name" | "flags" | "templateid" | "description" | "tls_connect" | "tls_accept" | "tls_issuer" | "tls_subject" | "proxy_address" | "auto_compress" | "custom_interfaces" | "uuid" | "inventory_mode"; export interface HostGetParams { output?: HostGetParamsOutput[]; filter?: { hostid?: string[]; host?: string[]; status?: number[]; flags?: number[]; name?: string[]; monitored_by?: number[]; proxyid?: string[]; proxy_groupid?: string[]; }; search?: { host?: string; name?: string; description?: string; }; selectInterfaces?: ("interfaceid" | "hostid" | "main" | "type" | "useip" | "ip" | "dns" | "port" | "available" | "error" | "errors_from" | "disable_until" | "details")[]; selectGroups?: string | string[]; selectTags?: string | string[]; selectMacros?: string | string[]; selectInventory?: string | string[]; sortfield?: string[]; sortorder?: string; limit?: number; } /** * Zabbix Host Object * @see https://www.zabbix.com/documentation/current/en/manual/api/reference/host/object */ export interface Host { /** * ID of the host. * Property behavior: read-only, required for update operations */ hostid: string; /** * Technical name of the host. * Property behavior: required for create operations */ host: string; /** * Description of the host. */ description?: string; /** * Origin of the host. * Possible values: * - 0 - a plain host * - 4 - a discovered host * Property behavior: read-only */ flags?: 0 | 4; /** * Host inventory population mode. * Possible values: * - -1 - (default) disabled * - 0 - manual * - 1 - automatic */ inventory_mode?: -1 | 0 | 1; /** * IPMI authentication algorithm. * Possible values: * - -1 - (default) default * - 0 - none * - 1 - MD2 * - 2 - MD5 * - 4 - straight * - 5 - OEM * - 6 - RMCP+ */ ipmi_authtype?: -1 | 0 | 1 | 2 | 4 | 5 | 6; /** * IPMI password. */ ipmi_password?: string; /** * IPMI privilege level. * Possible values: * - 1 - callback * - 2 - (default) user * - 3 - operator * - 4 - admin * - 5 - OEM */ ipmi_privilege?: 1 | 2 | 3 | 4 | 5; /** * IPMI username. */ ipmi_username?: string; /** * Starting time of the effective maintenance. * Property behavior: read-only */ maintenance_from?: string; /** * Effective maintenance status. * Possible values: * - 0 - (default) no maintenance * - 1 - maintenance in effect * Property behavior: read-only */ maintenance_status?: 0 | 1; /** * Effective maintenance type. * Possible values: * - 0 - (default) maintenance with data collection * - 1 - maintenance without data collection * Property behavior: read-only */ maintenance_type?: 0 | 1; /** * ID of the maintenance that is currently in effect on the host. * Property behavior: read-only */ maintenanceid?: string; /** * Visible name of the host. * Default: host property value */ name?: string; /** * Source that is used to monitor the host. * Possible values: * - 0 - (default) Zabbix server * - 1 - Proxy * - 2 - Proxy group */ monitored_by?: 0 | 1 | 2; /** * ID of the proxy that is used to monitor the host. * Property behavior: required if monitored_by is set to "Proxy" */ proxyid?: string; /** * ID of the proxy group that is used to monitor the host. * Property behavior: required if monitored_by is set to "Proxy group" */ proxy_groupid?: string; /** * Status and function of the host. * Possible values: * - 0 - (default) enabled * - 1 - disabled */ status?: 0 | 1; /** * Connections to host. * Possible values: * - 1 - (default) No encryption * - 2 - PSK * - 4 - certificate */ tls_connect?: 1 | 2 | 4; /** * Connections from host. * This is a bitmask field; any sum of possible bitmap values is acceptable * (for example, 6 for PSK and certificate). * Possible bitmap values: * - 1 - (default) No encryption * - 2 - PSK * - 4 - certificate */ tls_accept?: number; /** * Certificate issuer. */ tls_issuer?: string; /** * Certificate subject. */ tls_subject?: string; /** * PSK identity; must be paired with only one PSK (across autoregistration, hosts, and proxies). * Do not include sensitive information in the PSK identity, as it is sent unencrypted * over the network to inform the receiver which PSK to use. * Property behavior: write-only, required if tls_connect is set to "PSK", * or tls_accept contains the "PSK" bit */ tls_psk_identity?: string; /** * Pre-shared key (PSK); must be at least 32 hex digits. * Property behavior: write-only, required if tls_connect is set to "PSK", * or tls_accept contains the "PSK" bit */ tls_psk?: string; /** * Host active interface availability status. * Possible values: * - 0 - interface status is unknown * - 1 - interface is available * - 2 - interface is not available * Property behavior: read-only */ active_available?: 0 | 1 | 2; /** * ID of the proxy assigned by Zabbix server, if the host is monitored by a proxy group. * Property behavior: read-only */ assigned_proxyid?: string; /** * Host interfaces (populated when selectInterfaces is used) */ interfaces?: HostInterface[]; } /** * SNMP Interface Details * https://www.zabbix.com/documentation/current/en/manual/api/reference/hostinterface/object#host-interface-object */ export interface SNMPDetails { /** SNMP interface version: 1=SNMPv1, 2=SNMPv2c, 3=SNMPv3 (required) */ version: 1 | 2 | 3; /** Use bulk SNMP requests: 0=don't use, 1=use bulk (default: 1) */ bulk?: 0 | 1; /** SNMP community (required for SNMPv1/v2c) */ community?: string; /** Max repetition value for bulk requests (default: 10) */ max_repetitions?: number; /** SNMPv3 security name (for SNMPv3 only) */ securityname?: string; /** SNMPv3 security level: 0=noAuthNoPriv, 1=authNoPriv, 2=authPriv */ securitylevel?: 0 | 1 | 2; /** SNMPv3 authentication passphrase */ authpassphrase?: string; /** SNMPv3 privacy passphrase */ privpassphrase?: string; /** SNMPv3 auth protocol: 0=MD5, 1=SHA1, 2=SHA224, 3=SHA256, 4=SHA384, 5=SHA512 */ authprotocol?: 0 | 1 | 2 | 3 | 4 | 5; /** SNMPv3 privacy protocol: 0=DES, 1=AES128, 2=AES192, 3=AES256, 4=AES192C, 5=AES256C */ privprotocol?: 0 | 1 | 2 | 3 | 4 | 5; /** SNMPv3 context name */ contextname?: string; } /** * Host Interface Object * https://www.zabbix.com/documentation/current/en/manual/api/reference/hostinterface/object#host-interface-object */ export interface HostInterface { /** ID of the interface (read-only, required for update) */ interfaceid?: string; /** Availability: 0=unknown, 1=available, 2=unavailable (read-only) */ available?: 0 | 1 | 2; /** ID of the host (constant, required for create) */ hostid: string; /** Interface type: 1=Agent, 2=SNMP, 3=IPMI, 4=JMX (required for create) */ type: 1 | 2 | 3 | 4; /** IP address (required for create, can be empty if using DNS) */ ip: string; /** DNS name (required for create, can be empty if using IP) */ dns: string; /** Port number (required for create) */ port: string; /** Connect via IP: 0=use DNS, 1=use IP (required for create) */ useip: 0 | 1; /** Default interface: 0=not default, 1=default (required for create) */ main: 0 | 1; /** Additional details (required if type=SNMP) */ details?: SNMPDetails; /** Next polling time of unavailable interface (read-only) */ disable_until?: string; /** Error text if unavailable (read-only) */ error?: string; /** Time when interface became unavailable (read-only) */ errors_from?: string; } /** * Zabbix User Object * @see https://www.zabbix.com/documentation/current/en/manual/api/reference/user/object */ export interface User { /** * ID of the user. * Property behavior: read-only, required for update operations */ userid?: string; /** * User's name. * Property behavior: * - required for create operations * - read-only for provisioned users if the user is linked to a user directory */ username: string; /** * User's password. * The value of this parameter can be an empty string if the user is linked to a user directory. * Property behavior: write-only */ passwd?: string; /** * ID of the role of the user. * Note that users without a role can log into Zabbix only using LDAP or SAML authentication. */ roleid?: string; /** * Time of the last unsuccessful login attempt. * Property behavior: read-only */ attempt_clock?: string; /** * Recent failed login attempt count. * Property behavior: read-only */ attempt_failed?: number; /** * IP address from where the last unsuccessful login attempt came from. * Property behavior: read-only */ attempt_ip?: string; /** * Whether to enable auto-login. * Possible values: * - 0 - (default) auto-login disabled * - 1 - auto-login enabled */ autologin?: 0 | 1; /** * User session life time. Accepts seconds and time unit with suffix. * If set to 0s, the session will never expire. * Default: 15m */ autologout?: string; /** * Language code of the user's language, for example, en_US. * Default: default - system default */ lang?: string; /** * Name of the user. */ name?: string; /** * Whether the user has been provisioned. * Possible values: * - 0 - not provisioned * - 1 - provisioned * Property behavior: read-only */ provisioned?: 0 | 1; /** * Automatic refresh period. Accepts seconds or time unit with suffix (e.g., 30s, 90s, 1m, 1h). * Default: 30s */ refresh?: string; /** * Amount of object rows to show per page. * Default: 50 */ rows_per_page?: number; /** * Surname of the user. */ surname?: string; /** * User's theme. * Possible values: * - default - (default) system default * - blue-theme - Blue * - dark-theme - Dark */ theme?: "default" | "blue-theme" | "dark-theme"; /** * Time when the latest provisioning operation was made. * Property behavior: read-only, supported for Super admin type users */ ts_provisioned?: string; /** * URL of the page to redirect the user to after logging in. */ url?: string; /** * ID of the user directory that the user in linked to. * Used for provisioning (creating or updating), as well as to login a user that is linked to a user directory. * Default: 0 * Property behavior: read-only, supported for Super admin type users */ userdirectoryid?: string; /** * User's time zone, for example, Europe/London, UTC. * Default: default - system default */ timezone?: string; /** * User media objects (populated when selectMedias is used) */ medias?: Media[]; } /** * Zabbix Media Object * @see https://www.zabbix.com/documentation/current/en/manual/api/reference/user/object#media */ export interface Media { /** * ID of the user's media. * Property behavior: read-only */ mediaid?: string; /** * ID of the media type used by the user's media. * Property behavior: required */ mediatypeid: string; /** * Address, user name or other identifier of the recipient. * If type of Media type is set to "Email", values are represented as array. * For other types of Media types, value is represented as a string. * Property behavior: required */ sendto: string | string[]; /** * Whether the media is enabled. * Possible values: * - 0 - (default) enabled * - 1 - disabled */ active?: 0 | 1; /** * Trigger severities to send notifications about. * This is a bitmask field; any sum of possible bitmap values is acceptable. * Possible bitmap values: * - 1 - Not classified * - 2 - Information * - 4 - Warning * - 8 - Average * - 16 - High * - 32 - Disaster * Default: 63 */ severity?: number; /** * Time when the notifications can be sent as a time period or user macros separated by a semicolon. * Default: 1-7,00:00-24:00 */ period?: string; /** * Whether the user has been provisioned. * Possible values: * - 0 - not provisioned * - 1 - provisioned */ provisioned?: 0 | 1; /** * User directory media mapping ID for provisioned media. * Property behavior: read-only, supported for Super admin type users */ userdirectory_mediaid?: string; } /** * Item types used in Zabbix */ export declare enum ItemType { ZabbixAgent = 0, ZabbixTrapper = 2, SimpleCheck = 3, ZabbixInternal = 5, ZabbixAgentActive = 7, WebItem = 9, ExternalCheck = 10, DatabaseMonitor = 11, IPMIAgent = 12, SSHAgent = 13, TelnetAgent = 14, Calculated = 15, JMXAgent = 16, SNMPTrap = 17, DependentItem = 18, HTTPAgent = 19, SNMPAgent = 20, Script = 21, Browser = 22 } /** * Item value types */ export declare enum ItemValueType { NumericFloat = 0, Character = 1, Log = 2, NumericUnsigned = 3, Text = 4, Binary = 5 } /** * HTTP header object for HTTP agent items * @see https://www.zabbix.com/documentation/current/en/manual/api/reference/item/object#http-header */ export interface HttpHeader { /** * HTTP header name. * Property behavior: required */ name: string; /** * Header value. * Property behavior: required */ value: string; } /** * HTTP query field object for HTTP agent items * @see https://www.zabbix.com/documentation/current/en/manual/api/reference/item/object#http-query-field */ export interface HttpQueryField { /** * Name of the parameter. * Property behavior: required */ name: string; /** * Parameter value. * Property behavior: required */ value: string; } /** * Item tag object * @see https://www.zabbix.com/documentation/current/en/manual/api/reference/item/object#item-tag */ export interface ItemTag { /** * Item tag name. * Property behavior: required */ tag: string; /** * Item tag value. */ value: string; } /** * Item preprocessing step object * @see https://www.zabbix.com/documentation/current/en/manual/api/reference/item/object#item-preprocessing */ export interface ItemPreprocessing { /** * The preprocessing option type. * Possible values: * 1 - Custom multiplier; * 2 - Right trim; * 3 - Left trim; * 4 - Trim; * 5 - Regular expression; * 6 - Boolean to decimal; * 7 - Octal to decimal; * 8 - Hexadecimal to decimal; * 9 - Simple change; * 10 - Change per second; * 11 - XML XPath; * 12 - JSONPath; * 13 - In range; * 14 - Matches regular expression; * 15 - Does not match regular expression; * 16 - Check for error in JSON; * 17 - Check for error in XML; * 18 - Check for error using regular expression; * 19 - Discard unchanged; * 20 - Discard unchanged with heartbeat; * 21 - JavaScript; * 22 - Prometheus pattern; * 23 - Prometheus to JSON; * 24 - CSV to JSON; * 25 - Replace; * 26 - Check unsupported; * 27 - XML to JSON; * 28 - SNMP walk value; * 29 - SNMP walk to JSON; * 30 - SNMP get value. * Property behavior: required */ type: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30; /** * Additional parameters used by preprocessing option. * Multiple parameters are separated by the newline (\n) character. * Property behavior: required for certain types */ params?: string; /** * Action type used in case of preprocessing step failure. * Possible values: * 0 - Error message is set by Zabbix server; * 1 - Discard value; * 2 - Set custom value; * 3 - Set custom error message. * Property behavior: required for certain types */ error_handler?: 0 | 1 | 2 | 3; /** * Error handler parameters. * Property behavior: required if error_handler is set to "Set custom value" or "Set custom error message" */ error_handler_params?: string; } /** * Zabbix Item Object * @see https://www.zabbix.com/documentation/current/en/manual/api/reference/item/object */ export interface Item { /** * ID of the item. * Property behavior: read-only, required for update operations */ itemid?: string; /** * Update interval of the item. * Accepts seconds or time unit with suffix (e.g., 30s, 1m, 2h, 1d) and, * optionally, one or more custom intervals, all separated by semicolons. * Property behavior: required for most item types */ delay?: string; /** * ID of the host or template that the item belongs to. * Property behavior: constant, required for create operations */ hostid: string; /** * ID of the item's host interface. * Property behavior: required for certain item types */ interfaceid?: string; /** * Item key. * Property behavior: required for create operations, read-only for inherited/discovered objects */ key_: string; /** * Name of the item. * Supports user macros. * Property behavior: required for create operations, read-only for inherited/discovered objects */ name: string; /** * Name of the item with resolved user macros. * Property behavior: read-only */ name_resolved?: string; /** * Type of the item. * Property behavior: required for create operations, read-only for inherited/discovered objects */ type: ItemType; /** * URL string for HTTP agent items. * Supports user macros and various placeholders. * Property behavior: required if type is set to "HTTP agent" */ url?: string; /** * Type of information of the item. * Property behavior: required for create operations, read-only for inherited/discovered objects */ value_type: ItemValueType; /** * Allow to populate value similarly to the trapper item. * 0 - (default) Do not allow to accept incoming data; * 1 - Allow to accept incoming data. * Property behavior: supported if type is set to "HTTP agent" */ allow_traps?: 0 | 1; /** * Authentication method. * Different possible values based on item type. * Property behavior: supported for certain item types */ authtype?: number; /** * Description of the item. * Property behavior: read-only for discovered objects */ description?: string; /** * Error text if there are problems updating the item value. * Property behavior: read-only */ error?: string; /** * Origin of the item. * Possible values: * 0 - a plain item; * 4 - a discovered item. * Property behavior: read-only */ flags?: 0 | 4; /** * Follow response redirects while polling data. * 0 - Do not follow redirects; * 1 - (default) Follow redirects. * Property behavior: supported if type is set to "HTTP agent" */ follow_redirects?: 0 | 1; /** * Array of headers that will be sent when performing an HTTP request. * Property behavior: supported if type is set to "HTTP agent" */ headers?: HttpHeader[]; /** * A time unit of how long the history data should be stored. * Also accepts user macro. * Default: 31d. */ history?: string; /** * HTTP(S) proxy connection string. * Property behavior: supported if type is set to "HTTP agent" */ http_proxy?: string; /** * ID of the host inventory field that is populated by the item. * Default: 0. * Property behavior: supported for certain value types */ inventory_link?: number; /** * IPMI sensor. * Property behavior: required/supported for IPMI agent items */ ipmi_sensor?: string; /** * JMX agent custom connection string. * Default value: service:jmx:rmi:///jndi/rmi://{HOST.CONN}:{HOST.PORT}/jmxrmi * Property behavior: supported if type is set to "JMX agent" */ jmx_endpoint?: string; /** * Time when the item value was last updated. * Property behavior: read-only */ lastclock?: string; /** * Nanoseconds when the item value was last updated. * Property behavior: read-only */ lastns?: number; /** * Last value of the item. * Property behavior: read-only */ lastvalue?: string; /** * Format of the time in log entries. * Property behavior: supported if value_type is set to "log" */ logtimefmt?: string; /** * ID of the master item. * Property behavior: required if type is set to "Dependent item" */ master_itemid?: string; /** * Should the response be converted to JSON. * 0 - (default) Store raw; * 1 - Convert to JSON. * Property behavior: supported if type is set to "HTTP agent" */ output_format?: 0 | 1; /** * Additional parameters depending on the type of the item. * Property behavior: required for certain item types */ params?: string; /** * Additional parameters for Script or Browser items. * Array of objects with name and value properties. * Property behavior: supported if type is set to "Script" or "Browser" */ parameters?: Array<{ name: string; value: string; }>; /** * Password for authentication. * Property behavior: required/supported for certain item types */ password?: string; /** * Type of post data body stored in posts property. * 0 - (default) Raw data; * 2 - JSON data; * 3 - XML data. * Property behavior: supported if type is set to "HTTP agent" */ post_type?: 0 | 2 | 3; /** * HTTP(S) request body data. * Property behavior: required/supported for HTTP agent items */ posts?: string; /** * Previous value of the item. * Property behavior: read-only */ prevvalue?: string; /** * Name of the private key file. * Property behavior: required for SSH agent with public key authentication */ privatekey?: string; /** * Name of the public key file. * Property behavior: required for SSH agent with public key authentication */ publickey?: string; /** * Array of query fields that will be sent when performing an HTTP request. * Property behavior: supported if type is set to "HTTP agent" */ query_fields?: HttpQueryField[]; /** * Type of request method. * 0 - (default) GET; * 1 - POST; * 2 - PUT; * 3 - HEAD. * Property behavior: supported if type is set to "HTTP agent" */ request_method?: 0 | 1 | 2 | 3; /** * What part of response should be stored. * Different values based on request method. * Property behavior: supported if type is set to "HTTP agent" */ retrieve_mode?: number; /** * SNMP OID. * Property behavior: required if type is set to "SNMP agent" */ snmp_oid?: string; /** * Public SSL Key file path. * Property behavior: supported if type is set to "HTTP agent" */ ssl_cert_file?: string; /** * Private SSL Key file path. * Property behavior: supported if type is set to "HTTP agent" */ ssl_key_file?: string; /** * Password for SSL Key file. * Property behavior: supported if type is set to "HTTP agent" */ ssl_key_password?: string; /** * State of the item. * 0 - (default) normal; * 1 - not supported. * Property behavior: read-only */ state?: 0 | 1; /** * Status of the item. * 0 - (default) enabled item; * 1 - disabled item. */ status?: 0 | 1; /** * Ranges of required HTTP status codes, separated by commas. * Property behavior: supported if type is set to "HTTP agent" */ status_codes?: string; /** * ID of the parent template item. * Property behavior: read-only */ templateid?: string; /** * Item data polling request timeout. * Accepts seconds or time unit with suffix. * Property behavior: supported for certain item types */ timeout?: string; /** * Allowed hosts. * Property behavior: supported for trapper items and HTTP agent with allow_traps */ trapper_hosts?: string; /** * A time unit of how long the trends data should be stored. * Default: 365d. * Property behavior: supported for numeric value types */ trends?: string; /** * Value units. * Property behavior: supported for numeric value types */ units?: string; /** * Username for authentication. * Property behavior: required/supported for certain item types */ username?: string; /** * Universal unique identifier, used for linking imported item to already existing ones. * Property behavior: supported if the item belongs to a template */ uuid?: string; /** * ID of the associated value map. * Property behavior: supported for certain value types */ valuemapid?: string; /** * Whether to validate that the host name for the connection matches the one in the host's certificate. * 0 - (default) Do not validate; * 1 - Validate. * Property behavior: supported if type is set to "HTTP agent" */ verify_host?: 0 | 1; /** * Whether to validate that the host's certificate is authentic. * 0 - (default) Do not validate; * 1 - Validate. * Property behavior: supported if type is set to "HTTP agent" */ verify_peer?: 0 | 1; /** * Item tags (populated when selectTags is used) */ tags?: ItemTag[]; /** * Item preprocessing steps (populated when selectPreprocessing is used) */ preprocessing?: ItemPreprocessing[]; } /** * Item.get method output parameters */ export type ItemGetParamsOutput = "itemid" | "type" | "snmp_oid" | "hostid" | "name" | "key_" | "delay" | "history" | "trends" | "status" | "value_type" | "trapper_hosts" | "units" | "formula" | "logtimefmt" | "templateid" | "valuemapid" | "params" | "ipmi_sensor" | "authtype" | "username" | "password" | "publickey" | "privatekey" | "flags" | "interfaceid" | "description" | "inventory_link" | "master_itemid" | "timeout" | "url" | "query_fields" | "posts" | "status_codes" | "follow_redirects" | "post_type" | "http_proxy" | "headers" | "retrieve_mode" | "request_method" | "output_format" | "ssl_cert_file" | "ssl_key_file" | "ssl_key_password" | "verify_peer" | "verify_host" | "allow_traps" | "jmx_endpoint" | "name_resolved" | "state" | "error" | "lastclock" | "lastns" | "lastvalue" | "prevvalue" | "parameters" | "uuid"; /** * Tag filter object for item.get method */ export interface ItemTagFilter { /** * Tag name */ tag: string; /** * Tag value */ value?: string; /** * Search operator * 0 - (default) Like; * 1 - Equal; * 2 - Not like; * 3 - Not equal; * 4 - Exists; * 5 - Not exists. */ operator?: 0 | 1 | 2 | 3 | 4 | 5; } /** * Discovery data object returned when selectDiscoveryData is used */ export interface ItemDiscoveryData { /** * ID of the item discovery */ itemdiscoveryid: string; /** * ID of the item prototype from which the item has been created */ parent_itemid: string; /** * Key of the item prototype */ key_: string; /** * Time when the item was last discovered */ lastcheck: string; /** * Item discovery status: * 0 - (default) item is discovered, * 1 - item is not discovered anymore */ status: 0 | 1; /** * Time when an item that is no longer discovered will be deleted */ ts_delete: string; /** * Time when an item that is no longer discovered will be disabled */ ts_disable: string; /** * Indicator of whether item was disabled by an LLD rule or manually: * 0 - (default) disabled automatically, * 1 - disabled by an LLD rule */ disable_source: 0 | 1; } /** * Parameters for the item.get method * @see https://www.zabbix.com/documentation/current/en/manual/api/reference/item/get */ export interface ItemGetParams { /** * Return only items with the given IDs. */ itemids?: string | string[]; /** * Return only items that belong to the hosts from the given groups. */ groupids?: string | string[]; /** * Return only items that belong to the given templates. */ templateids?: string | string[]; /** * Return only items that belong to the given hosts. */ hostids?: string | string[]; /** * Return only items that are monitored by the given proxies. */ proxyids?: string | string[]; /** * Return only items that use the given host interfaces. */ interfaceids?: string | string[]; /** * Return only items that are used in the given graphs. */ graphids?: string | string[]; /** * Return only items that are used in the given triggers. */ triggerids?: string | string[]; /** * Include web items in the result. */ webitems?: boolean; /** * If set to true return only items inherited from a template. */ inherited?: boolean; /** * If set to true return only items that belong to templates. */ templated?: boolean; /** * If set to true return only enabled items that belong to monitored hosts. */ monitored?: boolean; /** * Return only items that belong to a group with the given name. */ group?: string; /** * Return only items that belong to a host with the given name. */ host?: string; /** * Rules for tag searching. * 0 - (default) And/Or; * 2 - Or. */ evaltype?: 0 | 2; /** * Return only items with given tags. */ tags?: ItemTagFilter[]; /** * If set to true return only items that are used in triggers. */ with_triggers?: boolean; /** * Return a hosts property with an array of hosts that the item belongs to. */ selectHosts?: "extend" | string[]; /** * Return an interfaces property with an array of host interfaces used by the item. */ selectInterfaces?: "extend" | string[]; /** * Return a triggers property with the triggers that the item is used in. * Supports count. */ selectTriggers?: "extend" | "count" | string[]; /** * Return a graphs property with the graphs that contain the item. * Supports count. */ selectGraphs?: "extend" | "count" | string[]; /** * Return a discoveryData property with the item discovery object data. */ selectDiscoveryData?: "extend" | string[]; /** * Return a discoveryRule property with the LLD rule that created the item. */ selectDiscoveryRule?: "extend" | string[]; /** * Return a discoveryRulePrototype property with the parent LLD rule prototype that created the item. */ selectDiscoveryRulePrototype?: "extend" | string[]; /** * Return an itemDiscovery property with the item discovery object. * @deprecated This query is deprecated, please use selectDiscoveryData instead. */ selectItemDiscovery?: "extend" | string[]; /** * Return a preprocessing property with item preprocessing options. */ selectPreprocessing?: "extend" | string[]; /** * Return the item tags in tags property. */ selectTags?: "extend" | string[]; /** * Return a valuemap property with item value map. */ selectValueMap?: "extend" | string[]; /** * Return only those results that exactly match the given filter. */ filter?: { [key: string]: string | string[] | number | number[] | boolean; } & { /** * Technical name of the host that the item belongs to. */ host?: string | string[]; }; /** * Limits the number of records returned by subselects. */ limitSelects?: number; /** * Sort the result by the given properties. * Possible values: itemid, name, key_, delay, history, trends, type, status. */ sortfield?: string | string[]; /** * Return only specific object properties. */ output?: ItemGetParamsOutput[] | "extend"; /** * Return results that match the given wildcard search (case-insensitive). */ search?: { [key: string]: string; }; /** * If set to true return results that match any of the criteria given in the filter or search parameter instead of all of them. */ searchByAny?: boolean; /** * If set to true enables the use of wildcards in search. */ searchWildcardsEnabled?: boolean; /** * Order of sorting. */ sortorder?: string | string[]; /** * If set to true enables the use of wildcards at the beginning of search. */ startSearch?: boolean; /** * Return the count of retrieved objects. */ countOutput?: boolean; /** * Return only editable items. */ editable?: boolean; /** * Exclude search from the query. */ excludeSearch?: boolean; /** * Limit the number of records returned. */ limit?: number; /** * Preserve keys in the result. */ preservekeys?: boolean; } /** * Parameters for the item.create method * @see https://www.zabbix.com/documentation/current/en/manual/api/reference/item/create */ export interface ItemCreateParams { /** * Items to create */ items?: Omit<Item, "itemid" | "templateid" | "flags" | "state" | "error" | "lastclock" | "lastns" | "lastvalue" | "prevvalue" | "name_resolved">[]; } /** * Parameters for the item.update method * @see https://www.zabbix.com/documentation/current/en/manual/api/reference/item/update */ export interface ItemUpdateParams { /** * Items to update with their itemid and updated properties */ items?: (Partial<Item> & { itemid: string; })[]; } /** * Parameters for the item.delete method * @see https://www.zabbix.com/documentation/current/en/manual/api/reference/item/delete */ export interface ItemDeleteParams { /** * IDs of the items to delete */ itemids?: string[]; } export {};