# sila-snmp This project containt two subprojects: - [sila-snmp-agent](#sila-snmp-agent) - [snmpcfg - DBus service for manage snmp configuration](#snmpcfg) ## sila-snmp-agent This is a subagent for the original net-snmp daemon. It queries DBus for values of available sensors, inventory items and some other stuff, and exports their actual values over SNMP. ### SILA-MIB.txt File SILA-MIB.txt describe a struc of exported data. This file can be found at OpenBMC hosts in folder `/usr/share/snmp/mibs` and may be fetched from OpenBMC host over http. ```shell $ mkdir ~/.snmp/mibs $ cd ~/.snmp/mibs $ wget --no-check-certificate https:///mibs/SILA-MIB.txt ``` ### Basic SNMP This module export a host power state field and tree tables of sensors values. ```shell $ snmptranslate -Tp -IR SILA-MIB::sila +--sila(49769) | +--silaNotifications(0) | | | +--silaHostPowerStateNotification(1) | +--silaTempSensorStateNotification(2) | +--silaVoltSensorStateNotification(3) | +--silaTachSensorStateNotification(4) | +--silaCurrSensorStateNotification(5) | +--silaPwrSensorStateNotification(6) | +--silaInventoryItemNotification(7) | +--silaSensors(1) | | | +-- -R-- EnumVal silaHostPowerState(1) | | Values: unknown(-1), off(0), on(1) | | | +--silaTempSensorsTable(2) | | | | | +--silaTempSensorsEntry(1) | | | Index: silaTempSensorName | | | | | +-- -R-- String silaTempSensorName(1) | | | Size: 1..32 | | +-- -R-- Integer32 silaTempSensorValue(2) | | | Textual Convention: Degrees | | +-- -R-- Integer32 silaTempSensorWarnLow(3) | | | Textual Convention: Degrees | | +-- -R-- Integer32 silaTempSensorWarnHigh(4) | | | Textual Convention: Degrees | | +-- -R-- Integer32 silaTempSensorCritLow(5) | | | Textual Convention: Degrees | | +-- -R-- Integer32 silaTempSensorCritHigh(6) | | | Textual Convention: Degrees | | +-- -R-- EnumVal silaTempSensorState(7) | | Textual Convention: SensorState | | Values: disabled(0), normal(1), warningLow(2), warningHigh(3), criticalLow(4), criticalHigh(5) | | | +--silaVoltSensorsTable(3) | | | | | +--silaVoltSensorsEntry(1) | | | Index: silaVoltSensorName | | | | | +-- -R-- String silaVoltSensorName(1) | | | Size: 1..32 | | +-- -R-- Integer32 silaVoltSensorValue(2) | | | Textual Convention: Voltage | | +-- -R-- Integer32 silaVoltSensorWarnLow(3) | | | Textual Convention: Voltage | | +-- -R-- Integer32 silaVoltSensorWarnHigh(4) | | | Textual Convention: Voltage | | +-- -R-- Integer32 silaVoltSensorCritLow(5) | | | Textual Convention: Voltage | | +-- -R-- Integer32 silaVoltSensorCritHigh(6) | | | Textual Convention: Voltage | | +-- -R-- EnumVal silaVoltSensorState(7) | | Textual Convention: SensorState | | Values: disabled(0), normal(1), warningLow(2), warningHigh(3), criticalLow(4), criticalHigh(5) | | | +--silaTachSensorsTable(4) | | | | | +--silaTachSensorsEntry(1) | | | Index: silaTachSensorName | | | | | +-- -R-- String silaTachSensorName(1) | | | Size: 1..32 | | +-- -R-- Integer32 silaTachSensorValue(2) | | | Textual Convention: RPMS | | +-- -R-- Integer32 silaTachSensorWarnLow(3) | | | Textual Convention: RPMS | | +-- -R-- Integer32 silaTachSensorWarnHigh(4) | | | Textual Convention: RPMS | | +-- -R-- Integer32 silaTachSensorCritLow(5) | | | Textual Convention: RPMS | | +-- -R-- Integer32 silaTachSensorCritHigh(6) | | | Textual Convention: RPMS | | +-- -R-- EnumVal silaTachSensorState(7) | | Textual Convention: SensorState | | Values: disabled(0), normal(1), warningLow(2), warningHigh(3), criticalLow(4), criticalHigh(5) | | | +--silaCurrSensorsTable(5) | | | | | +--silaCurrSensorsEntry(1) | | | Index: silaCurrSensorName | | | | | +-- -R-- String silaCurrSensorName(1) | | | Size: 1..32 | | +-- -R-- Integer32 silaCurrSensorValue(2) | | | Textual Convention: Current | | +-- -R-- Integer32 silaCurrSensorWarnLow(3) | | | Textual Convention: Current | | +-- -R-- Integer32 silaCurrSensorWarnHigh(4) | | | Textual Convention: Current | | +-- -R-- Integer32 silaCurrSensorCritLow(5) | | | Textual Convention: Current | | +-- -R-- Integer32 silaCurrSensorCritHigh(6) | | | Textual Convention: Current | | +-- -R-- EnumVal silaCurrSensorState(7) | | Textual Convention: SensorState | | Values: disabled(0), normal(1), warningLow(2), warningHigh(3), criticalLow(4), criticalHigh(5) | | | +--silaPowerSensorsTable(6) | | | +--silaPowerSensorsEntry(1) | | Index: silaPowerSensorName | | | +-- -R-- String silaPowerSensorName(1) | | Size: 1..32 | +-- -R-- Integer32 silaPowerSensorValue(2) | | Textual Convention: Power | +-- -R-- Integer32 silaPowerSensorWarnLow(3) | | Textual Convention: Power | +-- -R-- Integer32 silaPowerSensorWarnHigh(4) | | Textual Convention: Power | +-- -R-- Integer32 silaPowerSensorCritLow(5) | | Textual Convention: Power | +-- -R-- Integer32 silaPowerSensorCritHigh(6) | | Textual Convention: Power | +-- -R-- EnumVal silaPowerSensorState(7) | Textual Convention: SensorState | Values: disabled(0), normal(1), warningLow(2), warningHigh(3), criticalLow(4), criticalHigh(5) | +--silaConformance(2) | | | +--silaCompliances(1) | | | | | +--silaCommpliance(1) | | | +--silaGroups(2) | | | +--silaScalarFieldsGroup(1) | +--silaTempSensorsTableGroup(2) | +--silaVoltSensorsTableGroup(3) | +--silaTachSensorsTableGroup(4) | +--silaCurrSensorsTableGroup(5) | +--silaPowerSensorsTableGroup(6) | +--silaSoftwareTableGroup(7) | +--silaInventoryTableGroup(8) | +--silaNotificationsGroup(10) | +--silaProducts(3) | | | +--silaBmc(1) | +--silaInventoryTable(4) | | | +--silaInventoryEntry(1) | | Index: silaInventoryPath | | | +-- -R-- String silaInventoryPath(1) | | Size: 1..117 | +-- -R-- String silaInventoryName(2) | +-- -R-- String silaInventoryManufacturer(3) | +-- -R-- String silaInventoryBuildDate(4) | +-- -R-- String silaInventoryModel(5) | +-- -R-- String silaInventoryPartNumber(6) | +-- -R-- String silaInventorySerialNumber(7) | +-- -R-- String silaInventoryVersion(8) | +-- -R-- EnumVal silaInventoryPresent(9) | | Textual Convention: TruthValue | | Values: true(1), false(2) | +-- -R-- EnumVal silaInventoryFunctional(10) | Textual Convention: TruthValue | Values: true(1), false(2) | +--silaSoftwareTable(5) | +--silaSoftwareEntry(1) | Index: silaSoftwareHash | +-- -R-- String silaSoftwareHash(1) | Size: 1..8 +-- -R-- String silaSoftwareVersion(2) +-- -R-- EnumVal silaSoftwarePurpose(3) | Values: unknown(0), other(1), system(2), bmc(3), host(4) +-- -R-- EnumVal silaSoftwareActivation(4) | Values: notReady(0), invalid(1), ready(2), activating(3), active(4), failed(5) +-- -R-- Integer32 silaSoftwarePriority(5) ``` Content of tables may be viewed by command `snmptable`: ```shell $ snmptable -v2c -cpublic -Ci SILA-MIB::silaTempSensorsTable SNMP table: SILA-MIB::silaTempSensorsTable index silaTempSensorName silaTempSensorValue silaTempSensorWarnLow ... silaTempSensorCritHigh silaTempSensorState "BMC_Temp" "BMC_Temp" 21.375 °C 5.000 °C ... 115.000 °C normal "Inlet_BRD_Temp" "Inlet_BRD_Temp" 16.750 °C 5.000 °C ... 115.000 °C normal "PCH___M_2_Temp" "PCH___M_2_Temp" 17.375 °C 5.000 °C ... 115.000 °C normal "PSU1_Temperature" "PSU1_Temperature" 22.000 °C .000 °C ... 63.000 °C normal "PSU2_Temperature" "PSU2_Temperature" 20.250 °C .000 °C ... 63.000 °C normal ... ``` All exporting data may be viewed by command `snmpwalk`: ```shell $ snmpwalk -v2c -cpublic SILA-MIB::silaTempSensorsTable SILA-MIB::silaTempSensorName."BMC_Temp" = STRING: "BMC_Temp" SILA-MIB::silaTempSensorName."Inlet_BRD_Temp" = STRING: "Inlet_BRD_Temp" SILA-MIB::silaTempSensorName."PCH___M_2_Temp" = STRING: "PCH___M_2_Temp" SILA-MIB::silaTempSensorName."PSU1_Temperature" = STRING: "PSU1_Temperature" SILA-MIB::silaTempSensorName."PSU2_Temperature" = STRING: "PSU2_Temperature" SILA-MIB::silaTempSensorName."Right_side_of_the_board_Temp" = STRING: "Right_side_of_the_board_Temp" SILA-MIB::silaTempSensorValue."BMC_Temp" = INTEGER: 22.750 °C SILA-MIB::silaTempSensorValue."Inlet_BRD_Temp" = INTEGER: 17.000 °C SILA-MIB::silaTempSensorValue."PCH___M_2_Temp" = INTEGER: 18.125 °C SILA-MIB::silaTempSensorValue."PSU1_Temperature" = INTEGER: 24.000 °C SILA-MIB::silaTempSensorValue."PSU2_Temperature" = INTEGER: 21.250 °C SILA-MIB::silaTempSensorValue."Right_side_of_the_board_Temp" = INTEGER: 22.250 °C SILA-MIB::silaTempSensorWarnLow."BMC_Temp" = INTEGER: 5.000 °C SILA-MIB::silaTempSensorWarnLow."Inlet_BRD_Temp" = INTEGER: 5.000 °C SILA-MIB::silaTempSensorWarnLow."PCH___M_2_Temp" = INTEGER: 5.000 °C SILA-MIB::silaTempSensorWarnLow."PSU1_Temperature" = INTEGER: .000 °C SILA-MIB::silaTempSensorWarnLow."PSU2_Temperature" = INTEGER: .000 °C SILA-MIB::silaTempSensorWarnLow."Right_side_of_the_board_Temp" = INTEGER: 5.000 °C SILA-MIB::silaTempSensorWarnHigh."BMC_Temp" = INTEGER: 110.000 °C SILA-MIB::silaTempSensorWarnHigh."Inlet_BRD_Temp" = INTEGER: 110.000 °C SILA-MIB::silaTempSensorWarnHigh."PCH___M_2_Temp" = INTEGER: 110.000 °C SILA-MIB::silaTempSensorWarnHigh."PSU1_Temperature" = INTEGER: 60.000 °C SILA-MIB::silaTempSensorWarnHigh."PSU2_Temperature" = INTEGER: 60.000 °C SILA-MIB::silaTempSensorWarnHigh."Right_side_of_the_board_Temp" = INTEGER: 110.000 °C SILA-MIB::silaTempSensorCritLow."BMC_Temp" = INTEGER: .000 °C SILA-MIB::silaTempSensorCritLow."Inlet_BRD_Temp" = INTEGER: .000 °C SILA-MIB::silaTempSensorCritLow."PCH___M_2_Temp" = INTEGER: -1.000 °C SILA-MIB::silaTempSensorCritLow."PSU1_Temperature" = INTEGER: .000 °C SILA-MIB::silaTempSensorCritLow."PSU2_Temperature" = INTEGER: .000 °C SILA-MIB::silaTempSensorCritLow."Right_side_of_the_board_Temp" = INTEGER: .000 °C SILA-MIB::silaTempSensorCritHigh."BMC_Temp" = INTEGER: 115.000 °C SILA-MIB::silaTempSensorCritHigh."Inlet_BRD_Temp" = INTEGER: 115.000 °C SILA-MIB::silaTempSensorCritHigh."PCH___M_2_Temp" = INTEGER: 115.000 °C SILA-MIB::silaTempSensorCritHigh."PSU1_Temperature" = INTEGER: 63.000 °C SILA-MIB::silaTempSensorCritHigh."PSU2_Temperature" = INTEGER: 63.000 °C SILA-MIB::silaTempSensorCritHigh."Right_side_of_the_board_Temp" = INTEGER: 115.000 °C SILA-MIB::silaTempSensorState."BMC_Temp" = INTEGER: normal(1) SILA-MIB::silaTempSensorState."Inlet_BRD_Temp" = INTEGER: normal(1) SILA-MIB::silaTempSensorState."PCH___M_2_Temp" = INTEGER: normal(1) SILA-MIB::silaTempSensorState."PSU1_Temperature" = INTEGER: normal(1) SILA-MIB::silaTempSensorState."PSU2_Temperature" = INTEGER: normal(1) SILA-MIB::silaTempSensorState."Right_side_of_the_board_Temp" = INTEGER: normal(1) ... ``` Get current value of a specific sensor: ``` $ snmpget -v2c -cpublic SILA-MIB::silaTempSensorValue.\"Right_side_of_the_board_Temp\" SILA-MIB::silaTempSensorValue."Right_side_of_the_board_Temp" = INTEGER: 19.125 °C ``` ### SNMPv3 support For manage SNMPv3 access in runtime required `snmpusm` and `snmpvacm` tools from `net-snmp` package. I did create the snmp user `root` with password `0penBmcAA` for control snmpd. But by default him have access only from localhost. For allowing access from other hosts, you should add/modify access rule in snmpd.conf: ```shell ... com2sec readwrite private ... ``` New user can be created over 3 steps: 1. Create copy of existen user ```shell $ snmpusm -v3 -uroot -a0penBmcAA -x0penBmcAA -lauthPriv create user01 ``` 2. Change password for new user: ```shell $ snmpusm -v3 -uroot -a0penBmcAA -x0penBmcAA -lauthPriv passwd 0penBmcAA NewPassword ``` 3. Allow for new user read our data over snmp (add user to group MyRoGroup): ```shell $ snmpvacm -v3 -uroot -a0penBmcAA -x0penBmc -lauthPriv createSec2Group 3 user01 MyRoGroup ``` All users present in `SNMP-USER-BASED-SM-MIB::usmUserTable`. ### SNMP traps For receive SNMP traps you should add receivers to snmpd.conf ```shell trap2sink ``` ## snmpcfg This is a DBus service with interface `xyz.openbmc_project.SNMPCfg` and object path `/xyz/openbmc_project/snmpcfg` for manage snmpd.conf content. There has three methods: - GetConfig - return body of actual snmpd.conf - SetConfig - replace body of snmpd.conf with specified data and restart snmpd. - ResetConfig - restore default version of snmpd.conf and restart snmpd. This subproject will be moved to separate project in fututre.