summaryrefslogtreecommitdiffstats
path: root/node.d/snmp.node.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--node.d/snmp.node.js31
1 files changed, 21 insertions, 10 deletions
diff --git a/node.d/snmp.node.js b/node.d/snmp.node.js
index 5a478937e..57b37ffa0 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
}
}
}
@@ -265,7 +272,7 @@ netdata.processors.snmp = {
if(__DEBUG === true)
netdata.debug(service.module.name + ': ' + service.name + ': found ' + service.module.name + ' value of OIDs ' + varbinds[i].oid + " = " + varbinds[i].value);
- if(varbinds[i].type === net_snmp.ObjectType.OctetString)
+ if(varbinds[i].type === net_snmp.ObjectType.OctetString && service.snmp_oids_index[varbinds[i].oid].type !== 'title')
value = parseFloat(varbinds[i].value) * 1000;
else
value = varbinds[i].value;
@@ -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();