switched snmp to passing 64 bit counters as strings; #2362
Costa Tsaousis (ktsaou) committed
Aug 27, 2017 at 02:35 UTC
73cf58f0d3bca70203c89090690a7cc9e322df25
2 files changed
+7
-11
node.d/node_modules/netdata.js
+2
-6
@@ -364,12 +364,8 @@ var netdata = {
364
if(typeof value === 'undefined' || value === null)
365
return false;
366
367
- if(this._current_chart._dimensions_count !== 0) {
368
- if (value instanceof Buffer)
369
- this.queue('SET ' + dimension + ' = 0x' + value.toString('hex'));
370
- else
371
- this.queue('SET ' + dimension + ' = ' + value.toString());
372
- }
367
+ if(this._current_chart._dimensions_count !== 0)
368
+ this.queue('SET ' + dimension + ' = ' + value.toString());
369
370
return true;
371
};
node.d/snmp.node.js
+5
-5
@@ -278,17 +278,17 @@ netdata.processors.snmp = {
278
if(service.snmp_oids_index[varbinds[i].oid].type !== 'title')
279
// parse floating point values, exposed as strings
280
value = parseFloat(varbinds[i].value) * 1000;
281
- if(__DEBUG === true) netdata.debug(service.module.name + ': ' + service.name + ': found ' + service.module.name + ' value of OIDs ' + varbinds[i].oid + ", ObjectType " + net_snmp.ObjectType[varbinds[i].type] + " (" + netdata.stringify(varbinds[i].type) + "), typeof(" + typeof(varbinds[i].value) + "), in JSON: " + netdata.stringify(varbinds[i].value) + ", value = '" + varbinds[i].value.toString() + "' (parsed as float in string)");
281
+ if(__DEBUG === true) netdata.debug(service.module.name + ': ' + service.name + ': found ' + service.module.name + ' value of OIDs ' + varbinds[i].oid + ", ObjectType " + net_snmp.ObjectType[varbinds[i].type] + " (" + netdata.stringify(varbinds[i].type) + "), typeof(" + typeof(varbinds[i].value) + "), in JSON: " + netdata.stringify(varbinds[i].value) + ", value = " + value.toString() + " (parsed as float in string)");
282
else
283
// just use the string
284
value = varbinds[i].value;
285
- if(__DEBUG === true) netdata.debug(service.module.name + ': ' + service.name + ': found ' + service.module.name + ' value of OIDs ' + varbinds[i].oid + ", ObjectType " + net_snmp.ObjectType[varbinds[i].type] + " (" + netdata.stringify(varbinds[i].type) + "), typeof(" + typeof(varbinds[i].value) + "), in JSON: " + netdata.stringify(varbinds[i].value) + ", value = '" + varbinds[i].value.toString() + "' (parsed as string)");
285
+ if(__DEBUG === true) netdata.debug(service.module.name + ': ' + service.name + ': found ' + service.module.name + ' value of OIDs ' + varbinds[i].oid + ", ObjectType " + net_snmp.ObjectType[varbinds[i].type] + " (" + netdata.stringify(varbinds[i].type) + "), typeof(" + typeof(varbinds[i].value) + "), in JSON: " + netdata.stringify(varbinds[i].value) + ", value = " + value.toString() + " (parsed as string)");
286
break;
287
288
case net_snmp.ObjectType.Counter64:
289
// copy the buffer
290
- value = new Buffer.from(varbinds[i].value);
291
- if(__DEBUG === true) netdata.debug(service.module.name + ': ' + service.name + ': found ' + service.module.name + ' value of OIDs ' + varbinds[i].oid + ", ObjectType " + net_snmp.ObjectType[varbinds[i].type] + " (" + netdata.stringify(varbinds[i].type) + "), typeof(" + typeof(varbinds[i].value) + "), in JSON: " + netdata.stringify(varbinds[i].value) + ", value = '0x" + varbinds[i].value.toString('hex') + "' (parsed as buffer)");
290
+ value = '0x' + varbinds[i].value.toString('hex');
291
+ if(__DEBUG === true) netdata.debug(service.module.name + ': ' + service.name + ': found ' + service.module.name + ' value of OIDs ' + varbinds[i].oid + ", ObjectType " + net_snmp.ObjectType[varbinds[i].type] + " (" + netdata.stringify(varbinds[i].type) + "), typeof(" + typeof(varbinds[i].value) + "), in JSON: " + netdata.stringify(varbinds[i].value) + ", value = " + value.toString() + " (parsed as buffer)");
292
break;
293
294
case net_snmp.ObjectType.Integer:
@@ -296,7 +296,7 @@ netdata.processors.snmp = {
296
case net_snmp.ObjectType.Gauge:
297
default:
298
value = varbinds[i].value;
299
- if(__DEBUG === true) netdata.debug(service.module.name + ': ' + service.name + ': found ' + service.module.name + ' value of OIDs ' + varbinds[i].oid + ", ObjectType " + net_snmp.ObjectType[varbinds[i].type] + " (" + netdata.stringify(varbinds[i].type) + "), typeof(" + typeof(varbinds[i].value) + "), in JSON: " + netdata.stringify(varbinds[i].value) + ", value = '" + varbinds[i].value.toString() + "' (parsed as number)");
299
+ if(__DEBUG === true) netdata.debug(service.module.name + ': ' + service.name + ': found ' + service.module.name + ' value of OIDs ' + varbinds[i].oid + ", ObjectType " + net_snmp.ObjectType[varbinds[i].type] + " (" + netdata.stringify(varbinds[i].type) + "), typeof(" + typeof(varbinds[i].value) + "), in JSON: " + netdata.stringify(varbinds[i].value) + ", value = " + value.toString() + " (parsed as number)");
300
break;
301
}
302