UNPKG

zabbix-utils

Version:

TypeScript port of zabbix-utils - Python library for working with Zabbix API, Sender, and Getter protocols

64 lines 2.52 kB
import * as net from 'net'; export declare class ModuleUtils { static readonly HIDING_MASK: string; static readonly JSONRPC_FILE = "api_jsonrpc.php"; static readonly UNAUTH_METHODS: string[]; static readonly FILES_METHODS: string[]; static readonly PRIVATE_FIELDS: Record<string, string>; /** * Check url completeness * * @param url - Unchecked URL of Zabbix API * @returns Checked URL of Zabbix API */ static checkUrl(url: string): string; /** * Replace the most part of string to hiding mask. * * @param string - Raw string with without hiding. * @param showLen - Number of signs shown on each side of the string. Defaults to 4. * @returns String with hiding part. */ static maskSecret(string: string, showLen?: number): string; /** * Hide private data Zabbix info (e.g. token, password) * * @param inputData - Input dictionary with private fields. * @param fields - Dictionary of private fields and their filtering regexps. * @returns Result dictionary without private data. */ static hidePrivate(inputData: Record<string, any>, fields?: Record<string, string>): Record<string, any>; } export declare class ZabbixProtocol { static readonly ZABBIX_PROTOCOL: Buffer<ArrayBuffer>; static readonly HEADER_SIZE = 13; private static prepareRequest; /** * Create a packet for sending via the Zabbix protocol. * * @param payload - Payload of the future packet * @param log - Logger object (console in Node.js) * @param compression - Compression use flag. Defaults to false. * @returns Generated Zabbix protocol packet */ static createPacket(payload: Buffer | string | any[] | Record<string, any>, log: Console, compression?: boolean): Buffer; /** * Receive packet data from socket * * @param conn - Socket connection * @param size - Size of data to receive * @param log - Logger object * @returns Received data */ static receivePacket(conn: net.Socket, size: number, log: Console): Promise<Buffer>; /** * Parse a received synchronously Zabbix protocol packet. * * @param conn - Socket connection * @param log - Logger object * @param ExceptionClass - Exception class to throw * @returns Body of the received packet */ static parseSyncPacket(conn: net.Socket, log: Console, ExceptionClass: any): Promise<string>; } //# sourceMappingURL=common.d.ts.map