Node Sub-Agent on Windows

Ian C via Net-snmp-coders <[email protected]> Wed, 9 Feb 2022 17:44:00 +0000 (UTC)
Newsgroups gmane.network.net-snmp.devel
Message-ID <[email protected]>
I'm using the node net-snmp package  to create a simple subagent but I cannot query its only table provider (Error in packet... No such variable name in MIB).  I have installed net-snmp and registered it, I am able to  query simple things such as uptime:
C:\usr\etc\snmp>snmpwalk -v1 -c public 127.0.0.1  .1.3.6.1.2.1.1.3
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (306196) 0:51:01.96

So, at least I know the snmpd is running and responding.
My snmpd.conf:rwcommunity  public  
master agentx
agentXSocket tcp:localhost:705load  12 12 12
Any thoughts would be greatly appreciated.
thanksIan in Ottawa


| 
| 
| 
|  |  |

 |

 |
| 
|  | 
net-snmp

JavaScript implementation of the Simple Network Management Protocol (SNMP). Latest version: 3.5.8, last publishe...
 |

 |

 |


Test table query:C:\usr\etc\snmp>snmpget -v1 -c public 127.0.0.1 1.3.6.1.4.1.8072.9999.9999.2
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: NET-SNMP-MIB::netSnmpPlaypen.2



Js subagent:let snmp = require("net-snmp");

export class SNMPServer {  private static instance: SNMPServer;  subagent: null | any  mib: null | any  private constructor() {    this.subagent = snmp.createSubagent(suboptions);  }  public static getInstance(): SNMPServer {    if (!SNMPServer.instance) {        SNMPServer.instance = new SNMPServer();    }    return SNMPServer.instance;  }
  public openSubAgent() {    this.subagent.open( this.openCallback );  }

  openCallback = ( error: any, data: any ) => {    if ( error ) {        console.error('subagent.open() ERROR:' +error);    } else {        console.log('subagent.open() OK...'+data)        this.subagent.registerProvider (myTableProvider, registerProviderCallback);        this.mib = this.subagent.getMib();        if (this.mib != null) {            this.mib.addTableRow ("smallIfTable", [1, "IAN", 12]);            console.log("SNMP Server: SubAgent-MIB Invoked");        } else {            console.error ("Subagent Get MIB failure");        }    }  }
  public closeSubAgent() {    this.subagent.unregisterProvider(myTableProvider, ()=>{} );    this.subagent.close (() => {});  }}
// Default suboptionsvar suboptions = {    debug: true,    master: "localhost",    masterPort: 705,    timeout: 0,    description: "Node net-snmp AgentX sub-agent"};
var registerProviderCallback = function (error: any, data: any) {    if ( error ) {        console.error ('CREATE SUBAGENT ERROR '+error);    } else {        console.log ('OK SNMP CREATE SUBAGENT '+JSON.stringify(data, null, 2));    }};
var myTableProvider = {    name: "smallIfTable",    type: snmp.MibProviderType.Table,    oid: "1.3.6.1.4.1.8072.9999.9999.2",    tableColumns: [        {            number: 1,            name: "CampField1",            type: snmp.ObjectType.Integer        },        {            number: 2,            name: "CampField2",            type: snmp.ObjectType.OctetString        },        {            number: 3,            name: "CampField3",            type: snmp.ObjectType.Integer        }    ],    tableIndex: [        {            columnName: "CampField1"        }    ],    handler: function (mibRequest: any) {        console.log('MibRequest!')        // e.g. can update the table before responding to the request here        mibRequest.done();    }};

_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders