xref: /openbmc/phosphor-snmp/docs/snmp-configuration.md (revision e338b32331da34ba7a62c193e8da704acbb304f6)
1595a38f2SRatan Gupta# SNMP trap
2595a38f2SRatan Gupta
3*e338b323SPatrick Williams## Overview
4*e338b323SPatrick Williams
5595a38f2SRatan Guptaphosphor-snmp currently only supports sending traps for error log entries.
6595a38f2SRatan GuptaEnabling that for a system can be done by adding phosphor-dbus-monitor rules.
7595a38f2SRatan Gupta
8595a38f2SRatan GuptaThere are a couple of ways through which the user can configure the Dbus-monitor
9595a38f2SRatan Guptato generate the SNMP trap.
10595a38f2SRatan Gupta
11cab8c536SPatrick Williams- Interface added signal on the D-Bus object.
12cab8c536SPatrick Williams- Properties changed signal on the D-Bus object.
13595a38f2SRatan Gupta
14595a38f2SRatan GuptaOther OpenBMC applications can still send the SNMP trap as needed. These
15595a38f2SRatan Guptaapplications must use the API exposed by the libsnmp.
16595a38f2SRatan Gupta
17595a38f2SRatan GuptaUsers need to add the notification object in the MIB and then application can
18595a38f2SRatan Guptacall the library function.
19595a38f2SRatan Gupta
20595a38f2SRatan GuptaThe OpenBMC Notification management information base (MIB) extension can be
21*e338b323SPatrick Williamsfound at the following [location][MIB]. It defines the object descriptions
22*e338b323SPatrick Williamsneeded for a management application to be notified of an error entry in the
23*e338b323SPatrick WilliamsOpenBMC log.
24595a38f2SRatan Gupta
25*e338b323SPatrick Williams[MIB]: https://github.com/openbmc/phosphor-snmp/tree/master/mibs
26595a38f2SRatan Gupta
27595a38f2SRatan GuptaThe phosphor-snmp repository exposes the following lib and the D-Bus service
28595a38f2SRatan Gupta
29cab8c536SPatrick Williamslibsnmp: Exposes the API to send the SNMP trap phosphor-network-snmpconf: Used
30cab8c536SPatrick Williamsfor configuring the SNMP manager(Client).
31595a38f2SRatan Gupta
32*e338b323SPatrick Williams## SNMP Manager Configuration
33595a38f2SRatan Gupta
34595a38f2SRatan GuptaThe administrator can configure one or more SNMP managers to receive the OpenBMC
35595a38f2SRatan Guptatraps.
36595a38f2SRatan Gupta
37*e338b323SPatrick Williams### Add the SNMP Manager
38595a38f2SRatan Gupta
39*e338b323SPatrick Williams#### Add via REST
40595a38f2SRatan Gupta
41cab8c536SPatrick Williams`curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d '{"data": ["<snmp manager ip>", <port>] }' https://<hostname/ip>/xyz/openbmc_project/network/snmp/manager/action/Client`
42595a38f2SRatan Gupta
43*e338b323SPatrick Williams#### Add with busctl
44595a38f2SRatan Gupta
45cab8c536SPatrick Williams`busctl call xyz.openbmc_project.Network.SNMP /xyz/openbmc_project/network/snmp/manager xyz.openbmc_project.Network.Client.Create Client sqs "<snmp manager ip>" <port>`
46595a38f2SRatan Gupta
47*e338b323SPatrick Williams### Delete the SNMP Manager
48595a38f2SRatan Gupta
49*e338b323SPatrick Williams#### Delete via REST
50595a38f2SRatan Gupta
51cab8c536SPatrick Williams`curl -c cjar -b cjar -k -H "Content-Type: application/json" -X DELETE https://<hostname/ip>/xyz/openbmc_project/network/snmp/manager/<id>`
52595a38f2SRatan Gupta
53*e338b323SPatrick Williams#### Delete with busctl
54595a38f2SRatan Gupta
55cab8c536SPatrick Williams`busctl call xyz.openbmc_project.Network.SNMP /xyz/openbmc_project/network/snmp/manager/<id> xyz.openbmc_project.Object.Delete Delete`
56