Configure SNMPv3 on LANCOM GS-3xxx Switches

With the following Add-in script you can configure SNMPv3 on LANCOM Switches of the GS-3xxx series.

List of used variables:

VariableDescription




 Add-in code:

/**
 * @param {Config} config
 * @param {Context} context
 * Do not edit this comment or parameter types. Required for code suggestions
*/
exports.main = function (config, context) {
    config.addScriptLine( "enable" );
    config.addScriptLine( "configure" );
    //Activate SNMP
    config.addScriptLine( "snmp-server" );
    //Create SNMPv3User
    config.addScriptLine( "snmp-server user USERNAME sha PASSWORD priv aes PASSWORD" ); // USERNAME = SNMP Username ;  PASSWORD = Password of Choice
    //Create SNMPv3Group
    config.addScriptLine( "snmp-server security-to-group model v3 name USERNAME group GROUPNAME" ); // USERNAME = SNMP Username; GROUPNAME = SNMP Group Name
    //Create SNMPv3View
    config.addScriptLine( "snmp-server view VIEWNAME OID VIEWTYPE " ); // VIEWNAME = Name of SNMP VIEW ; OID = OID Subtree (e.g. .1 for all) ; VIEWTYPE = included or excluded
    //Create SNMPv3Access
    config.addScriptLine( "snmp-server access GROUPNAME model v3 level priv read VIEWNAME write VIEWNAME" ); // GROUPNAME = SNMP Group Name ; VIEWNAME = Name of SNMP VIEW





    //SNMPv3 Traps
    // Trap Host
    config.addScriptLine( "snmp-server host USERNAME" ); // USERNAME = SNMP Username
    config.addScriptLine( "trapmode udp" );
    config.addScriptLine( "version v3 engineID EngineID USERNAME" ); // EngineID = 80000934800500+DEVICEMAC ; USERNAME = SNMP Username
    config.addScriptLine( "host IPAddress" ); // IPAddress = IP Address of Switch  
    config.addScriptLine( "exit" );

    // Trap Events
    config.addScriptLine( "event group Cold-Start trap enable" );
    config.addScriptLine( "event group Warm-Start trap enable" );
    config.addScriptLine( "event group Link-Status trap enable" );
    config.addScriptLine( "event group Login trap enable" );
    config.addScriptLine( "event group Logout trap enable" );
    config.addScriptLine( "event group Auth-Failed trap enable" );
    config.addScriptLine( "event group Password-Change trap enable" );
    config.addScriptLine( "event group Mgmt-IP-Change trap enable" );
    config.addScriptLine( "event group Module-Change trap enable" );
    config.addScriptLine( "event group LACP trap enable" );
    config.addScriptLine( "event group NAS trap enable" );
    config.addScriptLine( "event group Config-Info trap enable" );
    config.addScriptLine( "event group Firmware-Upgrade trap enable" );
    config.addScriptLine( "event group Import-Export trap enable" );
    config.addScriptLine( "event group Port-Security trap enable" );
    config.addScriptLine( "event group Access-Mgmt trap enable" );
    config.addScriptLine( "event group ACL trap enable" );
    config.addScriptLine( "event group ACL-Log trap enable" );
    config.addScriptLine( "event group Loop-Protect trap enable" );
    config.addScriptLine( "event group FAN trap enable" );
    config.addScriptLine( "event group Voltage trap enable" );
    config.addScriptLine( "event group Temperature trap enable" );
    config.addScriptLine( "event group Spanning-Tree trap enable" );
    config.addScriptLine( "event group NTP-Sync trap enable" );

    config.addScriptLine( "exit" );

};

Add-in as JSON file:

GS-3XXX-SNMPv3.json