diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php
index 6e8e4bb5a..29dd78286 100644
--- a/html/includes/functions.inc.php
+++ b/html/includes/functions.inc.php
@@ -2,7 +2,7 @@
function generate_device_link($device, $text=0, $linksuffix="", $start=0, $end=0)
{
- global $twoday; global $day; global $now; global $config;
+ global $twoday, $day, $now, $config;
if (!$start) { $start = $day; }
if (!$end) { $end = $now; }
@@ -56,7 +56,6 @@ function generate_device_link($device, $text=0, $linksuffix="", $start=0, $end=0
return $device['hostname'];
}
-
return $link;
}
@@ -92,8 +91,8 @@ function generate_graph_popup($graph_array)
$graph_array['from'] = $config['year'];
$content .= generate_graph_tag($graph_array);
$content .= "";
- return overlib_link($graph_array['link'], $graph, $content, NULL);
+ return overlib_link($graph_array['link'], $graph, $content, NULL);
}
function print_graph_popup($graph_array)
@@ -101,8 +100,6 @@ function print_graph_popup($graph_array)
echo(generate_graph_popup($graph_array));
}
-
-
function permissions_cache($user_id)
{
$permissions = array();
@@ -121,12 +118,13 @@ function permissions_cache($user_id)
{
$permissions['bill'][$bill['bill_id']] = 1;
}
+
return $permissions;
}
function bill_permitted($bill_id)
{
- global $_SESSION; global $permissions;
+ global $_SESSION, $permissions;
if ($_SESSION['userlevel'] >= "5") {
$allowed = TRUE;
@@ -141,7 +139,7 @@ function bill_permitted($bill_id)
function port_permitted($interface_id, $device_id = NULL)
{
- global $_SESSION; global $permissions;
+ global $_SESSION, $permissions;
if (!is_numeric($device_id)) { $device_id = get_device_id_by_interface_id($interface_id); }
@@ -161,7 +159,7 @@ function port_permitted($interface_id, $device_id = NULL)
function application_permitted($app_id, $device_id = NULL)
{
- global $_SESSION; global $permissions;
+ global $_SESSION, $permissions;
if (is_numeric($app_id))
{
if (!$device_id) { $device_id = device_by_id_cache ($app_id); }
@@ -177,12 +175,13 @@ function application_permitted($app_id, $device_id = NULL)
} else {
$allowed = FALSE;
}
+
return $allowed;
}
function device_permitted($device_id)
{
- global $_SESSION; global $permissions;
+ global $_SESSION, $permissions;
if ($_SESSION['userlevel'] >= "5")
{
@@ -212,10 +211,10 @@ function generate_graph_tag ($args)
$url .= $sep.$key."=".$arg;
$sep="&";
}
+
return "";
}
-
function print_percentage_bar ($width, $height, $percent, $left_text, $left_colour, $left_background, $right_text, $right_colour, $right_background)
{
$output = '
@@ -226,12 +225,14 @@ function print_percentage_bar ($width, $height, $percent, $left_text, $left_colo
IPMI/BMC Hostname |
- + | |||||
IPMI/BMC Username |
- + | |||||
IPMI/BMC Password |
- + | |||||
|
foreach ($config['snmp']['transports'] as $transport)
{
- echo ("");
+ echo("");
}
echo("
diff --git a/includes/billing.php b/includes/billing.php
index 8dcf6f038..45577031f 100644
--- a/includes/billing.php
+++ b/includes/billing.php
@@ -188,6 +188,4 @@ function getTotal($bill_id,$datefrom,$dateto)
return($mtot);
}
-$dayofmonth = date("j"); //FIXME is this used anywhere?
-
-?>
+?>
\ No newline at end of file
diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php
index 2ee6cedc3..0abd953f7 100644
--- a/includes/defaults.inc.php
+++ b/includes/defaults.inc.php
@@ -223,4 +223,5 @@ $config['astext'][65333] = "Cymru Bogon Feed";
### What should we warn about?
$config['warn']['ifdown'] = false;
-?>
+
+?>
\ No newline at end of file
diff --git a/includes/discovery/entity-physical.inc.php b/includes/discovery/entity-physical.inc.php
index ce2297573..0f5bf1ff0 100755
--- a/includes/discovery/entity-physical.inc.php
+++ b/includes/discovery/entity-physical.inc.php
@@ -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("+");
diff --git a/includes/discovery/ipv6-addresses.inc.php b/includes/discovery/ipv6-addresses.inc.php
index d5c150195..61e171647 100644
--- a/includes/discovery/ipv6-addresses.inc.php
+++ b/includes/discovery/ipv6-addresses.inc.php
@@ -79,6 +79,6 @@ while ($row = mysql_fetch_array($data))
unset($valid_v6);
-echo "\n";
+echo("\n");
?>
\ No newline at end of file
diff --git a/includes/discovery/ports.inc.php b/includes/discovery/ports.inc.php
index ab934432b..04cf8f750 100755
--- a/includes/discovery/ports.inc.php
+++ b/includes/discovery/ports.inc.php
@@ -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']))
{
diff --git a/includes/discovery/temperatures/observernms-custom.inc.php b/includes/discovery/temperatures/observernms-custom.inc.php
index 2508e8e6e..b226bb228 100644
--- a/includes/discovery/temperatures/observernms-custom.inc.php
+++ b/includes/discovery/temperatures/observernms-custom.inc.php
@@ -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 ");
diff --git a/includes/discovery/vmware-vminfo.inc.php b/includes/discovery/vmware-vminfo.inc.php
index a59d0523e..a954d53d2 100755
--- a/includes/discovery/vmware-vminfo.inc.php
+++ b/includes/discovery/vmware-vminfo.inc.php
@@ -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(".");
}
/*
diff --git a/includes/polling/current.inc.php b/includes/polling/current.inc.php
index bbc8c9ee6..6f17725ab 100644
--- a/includes/polling/current.inc.php
+++ b/includes/polling/current.inc.php
@@ -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");
diff --git a/includes/rewrites.php b/includes/rewrites.php
index 1a62edca0..45cfc043b 100644
--- a/includes/rewrites.php
+++ b/includes/rewrites.php
@@ -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);
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php
index 1c37b7cf4..8b73d82cf 100644
--- a/includes/rrdtool.inc.php
+++ b/includes/rrdtool.inc.php
@@ -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);
}
-?>
+?>
\ No newline at end of file
diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php
index f17639549..fcf537f3b 100644
--- a/includes/snmp.inc.php
+++ b/includes/snmp.inc.php
@@ -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)
diff --git a/scripts/distro b/scripts/distro
index f4172acea..cce3f7c61 100755
--- a/scripts/distro
+++ b/scripts/distro
@@ -7,54 +7,58 @@ MACH=`uname -m`
GetVersionFromFile()
{
- VERSION=`cat $1 | tr "\n" ' ' | sed s/.*VERSION.*=\ // `
- }
+ VERSION=`cat $1 | tr "\n" ' ' | sed s/.*VERSION.*=\ // `
+}
- if [ "${OS}" = "SunOS" ] ; then
- OS=Solaris
- ARCH=`uname -p`
- OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
- elif [ "${OS}" = "AIX" ] ; then
- OSSTR="${OS} `oslevel` (`oslevel -r`)"
- elif [ "${OS}" = "Linux" ] ; then
- KERNEL=`uname -r`
- if [ -f /etc/redhat-release ] ; then
- DIST=$(cat /etc/redhat-release | awk '{print $1}')
- if [ "${DIST}" = "CentOS" ]; then
- DIST="CentOS"
- else
- DIST="RedHat"
- fi
- PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
- REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
- elif [ -f /etc/SuSE-release ] ; then
- DIST=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
- REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
- elif [ -f /etc/mandrake-release ] ; then
- DIST='Mandrake'
- PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
- REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
- elif [ -f /etc/debian_version ] ; then
- DIST="Debian `cat /etc/debian_version`"
- REV=""
- fi
- if [ -f /etc/UnitedLinux-release ] ; then
- DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
- fi
- if [ -f /etc/lsb-release ] ; then
- LSB_DIST="`cat /etc/lsb-release | grep DISTRIB_ID | cut -d "=" -f2`"
- LSB_REV="`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d "=" -f2`"
- if [ "$LSB_DIST" != "" ] ; then
- DIST=$LSB_DIST
- REV=$LSB_REV
- fi
- fi
-# OSSTR="${OS} ${DIST} ${REV}(${PSUEDONAME} ${KERNEL} ${MACH})"
- OSSTR="${DIST} ${REV}"
- elif [ "${OS}" = "Darwin" ] ; then
- if [ -f /usr/bin/sw_vers ] ; then
- OSSTR=`/usr/bin/sw_vers|grep -v Build|sed 's/^.*:.//'| tr "\n" ' '`
- fi
- fi
- echo ${OSSTR}
+if [ "${OS}" = "SunOS" ] ; then
+ OS=Solaris
+ ARCH=`uname -p`
+ OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
+elif [ "${OS}" = "AIX" ] ; then
+ OSSTR="${OS} `oslevel` (`oslevel -r`)"
+elif [ "${OS}" = "Linux" ] ; then
+ KERNEL=`uname -r`
+ if [ -f /etc/redhat-release ] ; then
+ DIST=$(cat /etc/redhat-release | awk '{print $1}')
+ if [ "${DIST}" = "CentOS" ]; then
+ DIST="CentOS"
+ else
+ DIST="RedHat"
+ fi
+ PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
+ REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
+ elif [ -f /etc/SuSE-release ] ; then
+ DIST=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
+ REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
+ elif [ -f /etc/mandrake-release ] ; then
+ DIST='Mandrake'
+ PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
+ REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
+ elif [ -f /etc/debian_version ] ; then
+ DIST="Debian `cat /etc/debian_version`"
+ REV=""
+ fi
+
+ if [ -f /etc/UnitedLinux-release ] ; then
+ DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
+ fi
+
+ if [ -f /etc/lsb-release ] ; then
+ LSB_DIST="`cat /etc/lsb-release | grep DISTRIB_ID | cut -d "=" -f2`"
+ LSB_REV="`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d "=" -f2`"
+ if [ "$LSB_DIST" != "" ] ; then
+ DIST=$LSB_DIST
+ REV=$LSB_REV
+ fi
+ fi
+
+# OSSTR="${OS} ${DIST} ${REV}(${PSUEDONAME} ${KERNEL} ${MACH})"
+ OSSTR="${DIST} ${REV}"
+elif [ "${OS}" = "Darwin" ] ; then
+ if [ -f /usr/bin/sw_vers ] ; then
+ OSSTR=`/usr/bin/sw_vers|grep -v Build|sed 's/^.*:.//'| tr "\n" ' '`
+ fi
+fi
+
+echo ${OSSTR}
diff --git a/scripts/geshi-ios.php b/scripts/geshi-ios.php
index 01ada56ba..ab587b511 100755
--- a/scripts/geshi-ios.php
+++ b/scripts/geshi-ios.php
@@ -1,6 +1,5 @@
'IOS',
@@ -9,7 +8,7 @@ $language_data = array (
'OOLANG' => false,
'NUMBERS' => GESHI_NUMBER_OCT_PREFIX | GESHI_NUMBER_HEX_PREFIX,
'KEYWORDS' => array(
- 1 => array(
+ 1 => array(
'no', 'shutdown'
),
# 2 => array(
@@ -32,7 +31,7 @@ $language_data = array (
# 'isis', 'ospf', 'eigrp', 'rip', 'igrp', 'bgp', 'ipv4', 'unicast', 'multicast', 'ipv6', 'connected', 'static', 'subnets', 'tcl'
# ),
# 4 => array(
- # 'point-to-point', 'aal5snap', 'rj45', 'auto', 'full', 'half', 'precedence', 'percent', 'datetime', 'msec', 'locatime', 'summer-time', 'md5', 'wait-for-bgp', 'wide',
+ # 'point-to-point', 'aal5snap', 'rj45', 'auto', 'full', 'half', 'precedence', 'percent', 'datetime', 'msec', 'locatime', 'summer-time', 'md5', 'wait-for-bgp', 'wide',
# 'level-1', 'level-2', 'log-neighbor-changes', 'directed-request', 'password-encryption', 'common', 'origin-as', 'bgp-nexthop', 'random-detect', 'localtime', 'sso', 'stm-1',
# 'dot1q', 'isl', 'new-model', 'always', 'summary-only', 'freeze', 'global', 'forwarded', 'access', 'trunk', 'edge', 'transparent'
# ),
@@ -169,4 +168,4 @@ $language_data = array (
);
-?>
+?>
\ No newline at end of file
diff --git a/test-discovery.php b/test-discovery.php
deleted file mode 100755
index 8ae0ac2cd..000000000
--- a/test-discovery.php
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env php
- Poll single device\n");
- echo("--os |