NIO-EUSB-MIB DEFINITIONS ::= BEGIN

-- =====================================================================
-- NIO Electronics NIO-EUSB appliance MIB
-- Enterprise OID: 1.3.6.1.4.1.53034  (nioElectronics)
--
-- Served by the appliance's built-in SNMP agent (webui, internal/snmp).
-- Enable it in the web UI: Monitoring -> SNMP agent (v2c or v3).
-- Keep this file in sync with internal/snmp/oids.go — that Go file is
-- the source of truth for the OID tree.
-- =====================================================================

IMPORTS
    MODULE-IDENTITY, OBJECT-TYPE, OBJECT-IDENTITY, enterprises,
    Integer32, Gauge32, Unsigned32
        FROM SNMPv2-SMI
    DisplayString
        FROM SNMPv2-TC;

nioElectronics MODULE-IDENTITY
    LAST-UPDATED "202607300000Z"
    ORGANIZATION "NIO Electronics"
    CONTACT-INFO  "NIO Electronics support"
    DESCRIPTION   "USB-over-IP appliance (NIO-EUSB) monitoring MIB:
                   cluster role, per-port power state, system stats
                   (CPU/memory/uptime) and on-board ADC rails/temperature."
    REVISION      "202607300000Z"
    DESCRIPTION   "Initial published revision."
    ::= { enterprises 53034 }

-- ---------------------------------------------------------------------
-- cluster (.9)
-- ---------------------------------------------------------------------
nioCluster OBJECT-IDENTITY
    STATUS  current
    DESCRIPTION "Cluster (keepalived/VRRP) state group."
    ::= { nioElectronics 9 }

nioIsMasterNode OBJECT-TYPE
    SYNTAX      INTEGER { backup(0), master(1) }
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "1 when this node currently holds the VRRP master role,
                 0 when it is the backup. On a healthy two-node cluster
                 exactly one node reports 1; two nodes reporting 1 means
                 split-brain."
    ::= { nioCluster 1 }

-- ---------------------------------------------------------------------
-- usbPorts (.10) — per-port table
-- ---------------------------------------------------------------------
nioUsbPorts OBJECT-IDENTITY
    STATUS  current
    DESCRIPTION "USB port group."
    ::= { nioElectronics 10 }

nioPortsTable OBJECT-TYPE
    SYNTAX      SEQUENCE OF NioPortsEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION "One row per configured USB port."
    ::= { nioUsbPorts 1 }

nioPortsEntry OBJECT-TYPE
    SYNTAX      NioPortsEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION "A single USB port."
    INDEX       { nioPortIndex }
    ::= { nioPortsTable 1 }

NioPortsEntry ::= SEQUENCE {
    nioPortIndex        Integer32,
    nioPortHub          Integer32,
    nioPortNum          Integer32,
    nioPortPowerState   INTEGER,
    nioPortNickname     DisplayString,
    nioPortDescription  DisplayString,
    nioPortIdProduct    DisplayString,
    nioPortIdVendor     DisplayString,
    nioPortProduct      DisplayString,
    nioPortManufacturer DisplayString
}

nioPortIndex OBJECT-TYPE
    SYNTAX Integer32 (1..2147483647) MAX-ACCESS read-only STATUS current
    DESCRIPTION "Table index (1-based)." ::= { nioPortsEntry 1 }
nioPortHub OBJECT-TYPE
    SYNTAX Integer32 MAX-ACCESS read-only STATUS current
    DESCRIPTION "Hub number the port belongs to." ::= { nioPortsEntry 2 }
nioPortNum OBJECT-TYPE
    SYNTAX Integer32 MAX-ACCESS read-only STATUS current
    DESCRIPTION "Port number within its hub." ::= { nioPortsEntry 3 }
nioPortPowerState OBJECT-TYPE
    SYNTAX INTEGER { off(0), on(1) } MAX-ACCESS read-only STATUS current
    DESCRIPTION "Whether the port's USB power is currently on."
    ::= { nioPortsEntry 4 }
nioPortNickname OBJECT-TYPE
    SYNTAX DisplayString MAX-ACCESS read-only STATUS current
    DESCRIPTION "Admin-assigned port name." ::= { nioPortsEntry 5 }
