TritonDataCenter / node-snmpjs

SNMP toolkit for Node.js
112 stars 60 forks source link

dynamic OID creation #261

Open ghost opened 5 years ago

ghost commented 5 years ago

Hello!

I'd like dynamic OID creation In my project. For this I need get OID from request before doing agent.request() in code.

This option is not described in the documentation.

How I can get OID before processing client request?

jaksonxavier commented 4 years ago
for (let x in handle.data) {
    mib.push({
        oid: handle.data[x].oid,
        handler: function(pqr) {
            let val = snmp.data.createData({
                type: 'OctetString',
                value: String(handle.data[x].value)
            });
            snmp.provider.readOnlyScalar(pqr, val);
        }
    });
    agent.request(mib);
}