summaryrefslogtreecommitdiffstats
path: root/node.d
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2017-01-26 23:28:25 +0200
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2017-01-26 23:28:25 +0200
commitccc5a221ccf6579c9bb7b24b867fd1d18aeac63a (patch)
tree10cc8cd26c18bc74507cb7f6844f4d5eda7a9e19 /node.d
parentafc739d9b43a3e5a9201dc6155a52eaac9816209 (diff)
add offset to SNMP values; fixes #1654
Diffstat (limited to 'node.d')
-rw-r--r--node.d/snmp.node.js29
1 files changed, 20 insertions, 9 deletions
diff --git a/node.d/snmp.node.js b/node.d/snmp.node.js
index 5a478937e9..c0974bda6d 100644
--- a/node.d/snmp.node.js
+++ b/node.d/snmp.node.js
@@ -1,6 +1,7 @@
'use strict';
-
+// netdata snmp module
// This program will connect to one or more SNMP Agents
+//
// example configuration in /etc/netdata/node.d/snmp.conf
/*
@@ -26,13 +27,15 @@
"oid": ".1.3.6.1.2.1.2.2.1.10.1",
"algorithm": "incremental",
"multiplier": 8,
- "divisor": 1024
+ "divisor": 1024,
+ "offset": 0
},
"out": {
"oid": ".1.3.6.1.2.1.2.2.1.16.1",
"algorithm": "incremental",
"multiplier": -8,
- "divisor": 1024
+ "divisor": 1024,
+ "offset": 0
}
}
},
@@ -46,13 +49,15 @@
"oid": ".1.3.6.1.2.1.2.2.1.10.2",
"algorithm": "incremental",
"multiplier": 8,
- "divisor": 1024
+ "divisor": 1024,
+ "offset": 0
},
"out": {
"oid": ".1.3.6.1.2.1.2.2.1.16.2",
"algorithm": "incremental",
"multiplier": -8,
- "divisor": 1024
+ "divisor": 1024,
+ "offset": 0
}
}
}
@@ -89,13 +94,15 @@
"oid": ".1.3.6.1.2.1.2.2.1.10.",
"algorithm": "incremental",
"multiplier": 8,
- "divisor": 1024
+ "divisor": 1024,
+ "offset": 0
},
"out": {
"oid": ".1.3.6.1.2.1.2.2.1.16.",
"algorithm": "incremental",
"multiplier": -8,
- "divisor": 1024
+ "divisor": 1024,
+ "offset": 0
}
}
}
@@ -360,8 +367,12 @@ var snmp = {
for(var j = 0; j < dim_keys_len ; j++) {
var d = dim_keys[j];
- if (dimensions[d].value !== null)
- service.set(d, dimensions[d].value);
+ if (dimensions[d].value !== null) {
+ if(typeof dimensions[d].offset === 'number')
+ service.set(d, dimensions[d].value + dimensions[d].offset);
+ else
+ service.set(d, dimensions[d].value);
+ }
}
service.end();