nioPortDescription OBJECT-TYPE
    SYNTAX DisplayString MAX-ACCESS read-only STATUS current
    DESCRIPTION "Port device path / description." ::= { nioPortsEntry 6 }
nioPortIdProduct OBJECT-TYPE
    SYNTAX DisplayString MAX-ACCESS read-only STATUS current
    DESCRIPTION "USB idProduct of the attached device (may be empty)."
    ::= { nioPortsEntry 7 }
nioPortIdVendor OBJECT-TYPE
    SYNTAX DisplayString MAX-ACCESS read-only STATUS current
    DESCRIPTION "USB idVendor of the attached device (may be empty)."
    ::= { nioPortsEntry 8 }
nioPortProduct OBJECT-TYPE
    SYNTAX DisplayString MAX-ACCESS read-only STATUS current
    DESCRIPTION "USB product string (may be empty)." ::= { nioPortsEntry 9 }
nioPortManufacturer OBJECT-TYPE
    SYNTAX DisplayString MAX-ACCESS read-only STATUS current
    DESCRIPTION "USB manufacturer string (may be empty)."
    ::= { nioPortsEntry 10 }

-- ---------------------------------------------------------------------
-- systemStats (.11)
-- ---------------------------------------------------------------------
nioSystem OBJECT-IDENTITY
    STATUS current DESCRIPTION "System statistics group."
    ::= { nioElectronics 11 }

nioCpuTotalUsage OBJECT-TYPE
    SYNTAX      Gauge32 (0..100)
    UNITS       "percent"
    MAX-ACCESS  read-only STATUS current
    DESCRIPTION "Average total CPU utilisation, 0..100 %."
    ::= { nioSystem 1 }
nioMemTotalReal OBJECT-TYPE
    SYNTAX      Gauge32
    UNITS       "bytes"
    MAX-ACCESS  read-only STATUS current
    DESCRIPTION "Total physical memory, bytes." ::= { nioSystem 2 }
nioMemTotalFree OBJECT-TYPE
    SYNTAX      Gauge32
    UNITS       "bytes"
    MAX-ACCESS  read-only STATUS current
    DESCRIPTION "Available (free) physical memory, bytes."
    ::= { nioSystem 3 }
nioUptime OBJECT-TYPE
    SYNTAX      Gauge32
    UNITS       "seconds"
    MAX-ACCESS  read-only STATUS current
    DESCRIPTION "System uptime in seconds (NOT TimeTicks)."
    ::= { nioSystem 4 }

-- ---------------------------------------------------------------------
-- adc (.20) — on-board ADS1115 rails and temperature
-- Voltages are milliVolts; temperature is tenths of a degree Celsius.
-- Appliances without the ADC report 0 for all four.
-- ---------------------------------------------------------------------
nioAdc OBJECT-IDENTITY
    STATUS current DESCRIPTION "On-board ADC (power rails, temperature)."
    ::= { nioElectronics 20 }

nioSystemVoltage OBJECT-TYPE
    SYNTAX Gauge32 UNITS "millivolts" MAX-ACCESS read-only STATUS current
    DESCRIPTION "System rail voltage, mV (e.g. 12000 = 12.000 V)."
    ::= { nioAdc 1 }
nioPsu1Voltage OBJECT-TYPE
    SYNTAX Gauge32 UNITS "millivolts" MAX-ACCESS read-only STATUS current
    DESCRIPTION "PSU 1 voltage, mV." ::= { nioAdc 2 }
nioPsu2Voltage OBJECT-TYPE
    SYNTAX Gauge32 UNITS "millivolts" MAX-ACCESS read-only STATUS current
    DESCRIPTION "PSU 2 voltage, mV." ::= { nioAdc 3 }
nioTemp OBJECT-TYPE
    SYNTAX Integer32 UNITS "0.1 degrees Celsius" MAX-ACCESS read-only STATUS current
    DESCRIPTION "Board temperature in tenths of a degree C
                 (e.g. 452 = 45.2 C)." ::= { nioAdc 4 }

END
