diff --git a/config.php.default b/config.php.default index fb2aa9e98f..3edc0f134f 100755 --- a/config.php.default +++ b/config.php.default @@ -52,6 +52,9 @@ $config['mono_font'] = $config['install_dir'] . "/fonts/DejaVuSansMono.ttf"; $config['favicon'] = "favicon.ico"; $config['header_color'] = "#1F334E"; +## Custom pre-login message +$config['login_message'] = ""; + $config['page_refresh'] = "0"; ## Refresh the page every xx seconds $config['front_page'] = "pages/front/default.php"; @@ -101,9 +104,24 @@ $config['ignore_mount'] = array("/kern", "/mnt/cdrom", "/dev", "/dev/pts", "/pro ### Style Options +# Alternating list colours + $list_colour_a = "#ffffff"; $list_colour_b = "#eeeeee"; +# Alternating list-within-list colours + +$list_colour_a_a = "#f9f9f9"; +$list_colour_a_b = "#f0f0f0"; + +$list_colour_b_a = "#e9e9e9"; +$list_colour_b_b = "#e0e0e0"; + + +$warn_colour_a = "#ffeeee"; +$warn_colour_b = "#ffcccc"; + + $warn_colour_a = "#ffeeee"; $warn_colour_b = "#ffcccc"; diff --git a/discover-cdp.php b/discover-cdp.php index f13a5d8e0a..d308eee243 100755 --- a/discover-cdp.php +++ b/discover-cdp.php @@ -39,8 +39,6 @@ while ($device = mysql_fetch_array($device_query)) { $cdp_links = trim($cdp_links); -# echo("\n$cdp_links\n\n"); - foreach ( explode("\n" ,$cdp_links) as $link ) { if ($link == "") { break; } list($src_host,$src_if, $dst_host, $dst_if) = explode(",", $link); diff --git a/html/includes/print-interface.inc b/html/includes/print-interface.inc index 802cc136d2..66769c8d4e 100644 --- a/html/includes/print-interface.inc +++ b/html/includes/print-interface.inc @@ -47,7 +47,7 @@ echo(""); if(mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0)){ - echo(" Mac Acc"); + echo(" Mac Acc"); } echo(""); diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 37f2651513..fadfc1e9a5 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -128,6 +128,8 @@ if($config['enable_billing']) { echo("
  • Pseudowires
  • "); $ifbreak = 1;} +if($config['enable_pseudowires']) { echo("
  • VRFs
  • "); $ifbreak = 1;} + if($_SESSION['userlevel'] >= '5') { echo("

  • "); diff --git a/html/pages/device.php b/html/pages/device.php index cdacfe172a..e0cabe53d0 100644 --- a/html/pages/device.php +++ b/html/pages/device.php @@ -24,11 +24,16 @@ echo("
    "); echo("
    "); @@ -53,27 +55,59 @@ echo(" " . $peer['bgpPeerOutUpdates'] . ""); - if($_GET['opta']) { foreach(explode(" ", $_GET['opta']) as $graph_type) { if($graph_type == "cbgp_prefixes") { list($afi, $safi) = explode(".", $_GET['optb']); $afisafi = "&afi=$afi&safi=$safi"; } - if($graph_type == "bgp_updates" || $valid_afi_safi[$afi][$safi]) { - $daily_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100$afisafi"; - $daily_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150$afisafi"; - $weekly_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100$afisafi"; - $weekly_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150$afisafi"; - $monthly_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100$afisafi"; - $monthly_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150$afisafi"; - $yearly_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100$afisafi"; - $yearly_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150$afisafi"; - echo(""); - echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> "); - echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">"); - echo(""); + if($graph_type == "bgp_updates" || $valid_afi_safi[$afi][$safi]) { + $daily_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100$afisafi"; + $daily_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150$afisafi"; + $weekly_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100$afisafi"; + $weekly_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150$afisafi"; + $monthly_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100$afisafi"; + $monthly_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150$afisafi"; + $yearly_traffic = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100$afisafi"; + $yearly_url = $config['base_url'] . "/graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150$afisafi"; + echo(""); + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> "); + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">"); + echo(""); + } + if ($_GET['opta'] == "macaccounting") { + + if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ipv4_mac` AS I, mac_accounting AS M WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address"),0)) { + + $acc = mysql_fetch_array(mysql_query("SELECT * FROM `ipv4_mac` AS I, mac_accounting AS M WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address")); + + $graph_type = "mac_acc"; + + $daily_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100"; + $daily_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150"; + + $weekly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100"; + $weekly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150"; + + $monthly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100"; + $monthly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150"; + + $yearly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100"; + $yearly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150"; + + echo(""); + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> + "); + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> + "); + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> + "); + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> + "); + echo(""); + } - } - } + + } +} $i++; } echo(""); diff --git a/html/pages/device/entphysical.inc.php b/html/pages/device/entphysical.inc.php index cf1c61c127..57f34098c7 100644 --- a/html/pages/device/entphysical.inc.php +++ b/html/pages/device/entphysical.inc.php @@ -2,20 +2,32 @@ function printEntPhysical($ent, $level, $class) { - $query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn"); + global $device; + + $query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn,entPhysicalIndex"); while($ent = mysql_fetch_array($query)) { - echo("
  • "); + echo(" +
  • "); if($ent['entPhysicalClass'] == "chassis") { echo(" "); } if($ent['entPhysicalClass'] == "module") { echo(" "); } if($ent['entPhysicalClass'] == "port") { echo(" "); } if($ent['entPhysicalClass'] == "container") { echo(" "); } - if($ent['entPhysicalClass'] == "sensor") { echo(" "); } + if($ent['entPhysicalClass'] == "sensor") { + echo(" "); + $link = " href='".$config['base_url'] . "/device/".$device['device_id']."/ciscosensors/".$ent['entSensorType']."/' onmouseover=\"return overlib('', LEFT,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\""; + } else { unset ($link); } if($ent['entPhysicalClass'] == "backplane") { echo(" "); } - if($ent['entPhysicalParentRelPos'] > '-1') {echo("".$ent['entPhysicalParentRelPos'].". ");} - if($ent['entPhysicalModelName'] && $ent['entPhysicalName']) { + if($link) {echo("");} + + if($ent['ifIndex']) { + $interface = mysql_fetch_array(mysql_query("SELECT * FROM `interfaces` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'")); + $ent['entPhysicalName'] = generateiflink($interface); + } + + if ($ent['entPhysicalModelName'] && $ent['entPhysicalName']) { echo("".$ent['entPhysicalModelName'] . " (".$ent['entPhysicalName'].")"); } elseif($ent['entPhysicalModelName']) { echo("".$ent['entPhysicalModelName'] . ""); @@ -23,12 +35,16 @@ function printEntPhysical($ent, $level, $class) { echo("".$ent['entPhysicalName'].""); } elseif($ent['entPhysicalDescr']) { echo("".$ent['entPhysicalDescr'].""); + } + + if($ent['entPhysicalClass'] == "sensor") { + echo(" (".$ent['entSensorValue'] ." ". $ent['entSensorType'].")"); } - - echo("
    " . $ent['entPhysicalDescr']); + if($link) {echo("");} + if($ent['entPhysicalSerialNum']) { echo("
    Serial No. ".$ent['entPhysicalSerialNum']." "); } diff --git a/html/pages/device/health/cemp.inc.php b/html/pages/device/health/cemp.inc.php new file mode 100644 index 0000000000..48bcddff76 --- /dev/null +++ b/html/pages/device/health/cemp.inc.php @@ -0,0 +1,62 @@ +"); + echo(""); + $i = '1'; + $mempools = mysql_query("SELECT * FROM `cempMemPool` WHERE device_id = '" . $device['device_id'] . "'"); + while($mempool = mysql_fetch_array($mempools)) { + if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + $entPhysicalName = mysql_result(mysql_query("SELECT entPhysicalName from entPhysical WHERE device_id = '".$device['device_id']."' + AND entPhysicalIndex = '".$mempool['entPhysicalIndex']."'"),0); + $perc = round($mempool['cempMemPoolUsed'] / ($mempool['cempMemPoolUsed'] + $mempool['cempMemPoolFree']) * 100,2); + $mempool['descr_fixed'] = $entPhysicalName . " ". $mempool['cempMemPoolName']; +# $mempool['descr_fixed'] = str_replace("Routing Processor", "RP", $mempool['descr_fixed']); +# $mempool['descr_fixed'] = str_replace("Switching Processor", "SP", $mempool['descr_fixed']); +# $mempool['descr_fixed'] = str_replace("Processor", "Proc", $mempool['descr_fixed']); + + $proc_url = "?page=device/".$device['device_id']."/sensors/mempools/"; + + $mempool_popup = "onmouseover=\"return overlib('
    ".$device['hostname']." - ".$mempool['descr_fixed']; + $mempool_popup .= "
    "; + $mempool_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; + + + if($mempool['cpuCPMTotal5minRev'] > '60') { $mempool_colour='#cc0000'; } else { $mempool_colour='#0000cc'; } + echo(" + + + + "); + + echo(""); + + + $i++; + } + echo("
    " . $mempool['descr_fixed'] ."$perc%" . formatstorage($mempool['cempMemPoolFree'], 0) . "/" . formatstorage($mempool['cempMemPoolUsed'] + $mempool['cempMemPoolFree'], 0) . "
    "); + + $daily_graph = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$day&to=$now&width=211&height=100"; + $daily_url = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$day&to=$now&width=400&height=150"; + + $weekly_graph = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$week&to=$now&width=211&height=100"; + $weekly_url = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$week&to=$now&width=400&height=150"; + + $monthly_graph = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$month&to=$now&width=211&height=100"; + $monthly_url = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$month&to=$now&width=400&height=150"; + + $yearly_graph = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$year&to=$now&width=211&height=100"; + $yearly_url = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$year&to=$now&width=400&height=150"; + + echo("', LEFT);\" onmouseout=\"return nd();\"> + "); + echo("', LEFT);\" onmouseout=\"return nd();\"> + "); + echo("', LEFT);\" onmouseout=\"return nd();\"> + "); + echo("', LEFT);\" onmouseout=\"return nd();\"> + "); + echo("
    "); + echo("
    "); + + +?> diff --git a/html/pages/device/health/cpm.inc.php b/html/pages/device/health/cpm.inc.php new file mode 100644 index 0000000000..8298000a14 --- /dev/null +++ b/html/pages/device/health/cpm.inc.php @@ -0,0 +1,52 @@ +"); + echo(""); + $i = '1'; + $procs = mysql_query("SELECT * FROM `cpmCPU` WHERE device_id = '" . $device['device_id'] . "'"); + while($proc = mysql_fetch_array($procs)) { + + $proc_url = "?page=device/".$device['device_id']."/health/cpm/"; + + $proc_popup = "onmouseover=\"return overlib('
    ".$device['hostname']." - ".$proc['entPhysicalDescr']; + $proc_popup .= "
    "; + $proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; + + if($proc['cpuCPMTotal5minRev'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; } + echo(" + + + "); + + echo(""); + + + $i++; + } + echo("
    " . $proc['entPhysicalDescr'] . "" . $proc['cpmCPUTotal5minRev'] . "%
    "); + + $daily_graph = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$day&to=$now&width=211&height=100"; + $daily_url = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$day&to=$now&width=400&height=150"; + + $weekly_graph = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$week&to=$now&width=211&height=100"; + $weekly_url = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$week&to=$now&width=400&height=150"; + + $monthly_graph = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$month&to=$now&width=211&height=100"; + $monthly_url = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$month&to=$now&width=400&height=150"; + + $yearly_graph = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$year&to=$now&width=211&height=100"; + $yearly_url = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$year&to=$now&width=400&height=150"; + + echo("', LEFT);\" onmouseout=\"return nd();\"> + "); + echo("', LEFT);\" onmouseout=\"return nd();\"> + "); + echo("', LEFT);\" onmouseout=\"return nd();\"> + "); + echo("', LEFT);\" onmouseout=\"return nd();\"> + "); + echo("
    "); + echo(""); + + +?> diff --git a/html/pages/device/temp.inc.php b/html/pages/device/health/temp.inc.php similarity index 87% rename from html/pages/device/temp.inc.php rename to html/pages/device/health/temp.inc.php index cd907a57f5..af3758e5df 100644 --- a/html/pages/device/temp.inc.php +++ b/html/pages/device/health/temp.inc.php @@ -5,21 +5,14 @@ $query = mysql_query($sql); echo(""); -echo(" - - - - - "); - $row = 1; while($temp = mysql_fetch_array($query)) { - if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + if(!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } echo(" - + diff --git a/html/pages/device/interface.inc.php b/html/pages/device/interface.inc.php index 2fe90c9bd8..7f7522b9f2 100644 --- a/html/pages/device/interface.inc.php +++ b/html/pages/device/interface.inc.php @@ -48,25 +48,34 @@ if( !$broke) echo("
    "); -if(file_exists("rrd/" . $hostname . "/". $ifIndex . ".rrd")) { +if($_GET['optb']) { - $iid = $id; - echo("
    Interface Traffic
    "); - $graph_type = "bits"; - include("includes/print-interface-graphs.php"); +include("pages/device/".mres($_GET['optb']).".php"); - echo("
    Interface Packets
    "); - $graph_type = "pkts"; - include("includes/print-interface-graphs.php"); +} else { - echo("
    Interface Non Unicast
    "); - $graph_type = "nupkts"; - include("includes/print-interface-graphs.php"); + if(file_exists("rrd/" . $hostname . "/". $ifIndex . ".rrd")) { - echo("
    Interface Errors
    "); - $graph_type = "errors"; - include("includes/print-interface-graphs.php"); + $iid = $id; + echo("
    Interface Traffic
    "); + $graph_type = "bits"; + include("includes/print-interface-graphs.php"); + + echo("
    Interface Packets
    "); + $graph_type = "pkts"; + include("includes/print-interface-graphs.php"); + + echo("
    Interface Non Unicast
    "); + $graph_type = "nupkts"; + include("includes/print-interface-graphs.php"); + + echo("
    Interface Errors
    "); + $graph_type = "errors"; + include("includes/print-interface-graphs.php"); + + } } + ?> diff --git a/html/pages/device/macaccounting.php b/html/pages/device/macaccounting.php new file mode 100644 index 0000000000..fe401cfb44 --- /dev/null +++ b/html/pages/device/macaccounting.php @@ -0,0 +1,89 @@ +Disabled"; } + if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "down") { $status = "Enabled / Disconnected"; } + if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "up") { $status = "Enabled / Connected"; } + + $i = 1; + $inf = fixifName($ifname); + + $bg="#ffffff"; + + $query = mysql_query("SELECT *, (M.bps_in + M.bps_out) as bps FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.interface_id = '".$interface['interface_id']."' AND I.interface_id = M.interface_id AND I.device_id = D.device_id ORDER BY bps DESC"); + + while($acc = mysql_fetch_array($query)) { + + $addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'")); + $name = gethostbyaddr($addy['ipv4_address']); + + if($name == $addy['ipv4_address']) { unset ($name); } + + if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; } + if(mysql_result(mysql_query("SELECT count(*) FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"),0)) { + + $peer_query = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"); + $peer_info = mysql_fetch_array($peer_query); + + } else { unset ($peer_info); } + + echo("
    "); + + if($peer_info) { $asn = "AS".$peer_info['bgpPeerRemoteAs']; $astext = $peer_info['astext']; } else { + unset ($as); unset ($astext); + } + + echo(" +
    SensorCurrentAlertNotes
    " . $temp['temp_descr'] . "" . $temp['temp_descr'] . " " . print_temperature($temp['temp_current'], $temp['temp_limit']) . " " . $temp['temp_limit'] . " " . $temp['temp_notes'] . "
    + + + + + + + +
    ".mac_clean_to_readable($acc['mac'])."".$addy['ipv4_address']."".$name."".formatRates($acc['bps_in'])."".formatRates($acc['bps_out'])."
    + "); + + $peer_info['astext']; + + + $graph_type = "mac_acc"; + + $daily_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100"; + $daily_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150"; + + $weekly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100"; + $weekly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150"; + + $monthly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100"; + $monthly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150"; + + $yearly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100"; + $yearly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150"; + + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> + "); + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> + "); + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> + "); + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> + "); + + + echo(""); + + } + +?> diff --git a/html/pages/device/overview.inc.php b/html/pages/device/overview.inc.php index e839d09aa4..78e5dffb25 100644 --- a/html/pages/device/overview.inc.php +++ b/html/pages/device/overview.inc.php @@ -40,14 +40,14 @@ if(mysql_result(mysql_query("SELECT count(*) from cpmCPU WHERE device_id = '" . $procs = mysql_query("SELECT * FROM `cpmCPU` WHERE device_id = '" . $device['device_id'] . "'"); while($proc = mysql_fetch_array($procs)) { - $proc_url = "?page=device/".$device['device_id']."/sensors/processors/"; + $proc_url = "?page=device/".$device['device_id']."/health/cpm/"; $proc_popup = "onmouseover=\"return overlib('
    ".$device['hostname']." - ".$proc['entPhysicalDescr']; $proc_popup .= "
    "; $proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\""; if($proc['cpuCPMTotal5minRev'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; } - echo("" . $proc['entPhysicalDescr'] . " + echo("" . $proc['entPhysicalDescr'] . " " . $proc['cpmCPUTotal5minRev'] . "% "); @@ -80,7 +80,7 @@ if(mysql_result(mysql_query("SELECT count(*) from cempMemPool WHERE device_id = if($mempool['cpuCPMTotal5minRev'] > '60') { $mempool_colour='#cc0000'; } else { $mempool_colour='#0000cc'; } - echo("" . $mempool['descr_fixed'] ." + echo("" . $mempool['descr_fixed'] ." $perc% " . formatstorage($mempool['cempMemPoolFree'], 0) . "/" . formatstorage($mempool['cempMemPoolUsed'] + $mempool['cempMemPoolFree'], 0) . " @@ -107,7 +107,7 @@ if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE host_id $total = formatStorage($total); $used = formatStorage($used); - $fs_url = "?page=device&id=".$device['device_id']."§ion=dev-storage"; + $fs_url = "/device/".$device['device_id']."/health/storage/"; $fs_popup = "onmouseover=\"return overlib('
    ".$device['hostname']." - ".$drive['hrStorageDescr']; $fs_popup .= "
    "; @@ -115,7 +115,7 @@ if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE host_id if($perc > '80') { $drv_colour='#cc0000'; } else { $drvclass='#0000cc'; } echo("" . $drive['hrStorageDescr'] . " - + " . $drive['perc'] . "% " . $total . " " . $used . " @@ -144,7 +144,7 @@ if(mysql_result(mysql_query("SELECT count(temp_id) from temperature WHERE temp_h $temp_colour = percent_colour($temp_perc); $temp_url = "graph.php?id=" . $temp['temp_id'] . "&type=temp&from=$month&to=$now&width=400&height=125"; - $temp_link = ""; $temp_link .= $temp['temp_descr'] . ""; diff --git a/html/pages/device/snmpwalk.inc.php b/html/pages/device/snmpwalk.inc.php deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/html/pages/iftype.php b/html/pages/iftype.php index 787a897603..03fdd300c7 100644 --- a/html/pages/iftype.php +++ b/html/pages/iftype.php @@ -37,7 +37,7 @@ if($_GET['type']) { ".generatedevicelink($interface)." ".generateiflink($interface)." "); if(mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0)){ - echo(" MAC Accounting"); + echo(" MAC Accounting"); } diff --git a/html/pages/logon.inc b/html/pages/logon.inc index 25a13f27ea..f197cf9d36 100644 --- a/html/pages/logon.inc +++ b/html/pages/logon.inc @@ -25,9 +25,7 @@ "); if($auth_message) { - -echo("$auth_message"); - + echo("$auth_message"); } echo(" @@ -35,4 +33,9 @@ echo(" "); + +if($config['login_message']) { + echo("
    ".$config['login_message']."
    "); +} + ?> diff --git a/html/pages/preferences.php b/html/pages/preferences.php index b5e9631527..0bd88a9406 100644 --- a/html/pages/preferences.php +++ b/html/pages/preferences.php @@ -6,13 +6,8 @@ include("includes/update-preferences-password.inc.php"); echo("
    "); -$pref_sql = "SELECT * FROM user_prefs" - - - echo("
    "); - echo("
    "); echo("
    "); echo("
    Change Password
    "); diff --git a/includes/common.php b/includes/common.php index 7c17d00621..40fae3b697 100644 --- a/includes/common.php +++ b/includes/common.php @@ -2,6 +2,12 @@ ## Common Functions +function getifhost($id) { + $sql = mysql_query("SELECT `device_id` from `interfaces` WHERE `interface_id` = '$id'"); + $result = @mysql_result($sql, 0); + return $result; +} + function gethostbyid($id) { $sql = mysql_query("SELECT `hostname` FROM `devices` WHERE `device_id` = '$id'"); $result = @mysql_result($sql, 0); diff --git a/includes/discovery/cisco-physical.php b/includes/discovery/cisco-physical.php index e492c99f55..02130a4e16 100755 --- a/includes/discovery/cisco-physical.php +++ b/includes/discovery/cisco-physical.php @@ -13,7 +13,7 @@ foreach(explode("\n", $ents) as $entPhysicalIndex) { - $ent_data = $config['snmpget'] . " -m ENTITY-MIB -Ovqs -"; + $ent_data = $config['snmpget'] . " -m ENTITY-MIB:IF-MIB -Ovqs -"; $ent_data .= $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] .":".$device['port']; $ent_data .= " entPhysicalDescr." . $entPhysicalIndex; $ent_data .= " entPhysicalContainedIn." . $entPhysicalIndex; @@ -28,7 +28,8 @@ list($entPhysicalDescr,$entPhysicalContainedIn,$entPhysicalClass,$entPhysicalName,$entPhysicalSerialNum,$entPhysicalModelName,$entPhysicalMfgName,$entPhysicalVendorType,$entPhysicalParentRelPos, $ifIndex) = explode("\n", `$ent_data`); - if(strpos($ifIndex, "o") || $ifIndex == "") { unset($ifIndex); } + if(!strpos($ifIndex, "fIndex") || $ifIndex == "") { unset($ifIndex); } + list(,$ifIndex) = explode(".", $ifIndex); $entPhysicalModelName = trim($entPhysicalModelName); $entPhysicalSerialNum = trim($entPhysicalSerialNum); @@ -39,12 +40,17 @@ $entPhysicalModelName = $entPhysicalVendorTypes[$entPhysicalVendorType]; } - if(mysql_result(mysql_query("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"),0)) { - - ### TO DO : WRITE CODE FOR UPDATES! + $entPhysical_id = @mysql_result(mysql_query("SELECT entPhysical_id FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"),0); + if($entPhysical_id) { + $sql = "UPDATE `entPhysical` SET `ifIndex` = '$ifIndex'"; + $sql .= ", entPhysicalIndex = '$entPhysicalIndex', entPhysicalDescr = '$entPhysicalDescr', entPhysicalClass = '$entPhysicalClass', entPhysicalName = '$entPhysicalName'"; + $sql .= ", entPhysicalModelName = '$entPhysicalModelName', entPhysicalSerialNum = '$entPhysicalSerialNum', entPhysicalContainedIn = '$entPhysicalContainedIn'"; + $sql .= ", entPhysicalMfgName = '$entPhysicalMfgName', entPhysicalParentRelPos = '$entPhysicalParentRelPos', entPhysicalVendorType = '$entPhysicalVendorType'"; + $sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"; + + mysql_query($sql); echo("."); - } else { $sql = "INSERT INTO `entPhysical` ( `device_id` , `entPhysicalIndex` , `entPhysicalDescr` , `entPhysicalClass` , `entPhysicalName` , `entPhysicalModelName` , `entPhysicalSerialNum` , `entPhysicalContainedIn`, `entPhysicalMfgName`, `entPhysicalParentRelPos`, `entPhysicalVendorType`, `ifIndex` ) "; $sql .= "VALUES ( '" . $device['device_id'] . "', '$entPhysicalIndex', '$entPhysicalDescr', '$entPhysicalClass', '$entPhysicalName', '$entPhysicalModelName', '$entPhysicalSerialNum', '$entPhysicalContainedIn', '$entPhysicalMfgName','$entPhysicalParentRelPos' , '$entPhysicalVendorType', '$ifIndex')"; @@ -55,17 +61,23 @@ if($entPhysicalClass == "sensor") { $sensor_cmd = $config['snmpget'] . " -m CISCO-ENTITY-SENSOR-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; $sensor_cmd .= " entSensorType.$entPhysicalIndex entSensorScale.$entPhysicalIndex entSensorPrecision.$entPhysicalIndex"; - $sensor_cmd .= " entSensorMeasuredEntity.$entPhysicalIndex"; - + $sensor_cmd .= " entSensorValueUpdateRate.$entPhysicalIndex entSensorMeasuredEntity.$entPhysicalIndex"; $sensor_data = shell_exec($sensor_cmd); - list($entSensorType,$entSensorScale,$entSensorPrecision,$entSensorValueUpdateRate,$entSensorMeasuredEntity) = explode("\n", $sensor_data); + if($entSensorMeasuredEntity) { + echo("M:$entSensorMeasuredEntity"); + } + if($config['allow_entity_sensor'][$entSensorType]) { + $sql = "UPDATE `entPhysical` SET entSensorType = '$entSensorType', entSensorScale = '$entSensorScale', entSensorPrecision = '$entSensorPrecision', "; + $sql .= " entSensorMeasuredEntity = '$entSensorMeasuredEntity'"; + $sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"; + } else { + echo("!$entSensorType"); + $sql = "UPDATE `entPhysical` SET entSensorType = '', entSensorScale = '', entSensorPrecision = '', entSensorMeasuredEntity = ''"; + $sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"; + } - $sql = "UPDATE `entPhysical` SET entSensorType = '$entSensorType', entSensorScale = '$entSensorScale', entSensorPrecision = '$entSensorPrecision', "; - $sql .= " entSensorMeasuredEntity = '$entSensorMeasuredEntity'"; - $sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"; mysql_query($sql); - } $valid[$entPhysicalIndex] = 1; } @@ -74,12 +86,11 @@ $sql = "SELECT * FROM `entPhysical` WHERE `device_id` = '".$device['device_id']."'"; $query = mysql_query($sql); - while ($test = mysql_fetch_array($query)) { - $id = $test['entPhysical_id']; + $id = $test['entPhysicalIndex']; if(!$valid[$id]) { echo("-"); -# mysql_query("DELETE FROM `entPhysical` WHERE entPhysical_id = '".$test['entPhysical_id']."'"); + mysql_query("DELETE FROM `entPhysical` WHERE entPhysical_id = '".$test['entPhysical_id']."'"); } } diff --git a/includes/discovery/storage.php b/includes/discovery/storage.php index 49eb5c3ef6..9dfb02c2b8 100755 --- a/includes/discovery/storage.php +++ b/includes/discovery/storage.php @@ -10,9 +10,9 @@ foreach(explode("\n", $oids) as $data) { $data = trim($data); list($oid,$hrStorageIndex) = explode(" ", $data); - $temp = shell_exec($config['snmpget'] . " -m HOST-RESOURCES-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " hrStorageDescr.$oid hrStorageAllocationUnits.$oid hrStorageSize.$oid hrStorageType.$oid"); + $temp = shell_exec($config['snmpget'] . " -m HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " hrStorageDescr.$oid hrStorageAllocationUnits.$oid hrStorageSize.$oid hrStorageType.$oid"); $temp = trim($temp); - list($descr, $units, $size, $type) = explode("\n", $temp); + list($descr, $units, $size, $fstype) = explode("\n", $temp); list($units) = explode(" ", $units); $allow = 1; @@ -23,7 +23,9 @@ } } - if(strstr($type, "FixedDisk") && $size > '0' && $allow) { + echo("$fstype\n"); + + if(strstr($fstype, "FixedDisk") && $size > '0' && $allow) { if(mysql_result(mysql_query("SELECT count(storage_id) FROM `storage` WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'"),0) == '0') { $query = "INSERT INTO storage (`host_id`, `hrStorageIndex`, `hrStorageDescr`,`hrStorageSize`,`hrStorageAllocationUnits`) "; $query .= "values ('".$device['device_id']."', '$hrStorageIndex', '$descr', '$size', '$units')"; diff --git a/includes/functions.php b/includes/functions.php index a866a0ce70..be87a847c0 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -634,12 +634,6 @@ function hoststatus($id) { return $result; } -function getifhost($id) { - $sql = mysql_query("SELECT `device_id` from `interfaces` WHERE `interface_id` = '$id'"); - $result = @mysql_result($sql, 0); - return $result; -} - function match_network ($nets, $ip, $first=false) { $return = false; if (!is_array ($nets)) $nets = array ($nets); diff --git a/test-discovery.php b/test-discovery.php index c5a97de7e5..0fbf4b66d0 100755 --- a/test-discovery.php +++ b/test-discovery.php @@ -42,7 +42,7 @@ $devices_polled = 0; $device_query = mysql_query("SELECT * FROM `devices` WHERE status = '1' $where ORDER BY device_id ASC"); while ($device = mysql_fetch_array($device_query)) { - echo("\n" . $device['hostname'] ."\n"); + echo("includes/discovery/".$type.".php"); include("includes/discovery/".$type.".php");