Some more tweaks

This commit is contained in:
laf
2015-12-23 15:12:09 +00:00
parent 8b63bfad30
commit 32f5980523
2 changed files with 5 additions and 1 deletions

View File

@ -48,6 +48,10 @@ function influx_update($device,$measurement,$tags=array(),$fields) {
$tmp_fields = array();
$tmp_tags['hostname'] = $device['hostname'];
foreach ($tags as $k => $v) {
$v = preg_replace(array('/ /','/,/','/=/'),array('\ ','\,','\='), $v);
if (empty($v)) {
$v = '_blank_';
}
$tmp_tags[$k] = $v;
}
foreach ($fields as $k => $v) {

View File

@ -486,7 +486,7 @@ foreach ($ports as $port) {
$fields['ifInOctets_rate'] = $port['ifInOctets_rate'];
$fields['ifOutOctets_rate'] = $port['ifOutOctets_rate'];
$tags = array('ifName' => '"'.$port['ifName'].'"', 'ifSpeed' => '"'.$port['ifSpeed'].'"', 'port_descr_type' => '"'.$port['port_descr_type'].'"');
$tags = array('ifName' => $port['ifName'], 'port_descr_type' => $port['port_descr_type']);
influx_update($device,'ports',$tags,$fields);
// End Update IF-MIB