import type { IOidSet, TUpsModel } from './types.ts'; /** * OID sets for different UPS models * Contains mappings between UPS models and their SNMP OIDs */ export class UpsOidSets { /** * OID sets for different UPS models */ private static readonly UPS_OID_SETS: Record = { // Cyberpower OIDs for RMCARD205 (based on CyberPower_MIB_v2.11) cyberpower: { POWER_STATUS: '1.3.6.1.4.1.3808.1.1.1.4.1.1.0', // upsBaseOutputStatus BATTERY_CAPACITY: '1.3.6.1.4.1.3808.1.1.1.2.2.1.0', // upsAdvanceBatteryCapacity (percentage) BATTERY_RUNTIME: '1.3.6.1.4.1.3808.1.1.1.2.2.4.0', // upsAdvanceBatteryRunTimeRemaining (TimeTicks) POWER_STATUS_VALUES: { online: 2, // upsBaseOutputStatus: 2=onLine onBattery: 3, // upsBaseOutputStatus: 3=onBattery }, }, // APC OIDs apc: { POWER_STATUS: '1.3.6.1.4.1.318.1.1.1.4.1.1.0', // upsBasicOutputStatus BATTERY_CAPACITY: '1.3.6.1.4.1.318.1.1.1.2.2.1.0', // Battery capacity in percentage BATTERY_RUNTIME: '1.3.6.1.4.1.318.1.1.1.2.2.3.0', // Remaining runtime in minutes POWER_STATUS_VALUES: { online: 2, // upsBasicOutputStatus: 2=onLine onBattery: 3, // upsBasicOutputStatus: 3=onBattery }, }, // Eaton OIDs eaton: { POWER_STATUS: '1.3.6.1.4.1.534.1.4.4.0', // xupsOutputSource BATTERY_CAPACITY: '1.3.6.1.4.1.534.1.2.4.0', // xupsBatCapacity (percentage) BATTERY_RUNTIME: '1.3.6.1.4.1.534.1.2.1.0', // xupsBatTimeRemaining (seconds) POWER_STATUS_VALUES: { online: 3, // xupsOutputSource: 3=normal (mains power) onBattery: 5, // xupsOutputSource: 5=battery }, }, // TrippLite OIDs tripplite: { POWER_STATUS: '1.3.6.1.4.1.850.1.1.3.1.1.1.0', // tlUpsOutputSource BATTERY_CAPACITY: '1.3.6.1.4.1.850.1.1.3.2.4.1.0', // Battery capacity in percentage BATTERY_RUNTIME: '1.3.6.1.4.1.850.1.1.3.2.2.1.0', // Remaining runtime in minutes POWER_STATUS_VALUES: { online: 2, // tlUpsOutputSource: 2=normal (mains power) onBattery: 3, // tlUpsOutputSource: 3=onBattery }, }, // Liebert/Vertiv OIDs liebert: { POWER_STATUS: '1.3.6.1.4.1.476.1.42.3.9.20.1.20.1.2.1.2.1', // lgpPwrOutputSource BATTERY_CAPACITY: '1.3.6.1.4.1.476.1.42.3.9.20.1.20.1.2.1.4.1', // Battery capacity in percentage BATTERY_RUNTIME: '1.3.6.1.4.1.476.1.42.3.9.20.1.20.1.2.1.5.1', // Remaining runtime in minutes POWER_STATUS_VALUES: { online: 2, // lgpPwrOutputSource: 2=normal (mains power) onBattery: 3, // lgpPwrOutputSource: 3=onBattery }, }, // Custom OIDs (to be provided by the user) custom: { POWER_STATUS: '', BATTERY_CAPACITY: '', BATTERY_RUNTIME: '', }, }; /** * Get OID set for a specific UPS model * @param model UPS model name * @returns OID set for the model */ public static getOidSet(model: TUpsModel): IOidSet { return this.UPS_OID_SETS[model]; } /** * Get standard RFC 1628 OID set as fallback * @returns Standard OID set */ public static getStandardOids(): Record { return { 'power status': '1.3.6.1.2.1.33.1.4.1.0', // upsOutputSource 'battery capacity': '1.3.6.1.2.1.33.1.2.4.0', // upsEstimatedChargeRemaining 'battery runtime': '1.3.6.1.2.1.33.1.2.3.0', // upsEstimatedMinutesRemaining }; } }