From 4fc6629f00b5fc30b56be46c99f6af02ad804945 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Mon, 21 Jun 2010 04:28:37 +0000 Subject: [PATCH] billing bugfix :) git-svn-id: http://www.observium.org/svn/observer/trunk@1228 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/billing.php | 8 ++++++-- poll-billing.php | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/billing.php b/includes/billing.php index 6861b2a86..0cfba4299 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 231d8106e..e72a8d00e 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");