traffic-monitor-mqtt
Version:
Zentrales Traffic Monitoring via MQTT für Node.js Anwendungen
52 lines (51 loc) • 1.44 kB
TypeScript
export interface MQTTConfig {
host: string;
port: number;
ssl?: boolean;
username?: string;
password?: string;
clientId?: string;
qos?: 0 | 1 | 2;
auth?: {
username: string;
password: string;
};
tls?: {
ca?: string;
cert?: string;
key?: string;
rejectUnauthorized?: boolean;
};
}
export interface ClientConfig {
name: string;
environment: 'production' | 'staging' | 'development';
hostname: string;
}
export interface MonitorConfig {
mqtt: MQTTConfig;
client: ClientConfig;
batchSize?: number;
batchIntervalMs?: number;
samplingRate?: number;
debug?: boolean;
}
export type DBOperationType = 'db:find' | 'db:insertOne' | 'db:insertMany' | 'db:updateOne' | 'db:updateMany' | 'db:deleteOne' | 'db:deleteMany' | 'db:select' | 'db:insert' | 'db:update';
export type HTTPOperationType = 'http:incoming' | 'http:outgoing';
export type CustomOperationType = `custom:${string}`;
export type OperationType = DBOperationType | HTTPOperationType | CustomOperationType;
export interface TrafficEvent {
timestamp: string;
clientInfo: {
name: string;
environment: string;
hostname: string;
};
operationType: OperationType;
targetSystem: string;
performance: {
executionTimeMs: number;
payloadSizeBytes?: number;
};
details?: Record<string, unknown>;
}