diff options
author | Federico Ceratto <federico.ceratto@gmail.com> | 2017-04-30 16:09:37 +0000 |
---|---|---|
committer | Federico Ceratto <federico.ceratto@gmail.com> | 2017-04-30 18:09:45 +0000 |
commit | bed7e5b6a0b9ea0ddfc76c6f77eb91df81b92521 (patch) | |
tree | 519e5945ec0db75bfb50583539caa408a5819e87 /node.d/snmp.node.js | |
parent | Temporarily disable signature checking (diff) | |
download | netdata-bed7e5b6a0b9ea0ddfc76c6f77eb91df81b92521.tar.xz netdata-bed7e5b6a0b9ea0ddfc76c6f77eb91df81b92521.zip |
New upstream version 1.6.0+dfsg
Diffstat (limited to '')
-rw-r--r-- | node.d/snmp.node.js | 31 |
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(); |