Added network interface in Perfs
MODIFY
src/server/ocpp/json/JsonCentralSystemServer.ts
src/server/ocpp/json/JsonCentralSystemServer.ts
@@ -116,7 +116,6 @@ export default class JsonCentralSystemServer extends CentralSystemServer {
});
return false;
};
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const handleProtocols = (protocols: string | string[], request: http.IncomingMessage): boolean | string => {
// Check the protocols and ensure protocol used as ocpp1.6 or nothing (should create an error)
@@ -140,7 +139,6 @@ export default class JsonCentralSystemServer extends CentralSystemServer {
});
return false;
};
-
// Create the WS server
this.wsServer = new WSServer(this.serverConfig.port, this.serverConfig.host, this.serverName, WSServer.createHttpServer(this.centralSystemConfig),
verifyClient, handleProtocols);

MODIFY
src/storage/mongodb/PerformanceStorage.ts
src/storage/mongodb/PerformanceStorage.ts
@@ -15,6 +15,7 @@ export default class PerformanceStorage {
cpusInfo: performanceRecord.cpusInfo,
memoryTotalGb: performanceRecord.memoryTotalGb,
memoryFreeGb: performanceRecord.memoryFreeGb,
+ networkInterface: performanceRecord.networkInterface,
loadAverageLastMin: performanceRecord.loadAverageLastMin,
process: performanceRecord.process,
processMemoryUsage: performanceRecord.processMemoryUsage,

MODIFY
src/types/Performance.ts
src/types/Performance.ts
-import { CpuInfo } from 'os';
+import os, { CpuInfo } from 'os';
+
import { ServerAction } from './Server';
export default interface PerformanceRecord {
@@ -15,6 +16,7 @@ export default interface PerformanceRecord {
memoryTotalGb: number;
memoryFreeGb: number;
loadAverageLastMin: number,
+ networkInterface: NodeJS.Dict<os.NetworkInterfaceInfo[]>,
numberOfChargingStations?: number;
source: string;
module: string;

MODIFY
src/utils/Constants.ts
src/utils/Constants.ts
@@ -5,6 +5,8 @@ import { OcppParameter } from '../types/ChargingStation';
import Tenant from '../types/Tenant';
export default class Constants {
+ public static readonly ONE_BILLION = 1000000000;
+
public static readonly BOOT_NOTIFICATION_WAIT_TIME = 60;
public static readonly CSV_SEPARATOR = ',';

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
@@ -1411,9 +1411,10 @@ export default class Utils {
processMemoryUsage: process.memoryUsage(),
processCPUUsage: process.cpuUsage(),
cpusInfo: os.cpus(),
- memoryTotalGb: os.totalmem(),
- memoryFreeGb: os.freemem(),
+ memoryTotalGb: Utils.createDecimal(os.totalmem()).div(Constants.ONE_BILLION).toNumber(),
+ memoryFreeGb: Utils.createDecimal(os.freemem()).div(Constants.ONE_BILLION).toNumber(),
loadAverageLastMin: os.loadavg()[0],
+ networkInterface: os.networkInterfaces(),
numberOfChargingStations: global.centralSystemJsonServer?.getNumberOfJsonConnections(),
source: params.source,
module: params.module,

Added network interface in Perfs