From 0f4556fc2343dc0ade0bb1e0d1fc6f85770d77af Mon Sep 17 00:00:00 2001 From: "Andrey V.Kosteltsev" Date: Fri, 15 Jul 2022 10:36:51 +0300 Subject: First commit: Sila SNMP Sub Agent and configuration manager --- README.md | 230 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..e950a2a --- /dev/null +++ b/README.md @@ -0,0 +1,230 @@ +# 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 +$ wget 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) + | + +--silaSensors(1) + | | + | +-- -R-- EnumVal silaHostPowerState(1) + | | Values: unknown(-1), off(0), on(1) + | | + | +--silaTempSensorsTable(2) + | | | + | | +--silaTempSensorsEntry(1) + | | | Index: silaTempSensorName + | | | + | | +-- ---- 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 + | | | + | | +-- ---- 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 + | | + | +-- ---- 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) + | + +--silaConformance(2) + | + +--silaCompliances(1) + | | + | +--silaCommpliance(1) + | + +--silaGroups(2) + | + +--silaScalarFieldsGroup(1) + +--silaTempSensorsTableGroup(2) + +--silaVoltSensorsTableGroup(3) + +--silaTachSensorsTableGroup(4) + +--silaNotificationsGroup(10) +``` + +Content of tables may be viewed by command `snmptable`: +```shell +$ snmptable -v2c -cpublic -Ci manzoni.dev.sila.com SILA-MIB::silaTempSensorsTable +SNMP table: SILA-MIB::silaTempSensorsTable + + index silaTempSensorValue silaTempSensorWarnLow silaTempSensorWarnHigh silaTempSensorCritLow silaTempSensorCritHigh silaTempSensorState + "ambient" 27.000 °C .000 °C 35.000 °C .000 °C 40.000 °C normal + "RTC_temp1" 21.000 °C .000 °C 35.000 °C .000 °C 40.000 °C normal + "INlet_Temp1" 21.000 °C .000 °C 35.000 °C .000 °C 40.000 °C normal + "INlet_Temp2" 20.500 °C .000 °C 35.000 °C .000 °C 40.000 °C normal +"OUTlet_Temp1" 21.500 °C .000 °C 35.000 °C .000 °C 40.000 °C normal +"OUTlet_Temp2" 22.000 °C .000 °C 35.000 °C .000 °C 40.000 °C normal +... +``` + +All exporting data may be viewed by command `snmpwalk`: +```shell +$ snmpwalk -v2c -cpublic manzoni.dev.sila.com SILA-MIB::silaTempSensorsTable +SILA-MIB::silaTempSensorValue."ambient" = INTEGER: 26.750 °C +SILA-MIB::silaTempSensorValue."RTC_temp1" = INTEGER: 20.750 °C +SILA-MIB::silaTempSensorValue."INlet_Temp1" = INTEGER: 21.500 °C +SILA-MIB::silaTempSensorValue."INlet_Temp2" = INTEGER: 20.500 °C +SILA-MIB::silaTempSensorValue."OUTlet_Temp1" = INTEGER: 22.000 °C +SILA-MIB::silaTempSensorValue."OUTlet_Temp2" = INTEGER: 22.000 °C +SILA-MIB::silaTempSensorWarnLow."ambient" = INTEGER: .000 °C +SILA-MIB::silaTempSensorWarnLow."RTC_temp1" = INTEGER: .000 °C +SILA-MIB::silaTempSensorWarnLow."INlet_Temp1" = INTEGER: .000 °C +SILA-MIB::silaTempSensorWarnLow."INlet_Temp2" = INTEGER: .000 °C +SILA-MIB::silaTempSensorWarnLow."OUTlet_Temp1" = INTEGER: .000 °C +SILA-MIB::silaTempSensorWarnLow."OUTlet_Temp2" = INTEGER: .000 °C +SILA-MIB::silaTempSensorWarnHigh."ambient" = INTEGER: 35.000 °C +SILA-MIB::silaTempSensorWarnHigh."RTC_temp1" = INTEGER: 35.000 °C +SILA-MIB::silaTempSensorWarnHigh."INlet_Temp1" = INTEGER: 35.000 °C +SILA-MIB::silaTempSensorWarnHigh."INlet_Temp2" = INTEGER: 35.000 °C +SILA-MIB::silaTempSensorWarnHigh."OUTlet_Temp1" = INTEGER: 35.000 °C +SILA-MIB::silaTempSensorWarnHigh."OUTlet_Temp2" = INTEGER: 35.000 °C +SILA-MIB::silaTempSensorCritLow."ambient" = INTEGER: .000 °C +SILA-MIB::silaTempSensorCritLow."RTC_temp1" = INTEGER: .000 °C +SILA-MIB::silaTempSensorCritLow."INlet_Temp1" = INTEGER: .000 °C +SILA-MIB::silaTempSensorCritLow."INlet_Temp2" = INTEGER: .000 °C +SILA-MIB::silaTempSensorCritLow."OUTlet_Temp1" = INTEGER: .000 °C +SILA-MIB::silaTempSensorCritLow."OUTlet_Temp2" = INTEGER: .000 °C +SILA-MIB::silaTempSensorCritHigh."ambient" = INTEGER: 40.000 °C +SILA-MIB::silaTempSensorCritHigh."RTC_temp1" = INTEGER: 40.000 °C +SILA-MIB::silaTempSensorCritHigh."INlet_Temp1" = INTEGER: 40.000 °C +SILA-MIB::silaTempSensorCritHigh."INlet_Temp2" = INTEGER: 40.000 °C +SILA-MIB::silaTempSensorCritHigh."OUTlet_Temp1" = INTEGER: 40.000 °C +SILA-MIB::silaTempSensorCritHigh."OUTlet_Temp2" = INTEGER: 40.000 °C +SILA-MIB::silaTempSensorState."ambient" = INTEGER: normal(1) +SILA-MIB::silaTempSensorState."RTC_temp1" = INTEGER: normal(1) +SILA-MIB::silaTempSensorState."INlet_Temp1" = INTEGER: normal(1) +SILA-MIB::silaTempSensorState."INlet_Temp2" = INTEGER: normal(1) +SILA-MIB::silaTempSensorState."OUTlet_Temp1" = INTEGER: normal(1) +SILA-MIB::silaTempSensorState."OUTlet_Temp2" = INTEGER: normal(1) +... +``` + +Get current value of a specific sensor: +``` +$ snmpget -v2c -cpublic malevich.dev.sila.com SILA-MIB::silaTempSensorValue.\"OUTlet_Temp2\" + +SILA-MIB::silaTempSensorValue."OUTlet_Temp2" = INTEGER: 29.500 °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. -- cgit v1.2.3