summaryrefslogtreecommitdiff
path: root/README.md
blob: a8e0f591b294e8b9beba3c56919c2a017fc2cb5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# 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://<IP-addres-of-BMC-host>/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 <IP-addres-of-BMC-host> 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  <IP-addres-of-BMC-host> 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 <IP-addres-of-BMC-host> 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  <Your host>  private
...
```

New user can be created over 3 steps:
1. Create copy of existen user
```shell
$ snmpusm -v3 -uroot -a0penBmcAA -x0penBmcAA -lauthPriv <OpenBMC-Host> create user01
```

2. Change password for new user:
```shell
$ snmpusm -v3 -uroot -a0penBmcAA -x0penBmcAA -lauthPriv <OpenBMC-Host> 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 <OpenBMC-Host> 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 <receiver-host> <receiver-community>
```

## 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.