Skip to content

use SNMPjs in react native #256

@PantTushar

Description

@PantTushar

This is not an issue but an ask, has anyone tried using the snmpjs in react native and render it for android or ios devices?. I tried it doing it but facing a issue - following is the code snippet

import snmp from 'net-snmp';
//====================================== net-snmp
const session = snmp.createSession('10.20.27.221', 'public', 161);

const oids = ['1.3.6.1.2.1.1.5.0', '1.3.6.1.2.1.1.6.0'];

 session.get(oids, (error, varbinds) => {
    if (error) {
        console.error(error);
    } else {
            console.log(varbinds[0].value);
      }
});
session.trap(snmp.TrapType.LinkDown, (error) => {
    if (error) {
        console.error(error);
    }
});

When I try to execute the above code i get the following error on android simulator
The

The development server returned response error code: 500

URL: http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false

Body:
{"from":"/Users/Documents/projects/auth/node_modules/net-snmp/index.js","to":"dgram","message":"Unable to resolve module dgram from /Users/Documents/projects/auth/node_modules/net-snmp/index.js: Module does not exist in the module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: watchman watch-del-all.\n 2. Delete the node_modules folder: rm -rf node_modules && npm install.\n 3. Reset packager cache: rm -fr $TMPDIR/react-* or npm start -- --reset-cache.","name":"UnableToResolveError","type":"UnableToResolveError","errors":[{}]}
processBundleResult
BundleDownloader.java:225
access$100
BundleDownloader.java:40
onResponse
BundleDownloader.java:192
execute
RealCall.java:135
run
NamedRunnable.java:32
runWorker
ThreadPoolExecutor.java:1162
run
ThreadPoolExecutor.java:636
run
Thread.java:764

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions