From: Costa Tsaousis (ktsaou) Date: Thu, 26 Jan 2017 21:28:25 +0000 (+0200) Subject: add offset to SNMP values; fixes #1654 X-Git-Tag: ab-debian_0.20170201.01-0ab1~22^2~7 X-Git-Url: https://arthur.barton.de/gitweb/?a=commitdiff_plain;h=ccc5a221ccf6579c9bb7b24b867fd1d18aeac63a;hp=afc739d9b43a3e5a9201dc6155a52eaac9816209;p=netdata.git add offset to SNMP values; fixes #1654 --- diff --git a/node.d/snmp.node.js b/node.d/snmp.node.js index 5a478937..c0974bda 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();