From 9a0e58fbc553c072ab08caa85ea15b4bdaeddc9d Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Tue, 4 Nov 2008 12:34:30 +0000 Subject: [PATCH] new git-svn-id: http://www.observium.org/svn/observer/trunk@274 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/pages/front/default.php | 211 ++++++++++++++++++++++++++++++++++ html/pages/front/example1.php | 0 html/pages/front/example2.php | 173 ++++++++++++++++++++++++++++ 3 files changed, 384 insertions(+) create mode 100644 html/pages/front/default.php create mode 100644 html/pages/front/example1.php create mode 100644 html/pages/front/example2.php diff --git a/html/pages/front/default.php b/html/pages/front/default.php new file mode 100644 index 0000000000..8159311ffa --- /dev/null +++ b/html/pages/front/default.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 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 = ","; + } + + $sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Core: %' AND I.device_id = D.device_id ORDER BY I.ifAlias"; + $query = mysql_query($sql); + unset ($seperator); + while($interface = mysql_fetch_array($query)) { + $interfaces['core'] .= $seperator . $interface['interface_id']; + $seperator = ","; + } + + if($interfaces['transit']) { + echo("', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". + "
Internet Transit
". + "
"); + } + + if($interfaces['peering']) { + echo("', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". + "
Internet Peering
". + "
"); + } + + if($interfaces['core']) { + echo("', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". + "
Core Links
". + "
"); + } + +} + +echo("
+ + + + + + + +
+"); + +#echo(""); + +/// END VOSTRON + +#} + +?> diff --git a/html/pages/front/example1.php b/html/pages/front/example1.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/html/pages/front/example2.php b/html/pages/front/example2.php new file mode 100644 index 0000000000..52f14801d5 --- /dev/null +++ b/html/pages/front/example2.php @@ -0,0 +1,173 @@ + + + + +?> + '0' AND A.attrib_value < '86400'"); + +while($device = mysql_fetch_array($sql)){ + unset($already); + $i = 0; + while ($i <= count($nodes)) { + $thisnode = $device['device_id']; + if ($nodes[$i] == $thisnode) { + $already = "yes"; + } + $i++; + } + if(!$already) { $nodes[] = $device['device_id']; } +} + + +$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'"); +while($device = mysql_fetch_array($sql)){ + + echo("
+
".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)){ + + echo("
+
".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)){ + + echo("
+
".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)){ + + echo("
+
".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)){ + + echo("
+
".generatedevicelink($device, shorthost($device['hostname']))."
+ Device
Rebooted

+ ".formatUptime($device['attrib_value'])." +
"); + +} + + + +echo(" + +
$errorboxes
+ +

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("
+
Devices with Alerts
Host
Int
Srv
"); +while($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); } +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 'L2TP: %' 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['l2tp'] .= $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 AND D.hostname LIKE '%"; + $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias"; + $query = mysql_query($sql); + unset ($seperator); + while($interface = mysql_fetch_array($query)) { + $interfaces['transit'] .= $seperator . $interface['interface_id']; + $seperator = ","; + } + + $sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Server: thlon-pbx%' 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['voip'] .= $seperator . $interface['interface_id']; + $seperator = ","; + } + + if($interfaces['transit']) { + echo("', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". + "
Internet Transit
". + "
"); + } + + if($interfaces['l2tp']) { + echo("', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". + "
L2TP ADSL
". + "
"); + } + + if($interfaces['voip']) { + echo("', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". + "
VoIP to PSTN
". + "
"); + } + +} + +/// END VOSTRON + +?> + + + + +