unify $os_group and $os_type into $config['os']

git-svn-id: http://www.observium.org/svn/observer/trunk@1264 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-06-25 12:18:00 +00:00
parent b2cfd87081
commit 19ccf99d8f
9 changed files with 69 additions and 62 deletions

View File

@ -97,7 +97,7 @@ while ($device = mysql_fetch_array($device_query))
mysql_query("UPDATE `devices` SET `os` = '".strtolower($device['os'])."' WHERE device_id = '".$device['device_id']."'"); mysql_query("UPDATE `devices` SET `os` = '".strtolower($device['os'])."' WHERE device_id = '".$device['device_id']."'");
$device['os'] = strtolower($device['os']); echo("OS lowercased."); $device['os'] = strtolower($device['os']); echo("OS lowercased.");
} }
if($os_groups[$device['os']]) {$device['os_group'] = $os_groups[$device['os']]; echo "(".$device['os_group'].")";} if($config['os'][$device['os']]['group']) {$device['os_group'] = $config['os'][$device['os']]['group']; echo "(".$device['os_group'].")";}
echo("\n"); echo("\n");

View File

@ -42,12 +42,11 @@ if($_GET['debug']) {
$graphfile = $config['temp_dir'] . "/" . strgen() . ".png"; $graphfile = $config['temp_dir'] . "/" . strgen() . ".png";
$os = gethostosbyid($device_id); $os = gethostosbyid($device_id);
$os_lower = strtolower($os); if($config['os'][$os]['group']) {$os_group = $config['os'][$os]['group'];}
if($os_groups[$os_lower]) {$os_group = $os_groups[$os_lower];}
if(is_file($config['install_dir'] . "/html/includes/graphs/".$type."_".$os_lower.".inc.php")) { if(is_file($config['install_dir'] . "/html/includes/graphs/".$type."_".$os.".inc.php")) {
/// Type + OS Specific /// Type + OS Specific
include($config['install_dir'] . "/html/includes/graphs/".$type."_".$os_lower.".inc.php"); include($config['install_dir'] . "/html/includes/graphs/".$type."_".$os.".inc.php");
}elseif($os_group && is_file($config['install_dir'] . "/html/includes/graphs/".$type."_".$os_group.".inc.php")) { }elseif($os_group && is_file($config['install_dir'] . "/html/includes/graphs/".$type."_".$os_group.".inc.php")) {
/// Type + OS Group Specific /// Type + OS Group Specific
include($config['install_dir'] . "/html/includes/graphs/".$type."_".$os_group.".inc.php"); include($config['install_dir'] . "/html/includes/graphs/".$type."_".$os_group.".inc.php");

View File

@ -26,7 +26,7 @@
if ($device['os'] == "ios") { formatCiscoHardware($device); } if ($device['os'] == "ios") { formatCiscoHardware($device); }
if ($device['features']) { $device['features'] = "(".$device['features'].")"; } if ($device['features']) { $device['features'] = "(".$device['features'].")"; }
$device['os_text'] = $os_text[$device['os']]; $device['os_text'] = $config['os'][$device['os']]['text'];
echo($dev_img . ' echo($dev_img . '
<table width="100%">'); <table width="100%">');

View File

@ -12,7 +12,7 @@
$image = getImage($device['device_id']); $image = getImage($device['device_id']);
if ($device['os'] == "ios") { formatCiscoHardware($device, true); } if ($device['os'] == "ios") { formatCiscoHardware($device, true); }
$device['os_text'] = $os_text[$device['os']]; $device['os_text'] = $config['os'][$device['os']]['text'];
echo(' <tr background="'.$bg_image.'" bgcolor="' . $bg . '" onmouseover="this.style.backgroundColor=\'#fdd\';" onmouseout="this.style.backgroundColor=\'' . $bg . '\';" echo(' <tr background="'.$bg_image.'" bgcolor="' . $bg . '" onmouseover="this.style.backgroundColor=\'#fdd\';" onmouseout="this.style.backgroundColor=\'' . $bg . '\';"
onclick="location.href=\'/device/'.$device['device_id'].'/\'" style="cursor: hand;"> onclick="location.href=\'/device/'.$device['device_id'].'/\'" style="cursor: hand;">

View File

@ -17,7 +17,7 @@ $select[$section] = "selected";
$device_query = mysql_query("SELECT * FROM `devices` WHERE `device_id` = '" . $_GET['id'] . "'"); $device_query = mysql_query("SELECT * FROM `devices` WHERE `device_id` = '" . $_GET['id'] . "'");
while($device = mysql_fetch_array($device_query)) { while($device = mysql_fetch_array($device_query)) {
if($os_groups[$device['os']]) {$device['os_group'] = $os_groups[$device['os']]; } if($config['os'][$device['os']]['group']) {$device['os_group'] = $config['os'][$device['os']]['group']; }
echo('<table cellpadding="15" cellspacing="0" class="devicetable" width="100%">'); echo('<table cellpadding="15" cellspacing="0" class="devicetable" width="100%">');
include("includes/device-header.inc.php"); include("includes/device-header.inc.php");

View File

@ -8,7 +8,7 @@ while ($device = mysql_fetch_array($device_query))
echo('<div style="clear: both;">'); echo('<div style="clear: both;">');
if ($os_groups[$device['os']]) { $os_group = $os_groups[$device['os']]; } if ($config['os'][$device['os']]['group']) { $os_group = $config['os'][$device['os']]['group']; }
if (is_file($config['install_dir'] . "/html/pages/device/graphs/os-".$device['os'].".inc.php")) { if (is_file($config['install_dir'] . "/html/pages/device/graphs/os-".$device['os'].".inc.php")) {
/// OS Specific /// OS Specific

View File

@ -17,7 +17,7 @@
{ {
echo("<option value='".$data['os']."'"); echo("<option value='".$data['os']."'");
if ($data['os'] == $_POST['os']) { echo(" selected"); } if ($data['os'] == $_POST['os']) { echo(" selected"); }
echo(">".$os_text[$data['os']]."</option>"); echo(">".$config['os'][$data['os']]['text']."</option>");
} }
} }
?> ?>

View File

@ -20,61 +20,69 @@ $config['afi']['ipv6']['multicast'] = "IPv6 Multicast";
## Don't bulkwalk for these OS types ## Don't bulkwalk for these OS types
$config['nobulkwalk'] = array("netmanplus"); $config['nobulkwalk'] = array("netmanplus");
## Set OS Groups $config['os']['linux']['group'] = "unix";
$os_groups['linux'] = "unix"; $config['os']['linux']['text'] = "Linux";
$os_groups['freebsd'] = "unix"; $config['os']['freebsd']['group'] = "unix";
$os_groups['openbsd'] = "unix"; $config['os']['freebsd']['text'] = "FreeBSD";
$os_groups['netbsd'] = "unix"; $config['os']['openbsd']['group'] = "unix";
$os_groups['dragonfly'] = "unix"; $config['os']['openbsd']['text'] = "OpenBSD";
$os_groups['monowall'] = "unix"; $config['os']['netbsd']['group'] = "unix";
$os_groups['solaris'] = "unix"; $config['os']['netbsd']['text'] = "NetBSD";
$os_groups['adva'] = "unix"; $config['os']['dragonfly']['group'] = "unix";
$os_groups['opensolaris'] = "unix"; $config['os']['dragonfly']['text'] = "DragonflyBSD";
$config['os']['monowall']['group'] = "unix";
$config['os']['monowall']['text'] = "m0n0wall";
$config['os']['solaris']['group'] = "unix";
$config['os']['solaris']['text'] = "Sun Solaris";
$config['os']['opensolaris']['group'] = "unix";
$config['os']['opensolaris']['text'] = "Adva";
$config['os']['opensolaris']['group'] = "unix";
$config['os']['opensolaris']['text'] = "Sun OpenSolaris";
$os_groups['iosxe'] = "ios"; $config['os']['ios']['group'] = "ios";
$os_groups['iosxr'] = "ios"; $config['os']['ios']['text'] = "Cisco IOS";
$os_groups['ios'] = "ios"; $config['os']['iosxe']['group'] = "ios";
$os_groups['asa'] = "ios"; $config['os']['iosxe']['text'] = "Cisco IOS-XE";
$config['os']['iosxr']['group'] = "ios";
$config['os']['iosxr']['text'] = "Cisco IOS-XR";
$config['os']['asa']['group'] = "ios";
$config['os']['asa']['text'] = "Cisco ASA";
$config['os']['pix']['group'] = "ios";
$config['os']['pix']['text'] = "Cisco PIXOS";
$config['os']['nxos']['group'] = "ios";
$config['os']['nxos']['text'] = "Cisco NX-OS";
$config['os']['catos']['group'] = "ios";
$config['os']['catos']['text'] = "Cisco CatOS";
$os_groups['mgeups'] = "ups"; $config['os']['junos']['text'] = "Juniper JunOS";
$os_groups['netmanplus'] = "ups"; $config['os']['junose']['text'] = "Juniper JunOSe";
$os_groups['dell-laser'] = "printer"; $config['os']['mgeups']['group'] = "ios";
$config['os']['mgeups']['text'] = "Cisco IOS";
$config['os']['netmanplus']['group'] = "ios";
$config['os']['netmanplus']['text'] = "";
$config['os']['generic']['text'] = "Generic Device";
$config['os']['ironware']['text'] = "Brocade IronWare";
$config['os']['powerconnect']['text'] = "Dell PowerConnect";
$config['os']['windows']['text'] = "Microsoft Windows";
$config['os']['procurve']['text'] = "HP ProCurve";
$config['os']['speedtouch']['text'] = "Thomson Speedtouch";
$config['os']['allied']['text'] = "AlliedWare";
$config['os']['mgeups']['text'] = "MGE UPS";
$config['os']['mgeups']['group'] = "ups";
$config['os']['apc']['text'] = "APC Management Module";
$config['os']['areca']['text'] = "Areca RAID Subsystem";
$config['os']['netmanplus']['text'] = "NetMan Plus";
$config['os']['netmanplus']['group'] = "ups";
$config['os']['akcp']['text'] = "AKCP SensorProbe";
$config['os']['minkelsrms']['text'] = "Minkels RMS";
$config['os']['papouch-tme']['text'] = "Papouch TME";
$config['os']['dell-laser']['group'] = "printer";
$config['os']['dell-laser']['text'] = "Dell Laser";
##
$os_text['linux'] = "Linux";
$os_text['ios'] = "Cisco IOS";
$os_text['iosxr'] = "Cisco IOS XE";
$os_text['iosxe'] = "Cisco IOS XR";
$os_text['catos'] = "Cisco CatOS";
$os_text['nxos'] = "Cisco NX-OS";
$os_text['asa'] = "Cisco ASA";
$os_text['pix'] = "Cisco PIX";
$os_text['generic'] = "Generic Device";
$os_text['ironware'] = "Brocade IronWare";
$os_text['monowall'] = "m0n0wall";
$os_text['freebsd'] = "FreeBSD";
$os_text['openbsd'] = "OpenBSD";
$os_text['netbsd'] = "NetBSD";
$os_text['dragonflybsd'] = "DragonFlyBSD";
$os_text['solaris'] = "Sun Solaris";
$os_text['opensolaris'] = "OpenSolaris";
$os_text['powerconnect'] = "Dell PowerConnect";
$os_text['windows'] = "Microsoft Windows";
$os_text['junos'] = "Juniper JunOS";
$os_text['junose'] = "Juniper JunOSe";
$os_text['procurve'] = "HP ProCurve";
$os_text['speedtouch'] = "Thomson Speedtouch";
$os_text['dell-laser'] = "Dell Laser Printer";
$os_text['adva'] = "Adva";
$os_text['allied'] = "AlliedWare";
$os_text['mgeups'] = "MGE UPS";
$os_text['apc'] = "APC Management Module";
$os_text['areca'] = "Areca RAID Subsystem";
$os_text['netmanplus'] = "NetMan Plus";
$os_text['akcp'] = "AKCP SensorProbe";
$os_text['minkelsrms'] = "Minkels RMS";
$os_text['papouch-tme'] = "Papouch TME";
if(!$config['graph_colours']['greens']) { if(!$config['graph_colours']['greens']) {
$config['graph_colours']['greens'] = array('B6D14B','91B13C','6D912D','48721E','24520F','003300'); $config['graph_colours']['greens'] = array('B6D14B','91B13C','6D912D','48721E','24520F','003300');

View File

@ -53,7 +53,7 @@ while ($device = mysql_fetch_array($device_query)) {
$device_start = utime(); // Start counting device poll time $device_start = utime(); // Start counting device poll time
echo($device['hostname'] . " ".$device['device_id']." ".$device['os']." "); echo($device['hostname'] . " ".$device['device_id']." ".$device['os']." ");
if ($os_groups[$device['os']]) {$device['os_group'] = $os_groups[$device['os']]; echo "(".$device['os_group'].")";} if($config['os'][$device['os']]['group']) {$device['os_group'] = $config['os'][$device['os']]['group']; echo "(".$device['os_group'].")";}
echo("\n"); echo("\n");
unset($poll_update); unset($poll_update_query); unset($poll_separator); unset($version); unset($uptime); unset($features); unset($poll_update); unset($poll_update_query); unset($poll_separator); unset($version); unset($uptime); unset($features);