From 2c300b5bf42b4aa5a342ce5c8c132049913c1622 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Mon, 28 Mar 2011 20:29:34 +0000 Subject: [PATCH] cleanups, extend ports.port_descr_type length to 255, maybe break billing, remove and add some FIXMEs, poll toner with snmp_get git-svn-id: http://www.observium.org/svn/observer/trunk@1985 61d68cd4-352d-0410-923a-c4978735b2b8 --- database-update.sql | 1 + html/includes/device-ipmi-edit.inc.php | 16 -- html/includes/graphs/bill/auth.inc.php | 1 - html/includes/header.inc.php | 6 +- html/pages/device.inc.php | 189 +++++++++++------------ html/pages/device/bgp.inc.php | 12 +- html/pages/device/edit/ipmi.inc.php | 13 +- html/pages/device/entphysical.inc.php | 4 +- html/pages/device/health/diskio.inc.php | 2 +- html/pages/device/health/sensors.inc.php | 2 +- html/pages/device/health/storage.inc.php | 2 +- html/pages/device/overview/ports.inc.php | 1 - html/pages/device/syslog.inc.php | 4 +- html/pages/device/vlans.inc.php | 2 +- html/pages/device/vm.inc.php | 2 +- html/pages/device/vrfs.inc.php | 2 +- html/pages/vrf.inc.php | 14 +- includes/common.php | 11 ++ includes/discovery/toner.inc.php | 10 +- includes/functions.php | 18 +-- includes/polling/toner.inc.php | 5 +- 21 files changed, 149 insertions(+), 168 deletions(-) delete mode 100644 html/includes/device-ipmi-edit.inc.php diff --git a/database-update.sql b/database-update.sql index 347ecf04a..a37fbe52f 100644 --- a/database-update.sql +++ b/database-update.sql @@ -29,3 +29,4 @@ ALTER TABLE `vrfs` MODIFY `mplsVpnVrfRouteDistinguisher` VARCHAR(128); ALTER TABLE `vrfs` MODIFY `vrf_name` VARCHAR(128); ALTER TABLE `ports` MODIFY `ifDescr` VARCHAR(255); CREATE TABLE IF NOT EXISTS `vmware_vminfo` (`id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `vmwVmVMID` int(11) NOT NULL, `vmwVmDisplayName` varchar(128) NOT NULL, `vmwVmGuestOS` varchar(128) NOT NULL, `vmwVmMemSize` int(11) NOT NULL, `vmwVmCpus` int(11) NOT NULL, `vmwVmState` varchar(128) NOT NULL, PRIMARY KEY (`id`), KEY `device_id` (`device_id`), KEY `vmwVmVMID` (`vmwVmVMID`)) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `ports` MODIFY `port_descr_type` VARCHAR(255); diff --git a/html/includes/device-ipmi-edit.inc.php b/html/includes/device-ipmi-edit.inc.php deleted file mode 100644 index 19bd9916d..000000000 --- a/html/includes/device-ipmi-edit.inc.php +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/html/includes/graphs/bill/auth.inc.php b/html/includes/graphs/bill/auth.inc.php index f91c0b571..c9f1d1db2 100644 --- a/html/includes/graphs/bill/auth.inc.php +++ b/html/includes/graphs/bill/auth.inc.php @@ -3,7 +3,6 @@ ### Authorises bill viewing and sets $ports as reference to mysql query containing ports for this bill include("../includes/billing.php"); -include("../includes/functions.php"); ## FIXME zeropad() if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || bill_permitted($_GET['id']))) { diff --git a/html/includes/header.inc.php b/html/includes/header.inc.php index 40583e608..790506088 100644 --- a/html/includes/header.inc.php +++ b/html/includes/header.inc.php @@ -10,9 +10,9 @@ if ($_SESSION['authenticated']) } else { echo("Not logged in!"); } -# FIXME worksforme, why was this disabled again? -TL -# if (Net_IPv6::checkIPv6($_SERVER['REMOTE_ADDR'])) { echo(" via IPv6"); } else { echo(" via IPv4"); } - ?> + +if (Net_IPv6::checkIPv6($_SERVER['REMOTE_ADDR'])) { echo(" via IPv6"); } else { echo(" via IPv4"); } +?> diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php index 8929a47d7..470829506 100644 --- a/html/pages/device.inc.php +++ b/html/pages/device.inc.php @@ -22,6 +22,7 @@ if (device_permitted($_GET['id']) || $check_device == $_GET['id']) $select[$section] = "selected"; $device_query = mysql_query("SELECT * FROM `devices` WHERE `device_id` = '" . $_GET['id'] . "'"); + # FIXME device_by_id_cache ? while ($device = mysql_fetch_array($device_query)) { if ($config['os'][$device['os']]['group']) { $device['os_group'] = $config['os'][$device['os']]['group']; } @@ -33,189 +34,186 @@ if (device_permitted($_GET['id']) || $check_device == $_GET['id']) echo('
'); echo(' "); echo('
'); - ## FIXME safe?? - include("pages/device/".mres($section).".inc.php"); + include("pages/device/".mres(basename($section)).".inc.php"); echo("
"); } @@ -241,4 +237,5 @@ else { include("includes/error-no-perm.inc.php"); } -?> + +?> \ No newline at end of file diff --git a/html/pages/device/bgp.inc.php b/html/pages/device/bgp.inc.php index 032c923ad..4e3ae6802 100644 --- a/html/pages/device/bgp.inc.php +++ b/html/pages/device/bgp.inc.php @@ -7,17 +7,17 @@ print_optionbar_start(); echo("
- No Graphs | - Updates"); + No Graphs | + Updates"); echo(" | Prefixes: - IPv4 | - VPNv4 | - IPv6 + IPv4 | + VPNv4 | + IPv6 "); echo("| Traffic: - Mac Accounting"); + Mac Accounting"); echo("
"); diff --git a/html/pages/device/edit/ipmi.inc.php b/html/pages/device/edit/ipmi.inc.php index 77e32d1ea..829e3aa89 100644 --- a/html/pages/device/edit/ipmi.inc.php +++ b/html/pages/device/edit/ipmi.inc.php @@ -4,12 +4,19 @@ if ($_POST['editing']) { if ($_SESSION['userlevel'] > "7") { - include("includes/device-ipmi-edit.inc.php"); + $ipmi_hostname = mres($_POST['ipmi_hostname']); + $ipmi_username = mres($_POST['ipmi_username']); + $ipmi_password = mres($_POST['ipmi_password']); + + if ($ipmi_hostname != '') { set_dev_attrib($device, 'ipmi_hostname', $ipmi_hostname); } else { del_dev_attrib($device, 'ipmi_hostname'); } + if ($ipmi_username != '') { set_dev_attrib($device, 'ipmi_username', $ipmi_username); } else { del_dev_attrib($device, 'ipmi_username'); } + if ($ipmi_password != '') { set_dev_attrib($device, 'ipmi_password', $ipmi_password); } else { del_dev_attrib($device, 'ipmi_password'); } + + $update_message = "Device IPMI data updated."; + $updated = 1; } } -$descr = $device['purpose']; - if ($updated && $update_message) { print_message($update_message); diff --git a/html/pages/device/entphysical.inc.php b/html/pages/device/entphysical.inc.php index 864e429fa..890363c96 100644 --- a/html/pages/device/entphysical.inc.php +++ b/html/pages/device/entphysical.inc.php @@ -4,7 +4,7 @@ function printEntPhysical($ent, $level, $class) { global $device; - $query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn,entPhysicalIndex"); + $query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn,entPhysicalIndex"); while ($ent = mysql_fetch_array($query)) { echo(" @@ -58,7 +58,7 @@ function printEntPhysical($ent, $level, $class) echo("
"); - $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'"),0); + $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'"),0); if ($count) { echo("