How to use the net-snmp.isVarbindError function in net-snmp

To help you get started, we’ve selected a few net-snmp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-red / node-red-nodes / io / snmp / snmp.js View on Github external
getSession(host, community, node.version, node.timeout).set(varbinds, function (error, varbinds) {
                    if (error) {
                        node.error(error.toString(), msg);
                    }
                    else {
                        for (var i = 0; i < varbinds.length; i++) {
                            // for version 2c we must check each OID for an error condition
                            if (snmp.isVarbindError(varbinds[i])) {
                                node.error(snmp.varbindError(varbinds[i]), msg);
                            }
                        }
                    }
                });
            }
github netdata / netdata / collectors / node.d.plugin / snmp / snmp.node.js View on Github external
service.error('Received error = ' + netdata.stringify(error) + ' varbinds = ' + netdata.stringify(varbinds));

                // make all values null
                var len = slice.length;
                while(len--)
                    service.snmp_oids_index[slice[len]].value = null;
            }
            else {
                if(__DEBUG === true)
                    netdata.debug(service.module.name + ': ' + service.name + ': got valid ' + service.module.name + ' response: ' + netdata.stringify(varbinds));

                var varbinds_len = varbinds.length;
                for(var i = 0; i < varbinds_len ; i++) {
                    var value = null;

                    if(net_snmp.isVarbindError(varbinds[i])) {
                        if(__DEBUG === true)
                            netdata.debug(service.module.name + ': ' + service.name + ': failed ' + service.module.name + ' get for OIDs ' + varbinds[i].oid);

                        service.error('OID ' + varbinds[i].oid + ' gave error: ' + net_snmp.varbindError(varbinds[i]));
                        value = null;
                        failed++;
                    }
                    else {
                        // test fom Counter64
                        // varbinds[i].type = net_snmp.ObjectType.Counter64;
                        // varbinds[i].value = new Buffer([0x34, 0x49, 0x2e, 0xdc, 0xd1]);

                        switch(varbinds[i].type) {
                            case net_snmp.ObjectType.OctetString:
                                if (service.snmp_oids_index[varbinds[i].oid].type !== 'title' && service.snmp_oids_index[varbinds[i].oid].type !== 'name') {
                                    // parse floating point values, exposed as strings
github glenmurphy / route / modules / snmp_dev / snmp.js View on Github external
this.session.get (oids, function (error, varbinds) {
    if (error) {
        console.error (error);
    } else {
      for (var i = 0; i < varbinds.length; i++) {
        if (snmp.isVarbindError(varbinds[i])) {
          console.error (snmp.varbindError (varbinds[i]));         
        } else {
          console.log (varbinds[i].oid + " = " + varbinds[i].value);          
        }
      }
    }
  });

net-snmp

JavaScript implementation of the Simple Network Management Protocol (SNMP)

MIT
Latest version published 30 days ago

Package Health Score

73 / 100
Full package analysis