diff options
author | Dylan Wang <goncc123rr@gmail.com> | 2018-10-30 04:49:06 +0800 |
---|---|---|
committer | Costa Tsaousis <costa@tsaousis.gr> | 2018-10-29 22:49:06 +0200 |
commit | a35bd00fbf8f2578ec0c660b532e925911191b43 (patch) | |
tree | 572b04b81509cc5922c0d1fda84276eccd5bca7a /collectors/node.d.plugin | |
parent | 6cb109fbde0bebf796c36281cb5d6dac1dc36634 (diff) |
fix parse oidname and santilize dimension name (#4498)
Diffstat (limited to 'collectors/node.d.plugin')
-rw-r--r-- | collectors/node.d.plugin/snmp/snmp.node.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/collectors/node.d.plugin/snmp/snmp.node.js b/collectors/node.d.plugin/snmp/snmp.node.js index 62d2d277d5..a051d3d3ad 100644 --- a/collectors/node.d.plugin/snmp/snmp.node.js +++ b/collectors/node.d.plugin/snmp/snmp.node.js @@ -171,7 +171,7 @@ netdata.processors.snmp = { var oid = this.fixoid(dim.oid); var oidname = this.fixoid(dim.oidname); - + if(__DEBUG === true) netdata.debug(service.module.name + ': ' + service.name + ': indexing ' + this.name + ' chart: ' + c + ', dimension: ' + d + ', OID: ' + oid + ", OID name: " + oidname); @@ -276,7 +276,7 @@ netdata.processors.snmp = { switch(varbinds[i].type) { case net_snmp.ObjectType.OctetString: - if(service.snmp_oids_index[varbinds[i].oid].type !== 'title') { + if (service.snmp_oids_index[varbinds[i].oid].type !== 'title' && service.snmp_oids_index[varbinds[i].oid].type !== 'name') { // parse floating point values, exposed as strings value = parseFloat(varbinds[i].value) * 1000; 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)"); @@ -309,7 +309,7 @@ netdata.processors.snmp = { if(value !== null) { switch(service.snmp_oids_index[varbinds[i].oid].type) { case 'title': service.snmp_oids_index[varbinds[i].oid].link.title += ' ' + value; break; - case 'name' : service.snmp_oids_index[varbinds[i].oid].link.name = value; break; + case 'name' : service.snmp_oids_index[varbinds[i].oid].link.name = value.toString().replace(/\W/g, '_'); break; case 'value': service.snmp_oids_index[varbinds[i].oid].link.value = value; break; } } @@ -448,7 +448,7 @@ var snmp = { var id = c + from.toString(); var chart = extend(true, {}, service_request_chart); chart.title += from.toString(); - + if(typeof chart.titleoid !== 'undefined') chart.titleoid += from.toString(); |