forked from TritonDataCenter/node-snmpjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsnmpset.js
More file actions
24 lines (20 loc) · 654 Bytes
/
snmpset.js
File metadata and controls
24 lines (20 loc) · 654 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /usr/bin/env node
/*
* Copyright (c) 2015 Jan Van Buggenhout. All rights reserved.
*/
var snmp = require('./lib/index.js');
var bunyan = require('bunyan');
var util = require('util');
var client = snmp.createClient({
log: new bunyan({ name: 'snmpset', level: 'info' })
});
var ip = process.argv[2];
var community = process.argv[3];
var oid = process.argv[4];
var value = process.argv[5];
client.set(ip, community, 0, oid, snmp.data.createData({ type: 'Integer',
value: parseInt(value, 10) }), function (snmpmsg) {
// console.log(snmp.pdu.strerror(snmpmsg.pdu.error_status));
process.exitCode = snmpmsg.pdu.error_status;
client.unref();
});