diff --git a/includes/billing.php b/includes/billing.php index 6861b2a86a..0cfba4299a 100644 --- a/includes/billing.php +++ b/includes/billing.php @@ -66,10 +66,14 @@ function getDates($dayofmonth) { } -function getValue($host, $community, $port, $id, $inout) { +function getValue($host, $community, $snmpver, $port, $id, $inout) { global $config; $oid = "IF-MIB::ifHC" . $inout . "Octets." . $id; - $value = shell_exec($config['snmpget'] ." -m IF-MIB -c $community -v2c -O qv $host:$port $oid"); + $value = shell_exec($config['snmpget'] ." -m IF-MIB -c $community -$snmpver -O qv $host:$port $oid"); + if(!is_numeric($value)) { + $oid = "IF-MIB::if" . $inout . "Octets." . $id; + $value = shell_exec($config['snmpget'] ." -m IF-MIB -c $community -$snmpver -O qv $host:$port $oid"); + } return $value; } diff --git a/poll-billing.php b/poll-billing.php index 231d8106ed..e72a8d00e6 100644 --- a/poll-billing.php +++ b/poll-billing.php @@ -40,8 +40,8 @@ function CollectData($bill_id) { echo("\nPolling ".$port_data['ifDescr']." on ".$port_data['hostname']."\n"); - $port_in_measurement = trim(getValue($host, $port_data['community'], $port, $port_data['ifIndex'], "In")); - $port_out_measurement = trim(getValue($host, $port_data['community'], $port, $port_data['ifIndex'], "Out")); + $port_in_measurement = trim(getValue($host, $port_data['community'], $port_data['snmpver'], $port, $port_data['ifIndex'], "In")); + $port_out_measurement = trim(getValue($host, $port_data['community'], $port_data['snmpver'], $port, $port_data['ifIndex'], "Out")); echo("$port_in_measurement and $port_out_measurement \n");