git-svn-id: http://www.observium.org/svn/observer/trunk@1817 61d68cd4-352d-0410-923a-c4978735b2b8

This commit is contained in:
Tom Laermans
2011-03-10 16:00:37 +00:00
parent fbd4ccaa62
commit b1d60eafd0
3 changed files with 13 additions and 10 deletions

View File

@@ -192,8 +192,9 @@
/// Update RRDs
$rrdfile = $host_rrd . "/port-" . safename($port['ifIndex'] . ".rrd");
if(!is_file($rrdfile)) {
$woo = shell_exec($config['rrdtool'] . " create $rrdfile -s 300 \
if(!is_file($rrdfile))
{
rrdtool_create($rrdfile," --step 300 \
DS:INOCTETS:DERIVE:600:0:12500000000 \
DS:OUTOCTETS:DERIVE:600:0:12500000000 \
DS:INERRORS:DERIVE:600:0:12500000000 \

View File

@@ -124,12 +124,8 @@
RRA:MAX:0.5:24:800 \
RRA:MAX:0.5:288:800";
$mem_cmd = $config['snmpget'] . " -M ".$config['mibdir']. " -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$mem_cmd .= " memTotalSwap.0 memAvailSwap.0 memTotalReal.0 memAvailReal.0 memTotalFree.0 memShared.0 memBuffer.0 memCached.0";
$mem_raw = shell_exec($mem_cmd);
list($memTotalSwap, $memAvailSwap, $memTotalReal, $memAvailReal, $memTotalFree, $memShared, $memBuffer, $memCached) = explode("\n", str_replace(" kB", "", $mem_raw));
$mem_raw = snmp_get_multi($device, "memTotalSwap.0 memAvailSwap.0 memTotalReal.0 memAvailReal.0 memTotalFree.0 memShared.0 memBuffer.0 memCached.0", "-OQUS", "UCD-SNMP-MIB");
list($memTotalSwap, $memAvailSwap, $memTotalReal, $memAvailReal, $memTotalFree, $memShared, $memBuffer, $memCached) = $mem_raw;
## Check to see that the OIDs are actually populated before we make the rrd
if(is_numeric($memTotalReal) && is_numeric($memAvailReal) && is_numeric($memTotalFree))
@@ -164,8 +160,8 @@
RRA:MAX:0.5:288:800";
$load_get = "laLoadInt.1 laLoadInt.2 laLoadInt.3";
$load_raw = snmp_get($device, $load_get, "-Oqv", "UCD-SNMP-MIB");
list ($load1, $load5, $load10) = explode ("\n", $load_raw);
$load_raw = snmp_get_multi($device, $load_get, "-OQUs", "UCD-SNMP-MIB");
list ($load1, $load5, $load10) = $load_raw;
## Check to see that the OIDs are actually populated before we make the rrd
if(is_numeric($load1) && is_numeric($load5) && is_numeric($load10))

View File

@@ -71,6 +71,12 @@ function snmp_get($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
if (is_numeric($device['timeout'])) { $timeout = $device['timeout']; } elseif (isset($config['snmp']['timeout'])) { $timeout = $config['snmp']['timeout']; }
if (is_numeric($device['retries'])) { $retries = $device['retries']; } elseif (isset($config['snmp']['retries'])) { $retries = $config['snmp']['retries']; }
if (strstr($oid,' '))
{
echo "BUG: snmp_get called for multiple OIDs: $oid\n";
echo "Please report this to the Observium team.";
}
if ($config['snmp']['internal'] == true)
{