diff --git a/html/pages/default-jt.php b/html/pages/default-jt.php new file mode 100644 index 0000000000..b37bc86360 --- /dev/null +++ b/html/pages/default-jt.php @@ -0,0 +1,211 @@ + + $content +"); + + +# echo("
+# +# +# +# +# +# +#
+# ".$content." +#
+# +# +# +# +# +# +#
"); +} + +echo("
"); + +$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'"); +while($device = mysql_fetch_array($sql)){ + + generate_front_box("alert", "
".generatedevicelink($device, shorthost($device['hostname']))."
+ Device Down + ".truncate($device['location'], 20)." +
"); + + +} + +$sql = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); +while($interface = mysql_fetch_array($sql)){ + + generate_front_box("warn", "
".generatedevicelink($interface, shorthost($interface['hostname']))."
+ Port Down + + ".generateiflink($interface, makeshortif($interface['ifDescr']))."
+ ".truncate($interface['ifAlias'], 20)." +
"); + +} + +$sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.service_host = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'"); +while($service = mysql_fetch_array($sql)){ + + + generate_front_box("alert", "
".generatedevicelink($service, shorthost($service['hostname']))."
+ Service Down + ".$service['service_type']."
+ ".truncate($interface['ifAlias'], 20)." +
"); + +} + +$sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerState != 'established' AND B.device_id = D.device_id"); +while($peer = mysql_fetch_array($sql)){ + + generate_front_box("alert", "
".generatedevicelink($peer, shorthost($peer['hostname']))."
+ BGP Down + ".$peer['bgpPeerIdentifier']."
+ AS".$peer['bgpPeerRemoteAs']." ".truncate($peer['astext'], 10)." +
"); + +} + +$sql = mysql_query("SELECT * FROM `devices` AS D, devices_attribs AS A WHERE A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value < '84600'"); +while($device = mysql_fetch_array($sql)){ + + + generate_front_box("info", "
".generatedevicelink($device, shorthost($device['hostname']))."
+ Device
Rebooted

+ ".formatUptime($device['attrib_value'], 'short')." +
"); + +} + +if($config['frontpage_display'] == 'syslog') { + + ## Open Syslog Div + echo("
+

Recent Syslog Messages

+ "); + + $sql = "SELECT *, DATE_FORMAT(datetime, '%D %b %T') AS date from syslog ORDER BY datetime DESC LIMIT 20"; + $query = mysql_query($sql); + echo(""); + while($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); } + echo("
"); + + echo("
"); ## Close Syslog Div + +} else { + + ## Open eventlog Div + echo("
+

Recent Eventlog Entries

+ "); + +if($_SESSION['userlevel'] == '10') { + $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15"; +} else { + $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host = + P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,15"; +} + +$data = mysql_query($query); + +echo(""); + +while($entry = mysql_fetch_array($data)) { + include("includes/print-event.inc"); +} + +echo("
"); + + + echo("
"); ## Close Syslog Div + + +} + +echo("
"); + +echo("
+ + + + + + + +
"); + +/// this stuff can be customised to show whatever you want.... + +if($_SESSION['userlevel'] >= '5') { + + $sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Peering: %' AND I.device_id = D.device_id AND D.hostname LIKE '%"; + $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias"; + $query = mysql_query($sql); + unset ($seperator); + while($interface = mysql_fetch_array($query)) { + $interfaces['peering'] .= $seperator . $interface['interface_id']; + $seperator = ","; + } + + $sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id ORDER BY I.ifAlias"; + $query = mysql_query($sql); + unset ($seperator); + while($interface = mysql_fetch_array($query)) { + $interfaces['transit'] .= $seperator . $interface['interface_id']; + $seperator = ","; + } + + $interfaces['broadband'] = "2490,2509"; + $interfaces['wave_broadband'] = "2098"; + + if($interfaces['transit']) { + echo("', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". + "
Internet Transit
". + "
"); + } + + if($interfaces['broadband']) { + echo("', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". + "
Broadband
". + "
"); + } + + if($interfaces['wave_broadband']) { + echo("', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". + "
Wave Broadhand
". + "
"); + } + +} + +echo("
+ + + + + + + +
+"); + +#echo(""); + +/// END VOSTRON + +#} + +?> diff --git a/html/pages/device/ciscosensors.inc.php b/html/pages/device/ciscosensors.inc.php new file mode 100644 index 0000000000..559ec03b5d --- /dev/null +++ b/html/pages/device/ciscosensors.inc.php @@ -0,0 +1,36 @@ +"); + unset ($sep); + $query = mysql_query("SELECT `entSensorType` FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entSensorType != '' AND entSensorType NOT LIKE 'No%' GROUP BY `entSensorType` ORDER BY `entSensorType`"); + while($data = mysql_fetch_array($query)) { + $type = $data['entSensorType']; + if(!$_GET['opta']) { $_GET['opta'] = $type; } + echo($sep); + if($_GET['opta'] == $type) { echo(""); } + echo("" . htmlspecialchars($type) ."\n"); + if($_GET['opta'] == $type) { echo(""); } + $sep = ' | '; + } + unset ($sep); + echo(""); + + $query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' and entSensorType = '".$_GET['opta']."' ORDER BY `entPhysicalName`"); + while($data = mysql_fetch_array($query)) { + + if($data['entSensorMeasuredEntity']) { + $measured = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '".$data['entSensorMeasuredEntity']."'")); + } + + echo("

".$measured['entPhysicalName']." ".$data['entPhysicalName']."

"); + $graph_type = "cisco_entity_sensor"; + $args = "&a=".$data['entPhysical_id']; + + include("includes/print-device-graph.php"); + + echo("
"); + + + } + +?> diff --git a/html/pages/device/health.inc.php b/html/pages/device/health.inc.php new file mode 100644 index 0000000000..1408e6a04e --- /dev/null +++ b/html/pages/device/health.inc.php @@ -0,0 +1,34 @@ +"); + unset ($sep); + foreach ($datas as $type) { + if(!$_GET['opta']) { $_GET['opta'] = $type; } + echo($sep); + if($_GET['opta'] == $type) { echo(""); } + echo("" . $type_text[$type] ."\n"); + if($_GET['opta'] == $type) { echo(""); } + $sep = ' | '; + } + unset ($sep); + echo(""); + +if(is_file("pages/device/health/".mres($_GET['opta']).".inc.php")) { include("pages/device/health/".mres($_GET['opta']).".inc.php"); } + + +?> diff --git a/html/pages/device/health/storage.inc.php b/html/pages/device/health/storage.inc.php new file mode 100644 index 0000000000..3b2b675987 --- /dev/null +++ b/html/pages/device/health/storage.inc.php @@ -0,0 +1,79 @@ +"); + +echo(" + Drive + Usage + Used + Total + Free + + "); + +$row = 1; + +while($drive = mysql_fetch_array($query)) { + + if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + + $total = $drive['hrStorageSize'] * $drive['hrStorageAllocationUnits']; + $used = $drive['hrStorageUsed'] * $drive['hrStorageAllocationUnits']; + $perc = round($drive['storage_perc'], 0); + $total = formatStorage($total); + $used = formatStorage($used); + + $fs_url = "?page=device&id=".$device['device_id']."§ion=dev-storage"; + + $fs_popup = "onmouseover=\"return overlib('
".$device['hostname']." - ".$drive['hrStorageDescr']; + $fs_popup .= "
"; + $fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\""; + + $drv_colour = percent_colour($perc); + + echo("" . $drive['hrStorageDescr'] . " + + " . $perc . "%" . $total . "" . $used . ""); + + + $graph_type = "unixfs"; + +// start temperature graphs + + $daily_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$day&to=$now&width=212&height=100"; + $daily_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150"; + + $weekly_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$week&to=$now&width=212&height=100"; + $weekly_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150"; + + $monthly_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$month&to=$now&width=212&height=100"; + $monthly_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150"; + + $yearly_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$year&to=$now&width=212&height=100"; + $yearly_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150"; + + echo(""); + + echo("".$device['hostname']." - ".$drive['hrStorageDescr']."', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"> + "); + echo("".$device['hostname']." - ".$drive['hrStorageDescr']."', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"> + "); + echo("".$device['hostname']." - ".$drive['hrStorageDescr']."', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"> + "); + echo("".$device['hostname']." - ".$drive['hrStorageDescr']."', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"> + "); + + echo(""); + + + $row++; + +} + +echo(""); + + +?> diff --git a/html/pages/device/nagios.inc.php b/html/pages/device/nagios.inc.php new file mode 100644 index 0000000000..e9be08c812 --- /dev/null +++ b/html/pages/device/nagios.inc.php @@ -0,0 +1,34 @@ + 'Up', '1' => 'Down', '2' => 'Critical', '3' => 'Unknown'); +$host_text = array ('0' => 'Up', '1' => 'Down', '2' => 'Unreachable'); + +$host_colour = array ('0' => '#99ff99', '1' => '#ff9999', '2' => '#ff6666'); +$service_colour = array ('0' => '#99ff99', '1' => '#ff9999', '2' => '#ff6666', '3' => '#ffaa99'); + + +echo("
Status : " . $host_text[$nagios_hoststatus[current_state]] . " ".$nagios_hoststatus['output']."
"); + + +echo(""); +$nagios_services = mysql_query("SELECT * FROM nagios_services AS N, nagios_servicestatus AS S WHERE N.host_object_id = '".$nagios_host['host_object_id']."' AND S.service_object_id = N.service_object_id", $nagios_link); +while ($nagios_service = mysql_fetch_array($nagios_services)) { + if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } + echo(""); + $service_state = $nagios_service['current_state']; + echo(""); + echo(""); + $i++; +} + +echo("
" . $nagios_service['display_name'] . "".$service_text[$service_state]."" . $nagios_service['output'] . "
"); + + +?> diff --git a/html/pages/pseudowires.php b/html/pages/pseudowires.php new file mode 100644 index 0000000000..cbc7f5e5b0 --- /dev/null +++ b/html/pages/pseudowires.php @@ -0,0 +1,36 @@ +"); + +$sql = "SELECT * FROM pseudowires AS P, interfaces AS I, devices AS D WHERE P.interface_id = I.interface_id AND I.device_id = D.device_id ORDER BY D.hostname,I.ifDescr"; +$query = mysql_query($sql); + +while($pw_a = mysql_fetch_array($query)) { + $i = 0; + while ($i < count($linkdone)) { + $thislink = $pw_a['device_id'] . $pw_a['interface_id']; + if ($linkdone[$i] == $thislink) { $dupe = "yes"; } + $i++; + } + + + if($dupe) { + unset($dupe); + } else { + if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; } + $pw_b = mysql_fetch_array(mysql_query("SELECT * from `devices` AS D, `interfaces` AS I, `pseudowires` AS P WHERE D.device_id = '".$pw_a['peer_device_id']."' AND + D.device_id = I.device_id AND + P.cpwVcID = '".$pw_a['cpwVcID']."' AND + P.interface_id = I.interface_id")); + + echo("".$pw_a['cpwVcID']."".generatedevicelink($pw_a)."".generateiflink($pw_a)." + => + ".generatedevicelink($pw_b)."".generateiflink($pw_b).""); + echo("".$pw_a['ifAlias']."".$pw_b['ifAlias'].""); + $linkdone[] = $pw_b['device_id'] . $pw_b['interface_id']; + } +} + +echo(""); + +?> diff --git a/html/pages/purgeports.php b/html/pages/purgeports.php new file mode 100644 index 0000000000..3258918f99 --- /dev/null +++ b/html/pages/purgeports.php @@ -0,0 +1,40 @@ +Deleting IPv4 address " . $ipaddr['addr'] . "/" . $ipaddr['cidr'] ); + mysql_query("DELETE FROM addr WHERE id = '".$addr['id']."'"); + echo(""); + } + + $ip6addr = mysql_query("SELECT * FROM `ip6addr` WHERE `interface_id` = '$interface_id'"); + while($ip6addr = mysql_fetch_array($ip6addrs)) { + echo("
Deleting IPv6 address " . $ip6addr['ip6_comp_addr'] . "/" . $ip6addr['ip6_prefixlen'] ); + mysql_query("DELETE FROM ip6addr WHERE ip6_addr_id = '".$ip6addr['ip6_addr_id']."'"); + echo("
"); + } + + $ip6addr = mysql_query("SELECT * FROM `ip6addr` WHERE `interface_id` = '$interface_id'"); + while($ip6addr = mysql_fetch_array($ip6addrs)) { + echo("
Deleting IPv6 address " . $ip6addr['ip6_comp_addr'] . "/" . $ip6addr['ip6_prefixlen'] ); + mysql_query("DELETE FROM ip6addr WHERE ip6_addr_id = '".$ip6addr['ip6_addr_id']."'"); + echo("
"); + } + + mysql_query("DELETE FROM `pseudowires` WHERE `interface_id` = '$interface_id'"); + mysql_query("DELETE FROM `mac_accounting` WHERE `interface_id` = '$interface_id'"); + mysql_query("DELETE FROM `links` WHERE `src_if` = '$interface_id'"); + mysql_query("DELETE FROM `links` WHERE `dst_if` = '$interface_id'"); + mysql_query("DELETE FROM `interfaces_perms` WHERE `interface_id` = '$interface_id'"); + mysql_query("DELETE FROM `interfaces` WHERE `interface_id` = '$interface_id'"); + } + + $ports = mysql_query("SELECT * FROM `interfaces` WHERE `deleted` = '1'"); + while($port = mysql_fetch_array($ports)) { + echo("
Deleting port " . $port['interface_id'] . " - " . $port['ifDescr'] ); + delete_port($port['interface_id']); + echo("
"); + } + +?> diff --git a/html/pages/vrfs.php b/html/pages/vrfs.php new file mode 100644 index 0000000000..be525673fe --- /dev/null +++ b/html/pages/vrfs.php @@ -0,0 +1,46 @@ +"); + $i = "1"; + $vrf_query = mysql_query("SELECT * FROM `vrfs` GROUP BY `mplsVpnVrfRouteDistinguisher`"); + while($vrf = mysql_fetch_array($vrf_query)) { + + if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } + + echo(""); + + echo(""); + echo(""); + + echo(""); + + echo(""); + + + $i++; + } + echo("
" . $vrf['vrf_name'] . "" . $vrf['mplsVpnVrfRouteDistinguisher'] . "" . $vrf['mplsVpnVrfDescription'] . ""); + + $devices = mysql_query("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = '".$vrf['mplsVpnVrfRouteDistinguisher']."' AND D.device_id = V.device_id"); + $x=1; + while($device = mysql_fetch_array($devices)) { + if(!is_integer($i/2)) { + if(!is_integer($x/2)) { $dev_colour = $list_colour_a_a; } else { $dev_colour = $list_colour_a_b; } + } else { + if(!is_integer($x/2)) { $dev_colour = $list_colour_b_b; } else { $dev_colour = $list_colour_b_a; } + } + echo(""); + $x++; + } + + echo("
".generatedevicelink($device) . ""); + $interfaces = mysql_query("SELECT * FROM `interfaces` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); + unset($seperator); + while($interface = mysql_fetch_array($interfaces)) { + echo($seperator.generateiflink($interface,makeshortif($interface['ifDescr']))); + $seperator = ", "; + } + echo("
"); + +?> +