moar printer supportings, recognize more mge ups + dropdowns on devices list page now only list things from the selected device type, if any

git-svn-id: http://www.observium.org/svn/observer/trunk@1483 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-07-26 17:28:51 +00:00
parent a19f81cca2
commit c8353b106b
8 changed files with 107 additions and 20 deletions

View File

@@ -1,4 +1,17 @@
<?php print_optionbar_start(62); ?>
<?php
if ($_POST['hostname']) { $where = " AND hostname LIKE '%".mres($_POST['hostname'])."%'"; }
if ($_POST['os']) { $where = " AND os = '".mres($_POST['os'])."'"; }
if ($_POST['version']) { $where .= " AND version = '".mres($_POST['version'])."'"; }
if ($_POST['hardware']) { $where .= " AND hardware = '".mres($_POST['hardware'])."'"; }
if ($_POST['features']) { $where .= " AND features = '".mres($_POST['features'])."'"; }
if ($_POST['location']) { $where .= " AND location = '".mres($_POST['location'])."'"; }
if ($_GET['location'] && !isset($_POST['location'])) { $where .= " AND location = '".mres($_GET['location'])."'"; }
if ($_GET['type']) { $where = "AND type = '" .mres($_GET[type]). "'"; }
if ($_GET['location'] == "Unset") { $where .= " AND location = ''"; }
print_optionbar_start(62);
?>
<table cellpadding="4" cellspacing="0" class="devicetable" width="100%">
<form method="post" action="">
<tr>
@@ -10,7 +23,7 @@
<select name='os' id='os'>
<option value=''>All OSes</option>
<?php
$query = mysql_query("SELECT `os` FROM `devices` GROUP BY `os` ORDER BY `os`");
$query = mysql_query("SELECT `os` FROM `devices` WHERE 1 $where GROUP BY `os` ORDER BY `os`");
while ($data = mysql_fetch_array($query))
{
if ($data['os'])
@@ -26,7 +39,7 @@
<select name='version' id='version'>
<option value=''>All Versions</option>
<?php
$query = mysql_query("SELECT `version` FROM `devices` GROUP BY `version` ORDER BY `version`");
$query = mysql_query("SELECT `version` FROM `devices` WHERE 1 $where GROUP BY `version` ORDER BY `version`");
while ($data = mysql_fetch_array($query))
{
if ($data['version'])
@@ -43,7 +56,7 @@
<select name="hardware" id="hardware">
<option value="">All Platforms</option>
<?php
$query = mysql_query("SELECT `hardware` FROM `devices` GROUP BY `hardware` ORDER BY `hardware`");
$query = mysql_query("SELECT `hardware` FROM `devices` WHERE 1 $where GROUP BY `hardware` ORDER BY `hardware`");
while ($data = mysql_fetch_array($query))
{
if ($data['hardware'])
@@ -59,7 +72,7 @@
<select name="features" id="features">
<option value="">All Featuresets</option>
<?php
$query = mysql_query("SELECT `features` FROM `devices` GROUP BY `features` ORDER BY `features`");
$query = mysql_query("SELECT `features` FROM `devices` WHERE 1 $where GROUP BY `features` ORDER BY `features`");
while ($data = mysql_fetch_array($query))
{
if ($data['features'])
@@ -76,7 +89,7 @@
<select name="location" id="location">
<option value="">All Locations</option>
<?php
$query = mysql_query("SELECT `location` FROM `devices` GROUP BY `location` ORDER BY `location`");
$query = mysql_query("SELECT `location` FROM `devices` WHERE 1 $where GROUP BY `location` ORDER BY `location`");
while ($data = mysql_fetch_array($query))
{
if ($data['location'])
@@ -98,17 +111,6 @@
<?php
print_optionbar_end();
if ($_POST['hostname']) { $where = " AND hostname LIKE '%".mres($_POST['hostname'])."%'"; }
if ($_POST['os']) { $where = " AND os = '".mres($_POST['os'])."'"; }
if ($_POST['version']) { $where .= " AND version = '".mres($_POST['version'])."'"; }
if ($_POST['hardware']) { $where .= " AND hardware = '".mres($_POST['hardware'])."'"; }
if ($_POST['features']) { $where .= " AND features = '".mres($_POST['features'])."'"; }
if ($_POST['location']) { $where .= " AND location = '".mres($_POST['location'])."'"; }
if ($_GET['location'] && !isset($_POST['location'])) { $where .= " AND location = '".mres($_GET['location'])."'"; }
if ($_GET['type']) { $where = "AND type = '" .mres($_GET[type]). "'"; }
if ($_GET['location'] == "Unset") { $where .= " AND location = ''"; }
$sql = "SELECT * FROM devices WHERE 1 $where ORDER BY `ignore`, `status`, `hostname`";
if ($_GET['status'] == "alerted") {
$sql = "SELECT * FROM devices " . $device_alert_sql . " GROUP BY `device_id` ORDER BY `ignore`, `status`, `os`, `hostname`";

View File

@@ -3,8 +3,8 @@
if(!$os) {
if(strstr($sysDescr, "Pulsar M")) { $os = "mgeups"; }
else if(strstr($sysDescr, "Evolution S")) { $os = "mgeups"; }
else if (preg_match("/^Galaxy /", $sysDescr)) { $os = "mgeups"; }
else if (preg_match("/^Evolution /", $sysDescr)) { $os = "mgeups"; }
}

View File

@@ -0,0 +1,45 @@
<?php
# SNMPv2-SMI::enterprises.2435.2.4.3.2435.5.13.3.0 = STRING: "Brother HL-2070N series"
$hardware = trim(snmp_get($device, "1.3.6.1.4.1.2435.2.4.3.2435.5.13.3.0", "-OQv", "", ""),'" ');
# SNMPv2-SMI::enterprises.11.2.3.9.4.2.1.1.3.3.0 = STRING: "A7J913764"
$serial = trim(snmp_get($device, "1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0", "-OQv", "", ""),'" ');
# SNMPv2-SMI::enterprises.2435.2.4.3.1240.6.5.0 = STRING: "Firmware Ver.1.33 (06.07.21)"
$version = trim(snmp_get($device, "1.3.6.1.4.1.2435.2.4.3.1240.6.5.0", "-OQv", "", ""),'" ');
preg_match("/Ver\.(.*) \(/", $version, $matches);
if ($matches[1]) { $version = $matches[1]; }
# SNMPv2-SMI::enterprises.2435.2.3.9.1.1.7.0 = STRING: "MFG:Brother;CMD:HBP,PJL,PCL,PCLXL,POSTSCRIPT;MDL:MFC-8440;CLS:PRINTER;"
if ($hardware == '')
{
$jdinfo = explode(';',trim(snmp_get($device, "1.3.6.1.4.1.2435.2.3.9.1.1.7.0", "-OQv", "", ""),'" '));
foreach ($jdinfo as $jdi)
{
list($key,$value) = explode(':',$jdi);
$jetdirect[$key] = $value;
}
$hardware = $jetdirect['MDL'];
}
# SNMPv2-SMI::enterprises.2435.2.3.9.4.2.1.5.5.1.0 = STRING: "000A5J431816"
if ($serial == '')
{
$serial = trim(snmp_get($device, "1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0", "-OQv", "", ""),'" ');
}
# Strip off useless brand fields
$hardware = str_replace('Brother ','',$hardware);
$hardware = str_ireplace(' series','',$hardware);
if (isHexString($serial))
{
# Sometimes firmware outputs serial as hex-string
$serial = snmp_hexstring($serial);
}
?>

View File

@@ -17,10 +17,15 @@ if ($hardware == '')
$hardware = $jetdirect['DESCRIPTION'];
}
if ($hardware == '')
{
$hardware = $jetdirect['MODEL'];
}
# Strip off useless brand fields
$hardware = str_replace('HP ','',$hardware);
$hardware = str_replace('Hewlett-Packard ','',$hardware);
$hardware = str_replace(' Series','',$hardware);
$hardware = str_ireplace(' Series','',$hardware);
$hardware = ucfirst($hardware);
?>

View File

@@ -0,0 +1,13 @@
<?php
# SNMPv2-SMI::enterprises.18334.1.1.1.1.6.2.1.0 = STRING: "KONICA MINOLTA magicolor 4650"
$hardware = trim(snmp_get($device, "1.3.6.1.4.1.18334.1.1.1.1.6.2.1.0", "-OQv", "", ""),'" ');
# SNMPv2-SMI::enterprises.18334.1.1.1.1.6.1.0 = STRING: "1.74"
$version = trim(snmp_get($device, "1.3.6.1.4.1.18334.1.1.1.1.6.1.0", "-OQv", "", ""),'" ');
# Strip off useless brand fields
$hardware = str_ireplace('KONICA MINOLTA ','',$hardware);
$hardware = ucfirst($hardware);
?>

View File

@@ -0,0 +1,10 @@
<?php
# Jetdirect compatible
include('includes/polling/os/jetdirect.inc.php');
# Strip off useless brand fields
$hardware = str_replace('OKI ','',$hardware);
?>

View File

@@ -0,0 +1,12 @@
<?php
# SNMPv2-SMI::enterprises.367.3.2.1.1.1.1.0 = STRING: "Aficio MP 3350"
$hardware = trim(snmp_get($device, "1.3.6.1.4.1.367.3.2.1.1.1.1.0", "-OQv", "", ""),'" ');
# SNMPv2-SMI::enterprises.367.3.2.1.1.1.2.0 = STRING: "1.15"
$version = trim(snmp_get($device, "1.3.6.1.4.1.367.3.2.1.1.1.2.0", "-OQv", "", ""),'" ');
# SNMPv2-SMI::enterprises.367.3.2.1.2.1.4.0 = STRING: "M6394300657"
$serial = trim(snmp_get($device, "1.3.6.1.4.1.367.3.2.1.2.1.4.0", "-OQv", "", ""),'" ');
?>

View File

@@ -364,7 +364,7 @@ $config['os'][$os]['over'][0]['text'] = "Toner";
$os = "jetdirect";
$config['os'][$os]['group'] = "printer";
$config['os'][$os]['text'] = "HP Printer";
$config['os'][$os]['text'] = "HP Print server";
$config['os'][$os]['ifname'] = 1;
$config['os'][$os]['type'] = "printer";
$config['os'][$os]['icon'] = "hp";