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
This commit is contained in:
Tom Laermans
2011-03-28 20:29:34 +00:00
parent 2be7bfe497
commit 2c300b5bf4
21 changed files with 149 additions and 168 deletions

View File

@@ -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);

View File

@@ -1,16 +0,0 @@
<?php
$ipmi_hostname = mres($_POST['ipmi_hostname']);
$ipmi_username = mres($_POST['ipmi_username']);
$ipmi_password = mres($_POST['ipmi_password']);
#FIXME needs more sanity checking! and better feedback
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;
?>

View File

@@ -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'])))
{

View File

@@ -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 <b>IPv6</b>"); } else { echo(" via <b>IPv4</b>"); }
?>
if (Net_IPv6::checkIPv6($_SERVER['REMOTE_ADDR'])) { echo(" via <b>IPv6</b>"); } else { echo(" via <b>IPv4</b>"); }
?>
</td>
</tr>
</table>

View File

@@ -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('<div class="mainpane">');
echo(' <ul id="maintab" class="shadetabs">');
if (device_permitted($_GET['id']))
{
if ($config['show_overview_tab'])
if (device_permitted($device['device_id']))
{
echo('
if ($config['show_overview_tab'])
{
echo('
<li class="' . $select['overview'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/overview/">
<img src="images/16/server_lightning.png" align="absmiddle" border="0"> Overview
</a>
</li>');
}
}
echo('<li class="' . $select['graphs'] . '">
echo('<li class="' . $select['graphs'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/graphs/">
<img src="images/16/server_chart.png" align="absmiddle" border="0"> Graphs
</a>
</li>');
$health = mysql_result(mysql_query("select count(*) from storage WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(sensor_id) from sensors WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(current_id) from current WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(freq_id) from frequencies WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(volt_id) from voltage WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(fan_id) from fanspeed WHERE device_id = '" . $device['device_id'] . "'"), 0);
$health = mysql_result(mysql_query("select count(*) from storage WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(sensor_id) from sensors WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(current_id) from current WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(freq_id) from frequencies WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(volt_id) from voltage WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(fan_id) from fanspeed WHERE device_id = '" . $device['device_id'] . "'"), 0);
if ($health)
{
echo('<li class="' . $select['health'] . '">
if ($health)
{
echo('<li class="' . $select['health'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/health/">
<img src="images/icons/sensors.png" align="absmiddle" border="0" /> Health
</a>
</li>');
}
}
if (@mysql_result(mysql_query("select count(app_id) from applications WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
{
echo('<li class="' . $select['apps'] . '">
if (@mysql_result(mysql_query("select count(app_id) from applications WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
{
echo('<li class="' . $select['apps'] . '">
<a href="' . $config['base_url'] . '/device/' . $device['device_id'] . '/apps/">
<img src="images/icons/apps.png" align="absmiddle" border="0" /> Apps
</a>
</li>');
}
}
if (is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/"))
{
echo('<li class="' . $select['collectd'] . '">
if (is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/"))
{
echo('<li class="' . $select['collectd'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/collectd/">
<img src="images/16/chart_line.png" align="absmiddle" border="0" /> CollectD
</a>
</li>');
}
}
if (@mysql_result(mysql_query("select count(interface_id) from ports WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
{
echo('<li class="' . $select['ports'] . '">
if (@mysql_result(mysql_query("select count(interface_id) from ports WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
{
echo('<li class="' . $select['ports'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/ports/' .$config['ports_page_default']. '">
<img src="images/16/connect.png" align="absmiddle" border="0" /> Ports
</a>
</li>');
}
}
if (@mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
{
echo('<li class="' . $select['vlans'] . '">
if (@mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
{
echo('<li class="' . $select['vlans'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/vlans/">
<img src="images/16/vlans.png" align="absmiddle" border="0" /> VLANs
</a>
</li>');
}
}
if (@mysql_result(mysql_query("SELECT COUNT(id) FROM vmware_vminfo WHERE device_id = '" . $device["device_id"] . "'"), 0) > '0')
{
echo('<li class="' . $select['vm'] . '">
if (@mysql_result(mysql_query("SELECT COUNT(id) FROM vmware_vminfo WHERE device_id = '" . $device["device_id"] . "'"), 0) > '0')
{
echo('<li class="' . $select['vm'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/vm/">
<img src="images/16/server_cog.png" align="absmiddle" border="0" /> Virtual Machines
</a>
</li>');
}
}
if (@mysql_result(mysql_query("select count(*) from vrfs WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
{
echo('<li class="' . $select['vrfs'] . '">
if (@mysql_result(mysql_query("select count(*) from vrfs WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
{
echo('<li class="' . $select['vrfs'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/vrfs/">
<img src="images/16/layers.png" align="absmiddle" border="0" /> VRFs
</a>
</li>');
}
}
if ($config['enable_bgp'] && $device['bgpLocalAs'])
{
echo('<li class="' . $select['bgp'] . '">
if ($config['enable_bgp'] && $device['bgpLocalAs'])
{
echo('<li class="' . $select['bgp'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/bgp/">
<img src="images/16/link.png" align="absmiddle" border="0" /> BGP
</a>
</li>');
}
}
if ($_SESSION['userlevel'] >= "5" && mysql_result(mysql_query("SELECT count(*) FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"),0))
{
echo('<li class="' . $select['map'] . '">
if ($_SESSION['userlevel'] >= "5" && mysql_result(mysql_query("SELECT count(*) FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"),0))
{
echo('<li class="' . $select['map'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/map/">
<img src="images/16/chart_organisation.png" align="absmiddle" border="0" /> Map
</a>
</li>');
}
}
if ($config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."'"), 0) > '0')
{
echo('<li class="' . $select['entphysical'] . '">
if ($config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."'"), 0) > '0')
{
echo('<li class="' . $select['entphysical'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/entphysical/">
<img src="images/16/bricks.png" align="absmiddle" border="0" /> Inventory
</a>
</li>');
}
elseif (device_permitted($_GET['id']) && $config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `hrDevice` WHERE device_id = '".$_GET['id']."'"), 0) > '0')
{
echo('<li class="' . $select['hrdevice'] . '">
}
elseif (device_permitted($device['device_id']) && $config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `hrDevice` WHERE device_id = '".$device['device_id']."'"), 0) > '0')
{
echo('<li class="' . $select['hrdevice'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/hrdevice/">
<img src="images/16/bricks.png" align="absmiddle" border="0" /> Inventory
</a>
</li>');
}
}
if (mysql_result(mysql_query("select count(service_id) from services WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
{
echo('<li class="' . $select['srv'] . '">
if (mysql_result(mysql_query("select count(service_id) from services WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
{
echo('<li class="' . $select['srv'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/srv/">
<img src="images/icons/services.png" align="absmiddle" border="0" /> Services
</a>
</li>');
}
}
if (@mysql_result(mysql_query("select count(toner_id) from toner WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
{
echo('<li class="' . $select['toner'] . '">
if (@mysql_result(mysql_query("select count(toner_id) from toner WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
{
echo('<li class="' . $select['toner'] . '">
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/toner/">
<img src="images/icons/toner.png" align="absmiddle" border="0" /> Toner
</a>
</li>');
}
}
if (device_permitted($_GET['id']))
{
echo('<li class="' . $select['events'] . '">
if (device_permitted($device['device_id']))
{
echo('<li class="' . $select['events'] . '">
<a href="'.$config['base_url']. "/device/" . $device['device_id'] . '/events/">
<img src="images/16/report_magnify.png" align="absmiddle" border="0" /> Events
</a>
</li>');
}
}
if ($config['enable_syslog'])
{
echo('<li class="' . $select['syslog'] . '">
if ($config['enable_syslog'])
{
echo('<li class="' . $select['syslog'] . '">
<a href="'.$config['base_url']."/device/" . $device['device_id'] . '/syslog/">
<img src="images/16/printer.png" align="absmiddle" border="0" /> Syslog
</a>
</li>
');
</li>');
}
}
}
if ($_SESSION['userlevel'] >= "7")
{
if (!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); }
foreach ($config['rancid_configs'] as $configs)
if ($_SESSION['userlevel'] >= "7")
{
if ($configs[strlen($configs)-1] != '/') { $configs .= '/'; }
if (is_file($configs . $device['hostname'])) { $device_config_file = $configs . $device['hostname']; }
if (!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); }
foreach ($config['rancid_configs'] as $configs)
{
if ($configs[strlen($configs)-1] != '/') { $configs .= '/'; }
if (is_file($configs . $device['hostname'])) { $device_config_file = $configs . $device['hostname']; }
}
}
}
if ($device_config_file)
{
echo('<li class="' . $select['showconfig'] . '">
if ($device_config_file)
{
echo('<li class="' . $select['showconfig'] . '">
<a href="'.$config['base_url']."/device/" . $device['device_id'] . '/showconfig/">
<img src="images/16/page_white_text.png" align="absmiddle" border="0" /> Config
</a>
</li>
');
</li>');
}
if ($_SESSION['userlevel'] >= "7")
@@ -224,15 +222,13 @@ if (device_permitted($_GET['id']) || $check_device == $_GET['id'])
<a href="'.$config['base_url']."/device/" . $device['device_id'] . '/edit/">
<img src="images/16/server_edit.png" align="absmiddle" border="0" /> Settings
</a>
</li>
');
</li>');
}
echo("</ul>");
echo('<div class="contentstyle">');
## FIXME safe??
include("pages/device/".mres($section).".inc.php");
include("pages/device/".mres(basename($section)).".inc.php");
echo("</div>");
}
@@ -241,4 +237,5 @@ else
{
include("includes/error-no-perm.inc.php");
}
?>

View File

@@ -7,17 +7,17 @@ print_optionbar_start();
echo("
<div style='margin: auto; text-align: left; padding-left: 11px; clear: both; display:block; height:20px;'>
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/'>No Graphs</a> |
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/updates/'>Updates</a>");
<a href='/device/" . $device['device_id'] . "/bgp/'>No Graphs</a> |
<a href='/device/" . $device['device_id'] . "/bgp/updates/'>Updates</a>");
echo(" | Prefixes:
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/prefixes/ipv4.unicast/'>IPv4</a> |
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/prefixes/ipv4.vpn/'>VPNv4</a> |
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/prefixes/ipv6.unicast/'>IPv6</a>
<a href='/device/" . $device['device_id'] . "/bgp/prefixes/ipv4.unicast/'>IPv4</a> |
<a href='/device/" . $device['device_id'] . "/bgp/prefixes/ipv4.vpn/'>VPNv4</a> |
<a href='/device/" . $device['device_id'] . "/bgp/prefixes/ipv6.unicast/'>IPv6</a>
");
echo("| Traffic:
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/macaccounting/'>Mac Accounting</a>");
<a href='/device/" . $device['device_id'] . "/bgp/macaccounting/'>Mac Accounting</a>");
echo("</div>
");

View File

@@ -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);

View File

@@ -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("</div>");
$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("<ul>");

View File

@@ -1,6 +1,6 @@
<?php
$sql = "SELECT * FROM `ucd_diskio` WHERE device_id = '" . mres($_GET['id']) . "' ORDER BY diskio_descr";
$sql = "SELECT * FROM `ucd_diskio` WHERE device_id = '" . $device['device_id'] . "' ORDER BY diskio_descr";
$query = mysql_query($sql);
echo('<table cellspacing="0" cellpadding="5" width="100%">');

View File

@@ -1,6 +1,6 @@
<?php
$sql = "SELECT * FROM `sensors` WHERE sensor_class='".$class."' AND device_id = '" . mres($_GET['id']) . "' ORDER BY sensor_descr";
$sql = "SELECT * FROM `sensors` WHERE sensor_class='".$class."' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_descr";
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=5 width=100%>");

View File

@@ -2,7 +2,7 @@
$graph_type = "storage_usage";
$sql = "SELECT * FROM `storage` WHERE device_id = '" . ($_GET['id']) . "' ORDER BY storage_descr";
$sql = "SELECT * FROM `storage` WHERE device_id = '" . $device['device_id'] . "' ORDER BY storage_descr";
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=5 width=100%>");

View File

@@ -3,7 +3,6 @@
if ($ports['total'])
{
echo('<div style="background-color: #eeeeee; margin: 5px; padding: 5px;">');
# ' . device_traffic_image($device['device_id'], 490, 100, $day, '-300s'));
$graph_array['height'] = "100";
$graph_array['width'] = "490";

View File

@@ -13,7 +13,7 @@ print_optionbar_start('25');
<select name="program" id="program">
<option value="">All Programs</option>
<?php
$query = mysql_query("SELECT `program` FROM `syslog` WHERE device_id = '" . $_GET['id'] . "' GROUP BY `program` ORDER BY `program`");
$query = mysql_query("SELECT `program` FROM `syslog` WHERE device_id = '" . $device['device_id'] . "' GROUP BY `program` ORDER BY `program`");
while ($data = mysql_fetch_array($query)) {
echo("<option value='".$data['program']."'");
if ($data['program'] == $_POST['program']) { echo("selected"); }
@@ -39,7 +39,7 @@ if ($_POST['program'])
$where .= " AND program = '".$_POST['program']."'";
}
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog WHERE device_id = '" . $_GET['id'] . "' $where";
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog WHERE device_id = '" . $device['device_id'] . "' $where";
$sql .= " ORDER BY timestamp DESC LIMIT 1000";
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>");

View File

@@ -14,7 +14,7 @@ print_optionbar_end();
echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">');
$i = "1";
$vlan_query = mysql_query("select * from vlans WHERE device_id = '".mres($_GET['id'])."' ORDER BY 'vlan_vlan'");
$vlan_query = mysql_query("select * from vlans WHERE device_id = '".$device['device_id']."' ORDER BY 'vlan_vlan'");
while ($vlan = mysql_fetch_array($vlan_query))
{

View File

@@ -3,7 +3,7 @@
echo('<table border="0" cellspacing="0" cellpadding="5" width="100%" class="sortable"><tr class="tablehead"><th>Server Name</th><th>Power Status</th><th>Operating System</th><th>Memory</th><th>CPU</th></tr>');
$i = "1";
$vm_query = mysql_query("SELECT id, vmwVmVMID, vmwVmDisplayName, vmwVmGuestOS, vmwVmMemSize, vmwVmCpus, vmwVmState FROM vmware_vminfo WHERE device_id = '".mres($_GET['id'])."' ORDER BY vmwVmDisplayName");
$vm_query = mysql_query("SELECT id, vmwVmVMID, vmwVmDisplayName, vmwVmGuestOS, vmwVmMemSize, vmwVmCpus, vmwVmState FROM vmware_vminfo WHERE device_id = '".$device['device_id']."' ORDER BY vmwVmDisplayName");
while ($vm = mysql_fetch_array($vm_query))
{

View File

@@ -13,7 +13,7 @@ print_optionbar_end();
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
$i = "0";
$vrf_query = mysql_query("select * from vrfs WHERE device_id = '".$_GET['id']."' ORDER BY 'vrf_name'");
$vrf_query = mysql_query("select * from vrfs WHERE device_id = '".$device['device_id']."' ORDER BY 'vrf_name'");
while ($vrf = mysql_fetch_array($vrf_query))
{
include("includes/print-vrf.inc.php");

View File

@@ -2,12 +2,12 @@
echo("
<div style='width: 100%; text-align: right; padding-bottom: 10px; clear: both; display:block; height:20px;'>
<a href='".$config['base_url']."/vrf/" . $_GET['id'] . "/'>Basic</a> |
<a href='".$config['base_url']."/vrf/" . $_GET['id'] . "/details/'>Details</a> | Graphs:
<a href='".$config['base_url']."/vrf/" . $_GET['id'] . "/graphs/bits/'>Bits</a> |
<a href='".$config['base_url']."/vrf/" . $_GET['id'] . "/graphs/pkts/'>Packets</a> |
<a href='".$config['base_url']."/vrf/" . $_GET['id'] . "/graphs/nupkts/'>NU Packets</a> |
<a href='".$config['base_url']."/vrf/" . $_GET['id'] . "/graphs/errors/'>Errors</a>
<a href='/vrf/" . $device['device_id'] . "/'>Basic</a> |
<a href='/vrf/" . $device['device_id'] . "/details/'>Details</a> | Graphs:
<a href='/vrf/" . $device['device_id'] . "/graphs/bits/'>Bits</a> |
<a href='/vrf/" . $device['device_id'] . "/graphs/pkts/'>Packets</a> |
<a href='/vrf/" . $device['device_id'] . "/graphs/nupkts/'>NU Packets</a> |
<a href='/vrf/" . $device['device_id'] . "/graphs/errors/'>Errors</a>
</div>");
if ($_GET['opta'] == 'graphs')
@@ -27,7 +27,7 @@ if ($_GET['opta'] == "details" )
}
echo("<div style='background: $list_colour_b; padding: 10px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
$vrf_query = mysql_query("SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = '".$_GET['id']."'");
$vrf_query = mysql_query("SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = '".$device['device_id']."'");
$vrf = mysql_fetch_array($vrf_query);
echo("<tr valign=top bgcolor='$bg_colour'>");
echo("<td width=200 class=list-large><a href='vrf/".$vrf['mplsVpnVrfRouteDistinguisher']."/'>" . $vrf['vrf_name'] . "</a></td>");

View File

@@ -182,4 +182,15 @@ function safename($name)
return preg_replace('/[^a-zA-Z0-9,._\-]/', '_', $name);
}
function zeropad($num, $length = 2)
{
while (strlen($num) < $length)
{
$num = '0'.$num;
}
return $num;
}
?>

View File

@@ -9,7 +9,8 @@ if ($config['enable_printers'])
if ($device['os_group'] == 'printer')
{
$oids = trim(snmp_walk($device, "SNMPv2-SMI::mib-2.43.12.1.1.2.1 ", "-OsqnU"));
if (!$oids) {
if (!$oids)
{
$oids = trim(snmp_walk($device, "SNMPv2-SMI::mib-2.43.11.1.1.2.1 ", "-OsqnU"));
}
if ($debug) { echo($oids."\n"); }
@@ -52,7 +53,8 @@ if ($config['enable_printers'])
{
$toner_index = $test_toner['toner_index'];
$toner_type = $test_toner['toner_type'];
if (!$valid_toner[$toner_type][$toner_index]) {
if (!$valid_toner[$toner_type][$toner_index])
{
echo("-");
mysql_query("DELETE FROM `toner` WHERE toner_id = '" . $test_toner['toner_id'] . "'");
}
@@ -60,6 +62,6 @@ if ($config['enable_printers'])
}
unset($valid_toner); echo("\n");
} # if ($config['enable_printers'])
?>

View File

@@ -28,16 +28,6 @@ function mac_clean_to_readable($mac)
return($r);
}
function zeropad($num, $length = 2)
{
while (strlen($num) < $length)
{
$num = '0'.$num;
}
return $num;
}
function only_alphanumeric($string)
{
return preg_replace('/[^a-zA-Z0-9]/', '', $string);
@@ -197,12 +187,6 @@ function interface_errors($rrd_file, $period = '-1d') // Returns the last in/out
return $errors;
}
# FIXME: below function is unused, only commented out in html/pages/device/overview/ports.inc.php - do we still need it?
function device_traffic_image($device, $width, $height, $from, $to)
{
return "<img src='graph.php?device=" . $device . "&amp;type=device_bits&amp;from=" . $from . "&amp;to=" . $to . "&amp;width=" . $width . "&amp;height=" . $height . "&amp;legend=no' />";
}
function getImage($host)
{
global $config;
@@ -679,7 +663,7 @@ function log_event($text, $device = NULL, $type = NULL, $reference = NULL)
{
global $debug;
if (!is_array($device)) { $device = device_by_id_cache($device); }
if (!is_array($device)) { $device = device_by_id_cache($device); }
$event_query = "INSERT INTO eventlog (host, reference, type, datetime, message) VALUES (" . ($device['device_id'] ? $device['device_id'] : "NULL");
$event_query .= ", '" . ($reference ? $reference : "NULL") . "', '" . ($type ? $type : "NULL") . "', NOW(), '" . mres($text) . "')";

View File

@@ -9,10 +9,7 @@ if ($config['enable_printers'])
{
echo("Checking toner " . $toner['toner_descr'] . "... ");
# FIXME needs snmp_get
$toner_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $toner['toner_oid'] . "|grep -v \"No Such Instance\"";
$tonerperc = trim(str_replace("\"", "", shell_exec($toner_cmd)));
$tonerperc = $tonerperc / $toner['toner_capacity'] * 100;
$tonerperc = snmp_get($device, $toner['toner_oid'], "-OUqnv") / $toner['toner_capacity'] * 100;
$tonerrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("toner-" . $toner['toner_descr'] . ".rrd");