Comments (2)
Hi @ypzen - you can learn about table augmentation here:
https://www.rfc-editor.org/rfc/rfc2578.html#section-7.8
And I'd recommend looking in the interfaces MIB IF-MIB
at ifTable
and ifXTable
to observe how ifXTable
augments the base table ifTable
as a simple example of table augmentation.
Here's a working example of table augmentation with this library. It implements cut-down versions of ifTable
and ifXTable
, but all of the indexing information is included to fully illustrate the use of table augmentation:
const snmp = require ("net-snmp");
const snmpOptions = {
port: 1161
}
const callback = function (error, data) {
if ( error ) {
console.error (error);
} else {
console.log (JSON.stringify(data.pdu.varbinds, null, 2));
}
};
const agent = snmp.createAgent(snmpOptions, callback);
const authorizer = agent.getAuthorizer ();
authorizer.addCommunity ("public");
const baseTableProvider = {
name: "ifTable",
type: snmp.MibProviderType.Table,
oid: "1.3.6.1.2.1.2.2.1",
tableColumns: [
{
number: 1,
name: "ifIndex",
type: snmp.ObjectType.Integer,
maxAccess: snmp.MaxAccess['read-only']
},
{
number: 2,
name: "ifDescr",
type: snmp.ObjectType.OctetString,
maxAccess: snmp.MaxAccess['read-write']
}
],
tableIndex: [
{
columnName: "ifIndex"
}
]
};
agent.registerProvider (baseTableProvider);
const augmentedTableProvider = {
name: "ifXTable",
type: snmp.MibProviderType.Table,
oid: "1.3.6.1.2.1.31.1.1.1",
tableColumns: [
{
number: 1,
name: "ifName",
type: snmp.ObjectType.OctetString,
maxAccess: snmp.MaxAccess['read-write']
}
],
tableAugments: "ifTable"
}
agent.registerProvider (augmentedTableProvider);
const mib = agent.getMib ();
mib.addTableRow ("ifTable", [0, "lo"]);
mib.addTableRow ("ifTable", [2, "eth0"]);
mib.addTableRow ("ifXTable", [0, "Loopback"]);
mib.addTableRow ("ifXTable", [2, "LAN 1"]);
mib.dump ({
leavesOnly: true,
showProviders: true,
showValues: true,
showTypes: true
});
from node-net-snmp.
Hi @markabrahams
Thanks for about table augmentation ,
But i can't found solution using table augmentation for below example.
I need dynamic table tree.
root: 1.3.6.1.4.1.5333.2.3.2
first device - 1.3.6.1.4.1.5333.2.3.2.1
first detail first device - 1.3.6.1.4.1.5333.2.3.2.1.1
second detail first device - 1.3.6.1.4.1.5333.2.3.2.1.2
second device - 1.3.6.1.4.1.5333.2.3.2.2
first detail second device - 1.3.6.1.4.1.5333.2.3.2.2.1
second detail second device - 1.3.6.1.4.1.5333.2.3.2.2.2
n devices - 1.3.6.1.4.1.5333.2.3.2.n
first detail n device - 1.3.6.1.4.1.5333.2.3.2.n.1
second detail n device - 1.3.6.1.4.1.5333.2.3.2.n.2
Please suggest appropriate example for above example
from node-net-snmp.
Related Issues (20)
- Subagent Stops Processing Requests HOT 4
- Create SNMP Server and client with NodeJS HOT 2
- Calling session.close() HOT 4
- ParseInt in column number fails on 2+ whitespace characters between Object name and ID HOT 2
- Support for SMIv1 type definitions HOT 9
- `readUInt32` issues HOT 4
- Update MIB tree from existing MIB file HOT 1
- agent v3 - discovery not completed HOT 1
- Is there a way to get metric information using MIB instead of OID to external snmp agent that already exists? HOT 10
- Types and possible bug HOT 1
- session.subtree: feedCallback return value not checked (version 3.9.7) HOT 3
- Question: guidance on building a callback-driven agent HOT 3
- RequestInvalidError: Unknown type '[object Object]' in request HOT 2
- RequestFailedError: EndOfMibView: for session.table() against Agent with MIB with a single table HOT 4
- How can I assign a handler to provider loaded from MIB via registerProviders method? HOT 1
- MIBs with middle entries that do not include object name annotations fail to compile correctly HOT 3
- Incorrect OID construction for MIBs with standard object name conflicts HOT 7
- SNMP-JS
- Agentx command handler function async and error HOT 2
- Poor documentation \ overall tool state HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-net-snmp.