cleanups, small fixes and remove test-*php from the root

git-svn-id: http://www.observium.org/svn/observer/trunk@1998 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-03-31 10:51:02 +00:00
parent 1c524f0349
commit bb4746d4d0
23 changed files with 108 additions and 243 deletions
+1 -3
View File
@@ -188,6 +188,4 @@ function getTotal($bill_id,$datefrom,$dateto)
return($mtot);
}
$dayofmonth = date("j"); //FIXME is this used anywhere?
?>
?>
+2 -1
View File
@@ -223,4 +223,5 @@ $config['astext'][65333] = "Cymru Bogon Feed";
### What should we warn about?
$config['warn']['ifdown'] = false;
?>
?>
+1 -1
View File
@@ -64,7 +64,7 @@
mysql_query($sql);
echo(".");
} else {
$sql = "INSERT INTO `entPhysical` ( `device_id` , `entPhysicalIndex` , `entPhysicalDescr` , `entPhysicalClass` , `entPhysicalName` , `entPhysicalModelName` , `entPhysicalSerialNum` , `entPhysicalContainedIn`, `entPhysicalMfgName`, `entPhysicalParentRelPos`, `entPhysicalVendorType`, `entPhysicalHardwareRev`,`entPhysicalFirmwareRev`,`entPhysicalSoftwareRev`,`entPhysicalIsFRU`,`entPhysicalAlias`,`entPhysicalAssetID`, `ifIndex` ) ";
$sql = "INSERT INTO `entPhysical` (`device_id` , `entPhysicalIndex` , `entPhysicalDescr` , `entPhysicalClass` , `entPhysicalName` , `entPhysicalModelName` , `entPhysicalSerialNum` , `entPhysicalContainedIn`, `entPhysicalMfgName`, `entPhysicalParentRelPos`, `entPhysicalVendorType`, `entPhysicalHardwareRev`,`entPhysicalFirmwareRev`,`entPhysicalSoftwareRev`,`entPhysicalIsFRU`,`entPhysicalAlias`,`entPhysicalAssetID`, `ifIndex`) ";
$sql .= "VALUES ( '" . $device['device_id'] . "', '$entPhysicalIndex', '$entPhysicalDescr', '$entPhysicalClass', '$entPhysicalName', '$entPhysicalModelName', '$entPhysicalSerialNum', '$entPhysicalContainedIn', '$entPhysicalMfgName','$entPhysicalParentRelPos' , '$entPhysicalVendorType', '$entPhysicalHardwareRev', '$entPhysicalFirmwareRev', '$entPhysicalSoftwareRev', '$entPhysicalIsFRU', '$entPhysicalAlias', '$entPhysicalAssetID', '$ifIndex')";
mysql_query($sql);
echo("+");
+1 -1
View File
@@ -79,6 +79,6 @@ while ($row = mysql_fetch_array($data))
unset($valid_v6);
echo "\n";
echo("\n");
?>
+6 -6
View File
@@ -21,13 +21,13 @@ foreach (explode("\n", $ports) as $entry)
{
$if = trim(strtolower($ifDescr));
$nullintf = 0;
foreach ($config['bad_if'] as $bi)
{
if (strstr($if, $bi))
{
$nullintf = 1;
foreach ($config['bad_if'] as $bi)
{
if (strstr($if, $bi))
{
$nullintf = 1;
if($debug) { echo("ignored : $bi : $if"); }
}
}
}
if (is_array($config['bad_if_regexp']))
{
@@ -7,7 +7,7 @@ if ($device['os_group'] == "unix")
# FIXME snmp_walk
# ObserverNMS-style temperature
$cmd = $config['snmpwalk'] . " -M " . $config['mibdir'] . " -M " . $config['mibdir'] . " -".$device['snmpver']." -m SNMPv2-SMI -Osqn -CI -c ".$device['community']." ".$device['transport'].":".$device['hostname'].":".$device['port']." .1.3.6.1.4.1.2021.7891 | sed s/.1.3.6.1.4.1.2021.7891.// | grep '.1.1 ' | grep -v '.101.' | cut -d'.' -f 1";
if ($debug) { echo "$cmd\n"; }
if ($debug) { echo("$cmd\n"); }
$oids = shell_exec($cmd);
$oids = trim($oids);
if ($oids) echo("Observer-Style ");
+1 -1
View File
@@ -73,7 +73,7 @@ if ($device['os'] == "vmware")
mysql_query("INSERT INTO vmware_vminfo (device_id, vmwVmVMID, vmwVmDisplayName, vmwVmGuestOS, vmwVmMemSize, vmwVmCpus, vmwVmState) VALUES (" . $device["device_id"] . ", " . $oid . ", '" . mres($vmwVmDisplayName) . "', '" . mres($vmwVmGuestOS) . "', " . $vmwVmMemSize . ", " . $vmwVmCpus . ", '" . mres($vmwVmState) . "')");
echo("+");
} else {
echo ".";
echo(".");
}
/*
+2 -2
View File
@@ -30,7 +30,7 @@ while ($dbcurrent = mysql_fetch_array($current_data))
# FIXME also warn when crossing WARN level!!
if ($dbcurrent['sensor_current'] > $dbcurrent['sensor_limit_low'] && $current <= $dbcurrent['sensor_limit_low'])
{
$msg = "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . " is " . $current . "A (Limit " . $dbcurrent['sensor_limit'];
$msg = "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . " is under threshold: " . $current . "A (< " . $dbcurrent['sensor_limit'];
$msg .= "A) at " . date($config['timestamp_format']);
notify($device, "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'], $msg);
echo("Alerting for " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . "\n");
@@ -38,7 +38,7 @@ while ($dbcurrent = mysql_fetch_array($current_data))
}
else if ($dbcurrent['sensor_current'] < $dbcurrent['sensor_limit'] && $current >= $dbcurrent['sensor_limit'])
{
$msg = "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . " is " . $current . "A (Limit " . $dbcurrent['sensor_limit'];
$msg = "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . " is over threshold: " . $current . "A (> " . $dbcurrent['sensor_limit'];
$msg .= "A) at " . date($config['timestamp_format']);
notify($device, "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'], $msg);
echo("Alerting for " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . "\n");
+2 -2
View File
@@ -953,7 +953,7 @@ function array_preg_replace($array, $string)
function rewrite_adslLineType($adslLineType)
{
$adslLineTypes = array ('noChannel' => 'No Channel',
'fastOnly' => 'Fastpath',
'fastOnly' => 'Fastpath',
'interleavedOnly' => 'Interleaved',
'fastOrInterleaved' => 'Fast/Interleaved',
'fastAndInterleaved' => 'Fast+Interleaved');
@@ -969,4 +969,4 @@ function rewrite_adslLineType($adslLineType)
return($adslLineType);
}
?>
?>
+4 -4
View File
@@ -7,14 +7,13 @@ function rrdtool_update($rrdfile, $rrdupdate)
function rrdtool_create($rrdfile, $rrdupdate)
{
global $config; global $debug;
global $config, $debug;
$command = $config['rrdtool'] . " create $rrdfile $rrdupdate";
if ($debug) { echo($command."\n"); }
return shell_exec($command);
}
function rrdtool_fetch($rrdfile, $rrdupdate)
@@ -39,7 +38,7 @@ function rrdtool_lastupdate($rrdfile, $rrdupdate)
function rrdtool($command, $file, $options)
{
global $config; global $debug;
global $config, $debug;
$command = $config['rrdtool'] . " $command $file $options";
if ($config['rrdcached'])
@@ -48,7 +47,8 @@ function rrdtool($command, $file, $options)
}
if ($debug) { echo($command."\n"); }
return shell_exec($command);
}
?>
?>
+2 -3
View File
@@ -105,11 +105,10 @@ function snmp_get($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
$device['transport'] = "udp";
}
if (strstr($oid,' '))
{
echo "BUG: snmp_get called for multiple OIDs: $oid\n";
echo "Please report this to the Observium team.";
echo("BUG: snmp_get called for multiple OIDs: $oid\n");
echo("Please report this to the Observium team.");
}
if ($config['snmp']['internal'] == true)