.. _snmp: .. sectnum:: :start: 12 :depth: 3 ********** SNMP ********** Clixon supports SNMP for retreiving / setting values and sending SNMPv2c traps via netsnmp using a MIB-YANG mapping defined in RFC6643. Architecture ============ .. image:: snmp.jpg :width: 100% The SNMP frontend acts as an intermediate daemon between the Net-SNMP daemon (snmpd) and the Clixon backend. Clixon-snmp communicates over the AgentX protocol to snmpd typically via a UNIX socket, and over the internal IPC protocol to the Clixon backend. Clixon-snmp implements RFC 6643 `Translation of Structure of Management Information Version 2 (SMIv2) MIB Modules to YANG Modules`. The RFC defines how a MIB is translated to YANG using extensions that define a mapping between YANG statements and SMI object IDs and types in the MIB. In principle, it is also possible to construct a MIB from YANG using the same method, although this is more limited and may involve manual work. A user can then communicate with snmpd using any of the SNMP v2/v3 tools, such as `snmpget`, `snmpwalk` and others. .. note:: * SNMP support is introduced in Clixon version 5.8 * SNMPv2 traps support is introduced in Clixon version 7.2.0 Configuration ============= Net-SNMP -------- .. note:: Use Net-SNMP version 5.9 or later To set up AgentX communication between ``clixon_snmp`` and ``snmpd`` a Unix or TCP socket is configured. This socket is also configured in Clixon (see below). An example `/etc/snmp/snmpd.conf` is as follows:: master agentx agentaddress 127.0.0.1,[::1] rwcommunity public localhost agentXSocket unix:/var/run/snmp.sock agentxperms 777 777 It is necessary to ensure snmpd does `not` to load modules implemented by Clixon. For example, if Clixon implements the IF-MIB and system MIBs, snmpd should not load those modules. This can be done using the "-I" flag and prepending a "-" before each module:: -I -ifTable -I -system_mib -I -sysORTable Further, Clixon itself does not start netsnmp itself, you need to ensure that netsnmp is running when clixon_snmp is started. Likewise, if snmpd is restarted, clixon_snmp must also be restarted. .. note:: Net-snmp must be started via systemd or some other external mechanism before clixon_snmp is started. Clixon ------ To build the snmp support, netsnmp is enabled at configure time. Two configure options are added for SNMP: * ``--enable-netsnmp`` Enable SNMP support. * ``--with-mib-generated-yang-dir`` For tests: Directory of generated YANG specs (default: $prefix/share/mibyang) Then type "make" to build the "clixon_snmp" executable and "make install" to install. clixon_snmp command line options -------------------------------- :: $ clixon_snmp -h usage:clixon_snmp where options are -h Help -V Show version and exit -D Debug level -f Configuration file (mandatory) -l (e|o|s|f) Log on std(e)rr, std(o)ut, (s)yslog(default), (f)ile -C Dump configuration options on stdout after loading and exit. Format is one of xml|json|text -z Kill other clixon_snmp daemon and exit -o "