mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Tidy the things...
git-svn-id: http://www.observium.org/svn/observer/trunk@169 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -67,24 +67,28 @@ $config['email_headers'] = "From: " . $config['email_from'] . "\r\n";
|
||||
|
||||
|
||||
### Which interface sections should we show?
|
||||
$show_if_customers = 1;
|
||||
$show_if_transit = 0;
|
||||
$show_if_peering = 0;
|
||||
$show_if_core = 0;
|
||||
$show_if_l2tp =0;
|
||||
$show_locations = 1;
|
||||
$config['show_if_customers'] = 1;
|
||||
$config['show_if_transit'] = 0;
|
||||
$config['show_if_peering'] = 0;
|
||||
$config['show_if_core'] = 0;
|
||||
$config['show_if_l2tp'] = 0;
|
||||
$config['show_locations'] = 1;
|
||||
|
||||
$enable_syslog = 1;
|
||||
$config['enable_syslog'] = 1;
|
||||
|
||||
### Interface name strings to ignore
|
||||
$bif = array("null", "virtual-", "unrouted", "eobc", "mpls", "sl0", "lp0", "faith0",
|
||||
$config['bif'] = array("null", "virtual-", "unrouted", "eobc", "mpls", "sl0", "lp0", "faith0",
|
||||
"-atm layer", "-atm subif", "-shdsl", "-adsl", "-aal5", "-atm",
|
||||
"async", "plip", "-physical", "-signalling", "control plane",
|
||||
"bri", "-bearer", "ng", "bluetooth", "isatap", "ras", "qos", "miniport");
|
||||
|
||||
$bif = $config['bif']
|
||||
|
||||
### Mountpoints to ignore
|
||||
|
||||
$ignore_mount = array("/kern", "/mnt/cdrom", "/dev", "/dev/pts");
|
||||
$config['ignore_mount'] = array("/kern", "/mnt/cdrom", "/dev", "/dev/pts");
|
||||
$ignore_mount = $config['ignore_mount']
|
||||
|
||||
|
||||
### Valis OSes
|
||||
$valid_os = array("IOS", "Linux", "OpenBSD", "FreeBSD", "NetBSD", "ProCurve", "m0n0wall", "pfSense", "Snom", "Voswall", "DragonFly");
|
||||
|
@@ -3,10 +3,10 @@
|
||||
include("config.php");
|
||||
include("includes/functions.php");
|
||||
|
||||
if(!$config['enable_bgp']) { echo("BGP Support Disabled\n"); exit; }
|
||||
|
||||
### Discover BGP peers on Cisco devices
|
||||
|
||||
|
||||
$device_query = mysql_query("SELECT * FROM `devices` WHERE status = '1' AND os = 'IOS' ORDER BY device_id desc");
|
||||
while ($device = mysql_fetch_array($device_query)) {
|
||||
echo("\nPolling ". $device['hostname'] . "\n");
|
||||
@@ -38,41 +38,13 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `bgpPeers` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip'"),0) < '1') {
|
||||
$add = mysql_query("INSERT INTO bgpPeers (`device_id`, `bgpPeerIdentifier`, `bgpPeerRemoteAS`) VALUES ('".$device['device_id']."','$peer_ip','$peer_as')");
|
||||
if($add) { echo(" Added \n"); } else { echo(" Add failed\n"); }
|
||||
} else { echo(" Exists\n"); }
|
||||
} else {
|
||||
#<23>$peer_data = mysql_fetch_array(mysql_query("SELECT * FROM `bgpPeers``device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip' "));
|
||||
echo(" Exists\n");
|
||||
$update = mysql_query("UPDATE `bgpPeers` SET astext = '$astext' WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip'");
|
||||
}
|
||||
|
||||
### Poll BGP Peer
|
||||
|
||||
# $peer_cmd = $config['snmpget'] . " -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'] . " ";
|
||||
# $peer_cmd .= "bgpPeerState.$peer_ip bgpPeerAdminStatus.$peer_ip bgpPeerInUpdates.$peer_ip bgpPeerOutUpdates.$peer_ip bgpPeerInTotalMessages.$peer_ip ";
|
||||
# $peer_cmd .= "bgpPeerOutTotalMessages.$peer_ip bgpPeerFsmEstablishedTime.$peer_ip bgpPeerInUpdateElapsedTime.$peer_ip";
|
||||
# $peer_data = trim(shell_exec($peer_cmd));
|
||||
|
||||
# $peerrrd = $rrd_dir . "/" . $device['hostname'] . "/bgp-$peer_ip.rrd";
|
||||
|
||||
# if(!is_file($peerrrd)) {
|
||||
# $woo = `rrdtool create $peerrrd \
|
||||
# DS:bgpPeerOutUpdates:COUNTER:600:U:100000000000 \
|
||||
# DS:bgpPeerInUpdates:COUNTER:600:U:100000000000 \
|
||||
# DS:bgpPeerOutTotal:COUNTER:600:U:100000000000 \
|
||||
# DS:bgpPeerInTotal:COUNTER:600:U:100000000000 \
|
||||
# DS:bgpPeerEstablished:GAUGE:600:0:U \
|
||||
# RRA:AVERAGE:0.5:1:600 \
|
||||
# RRA:AVERAGE:0.5:6:700 \
|
||||
# RRA:AVERAGE:0.5:24:775 \
|
||||
# RRA:AVERAGE:0.5:288:797`;
|
||||
# }
|
||||
|
||||
# rrdtool_update($peerrrd, "N:$bgpPeerOutUpdates:$bgpPeerInUpdates:$bgpPeerOutTotalMessages:$bgpPeerInTotalMesages:$bgpPeerFsmEstablishedTime");
|
||||
|
||||
# list($bgpPeerState, $bgpPeerAdminStatus, $bgpPeerInUpdates, $bgpPeerOutUpdates, $bgpPeerInTotalMessages, $bgpPeerOutTotalMessages, $bgpPeerFsmEstablishedTime, $bgpPeerInUpdateElapsedTime) = explode("\n", $peer_data);
|
||||
|
||||
# $update = "UPDATE bgpPeers SET bgpPeerState = '$bgpPeerState', bgpPeerAdminStatus = '$bgpPeerAdminStatus', ";
|
||||
# $update .= "bgpPeerFsmEstablishedTime = '$bgpPeerFsmEstablishedTime', astext = '$astext'";
|
||||
# $update .= " WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip'";
|
||||
|
||||
# mysql_query($update);
|
||||
|
||||
} # end if $peer
|
||||
} # End if
|
||||
} # End foreach
|
||||
} # End BGP check
|
||||
} # End While
|
||||
|
@@ -8,8 +8,15 @@ RewriteCond %{REQUEST_URI} !^(.*)\.jpg$
|
||||
RewriteCond %{REQUEST_URI} !^(.*)\.gif$
|
||||
RewriteCond %{REQUEST_URI} !^(.*)\.png$
|
||||
|
||||
RewriteRule ^([a-z]+)$ ?page=$1
|
||||
## Rewrites for Devices
|
||||
|
||||
RewriteRule ^bills/([0-9]+) ?page=bills&bill=$1
|
||||
RewriteRule ^devices/location/(.+)/ ?page=devices&location=$1
|
||||
RewriteRule ^devices/alerted/ ?page=devices&status=alerted
|
||||
RewriteRule ^devices/alerted/ ?page=devices&status=alerted
|
||||
RewriteRule ^devices/(.+)/ ?page=devices&type=$1
|
||||
|
||||
RewriteRule ^bill/([0-9]+) ?page=bills&bill=$1
|
||||
RewriteRule ^device/([0-9]+) ?page=device&id=$1
|
||||
|
||||
RewriteRule ^([a-z]+)/$ ?page=$1
|
||||
|
||||
|
@@ -28,12 +28,12 @@
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
<li><a href="?page=overview"><img src='images/16/zoom.png' border=0 align=absmiddle> Overview</a></li>
|
||||
<li><a href="?page=eventlog"><img src='images/16/report.png' border=0 align=absmiddle> Eventlog</a></li>
|
||||
<li><a href="overview/"><img src='images/16/zoom.png' border=0 align=absmiddle> Overview</a></li>
|
||||
<li><a href="eventlog/"><img src='images/16/report.png' border=0 align=absmiddle> Eventlog</a></li>
|
||||
<?php if($enable_syslog) {
|
||||
echo("<li><a href='?page=syslog'><img src='images/16/page.png' border=0 align=absmiddle> Syslog</a></li>");
|
||||
echo("<li><a href='syslog/'><img src='images/16/page.png' border=0 align=absmiddle> Syslog</a></li>");
|
||||
} ?>
|
||||
<li><a href="?page=alerts"><img src='images/16/exclamation.png' border=0 align=absmiddle> Alerts</a></li>
|
||||
<li><a href="alerts/"><img src='images/16/exclamation.png' border=0 align=absmiddle> Alerts</a></li>
|
||||
</ul>
|
||||
</td></tr></table>
|
||||
<!--[if lte IE 6]></a><![endif]-->
|
||||
@@ -45,23 +45,23 @@
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
<li><a href='?page=devices'><img src='images/16/server.png' border=0 align=absmiddle> All Devices</a></li>
|
||||
<li><a href='devices/'><img src='images/16/server.png' border=0 align=absmiddle> All Devices</a></li>
|
||||
<?php
|
||||
|
||||
echo("
|
||||
<li><hr width=140 /></li>
|
||||
<li><a href='?page=devices&type=server'><img src='images/16/server.png' border=0 align=absmiddle> Servers</a></li>
|
||||
<li><a href='?page=devices&type=network'><img src='images/16/arrow_switch.png' border=0 align=absmiddle> Network</a></li>
|
||||
<li><a href='?page=devices&type=firewall'><img src='images/16/shield.png' border=0 align=absmiddle> Firewalls</a></li>");
|
||||
<li><a href='devices/server/'><img src='images/16/server.png' border=0 align=absmiddle> Servers</a></li>
|
||||
<li><a href='devices/network/'><img src='images/16/arrow_switch.png' border=0 align=absmiddle> Network</a></li>
|
||||
<li><a href='devices/firewall/'><img src='images/16/shield.png' border=0 align=absmiddle> Firewalls</a></li>");
|
||||
|
||||
echo(" <li><hr width=140 /></li>
|
||||
<li><a href='?page=devices&status=alerted'><img src='images/16/server_error.png' border=0 align=absmiddle> Alerts ($device_alerts)</a></li>");
|
||||
<li><a href='devices/alerted/'><img src='images/16/server_error.png' border=0 align=absmiddle> Alerts ($device_alerts)</a></li>");
|
||||
|
||||
if($_SESSION['userlevel'] >= '10') {
|
||||
echo("
|
||||
<li><hr width=140 /></li>
|
||||
<li><a href='?page=addhost'><img src='images/16/server_add.png' border=0 align=absmiddle> Add Device</a></li>
|
||||
<li><a href='?page=delhost'><img src='images/16/server_delete.png' border=0 align=absmiddle> Delete Device</a></li>");
|
||||
<li><a href='addhost/'><img src='images/16/server_add.png' border=0 align=absmiddle> Add Device</a></li>
|
||||
<li><a href='delhost/'><img src='images/16/server_delete.png' border=0 align=absmiddle> Delete Device</a></li>");
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -73,7 +73,7 @@ if($_SESSION['userlevel'] >= '10') {
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
<li><a href="?page=services"><img src='images/16/cog.png' border=0 align=absmiddle> All Services </a></li>
|
||||
<li><a href="services/"><img src='images/16/cog.png' border=0 align=absmiddle> All Services </a></li>
|
||||
<?php if($service_alerts) {
|
||||
echo(" <li><hr width=140 /></li>
|
||||
<li><a href='?page=services&status=0'><img src='images/16/cog_error.png' border=0 align=absmiddle> Alerts ($service_alerts)</a></li>");
|
||||
@@ -84,15 +84,20 @@ if($_SESSION['userlevel'] >= '10') {
|
||||
echo("
|
||||
|
||||
<li><hr width=140 /></li>
|
||||
<li><a href='?page=addsrv'><img src='images/16/cog_add.png' border=0 align=absmiddle> Add Service</a></li>
|
||||
<li><a href='?page=delsrv'><img src='images/16/cog_delete.png' border=0 align=absmiddle> Delete Service</a></li>");
|
||||
<li><a href='addsrv/'><img src='images/16/cog_add.png' border=0 align=absmiddle> Add Service</a></li>
|
||||
<li><a href='delsrv/'><img src='images/16/cog_delete.png' border=0 align=absmiddle> Delete Service</a></li>");
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</td></tr></table>
|
||||
<!--[if lte IE 6]></a><![endif]-->
|
||||
</li>
|
||||
<li><a class="menu2four" href="?page=locations"><img src='images/16/building.png' border=0 align=absmiddle> Locations</a></li>
|
||||
|
||||
<?php
|
||||
## Display Locations entry if $config['show_locations']
|
||||
if($config['show_locations']) { echo("<li><a class='menu2four' href='locations/'><img src='images/16/building.png' border=0 align=absmiddle> Locations</a></li>"); }
|
||||
?>
|
||||
|
||||
|
||||
<li><a><img src='images/16/connect.png' border=0 align=absmiddle> Ports
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
@@ -101,22 +106,18 @@ if($_SESSION['userlevel'] >= '10') {
|
||||
<ul>
|
||||
|
||||
|
||||
<li><a href='?page=interfaces'><img src='images/16/connect.png' border=0 align=absmiddle> All Ports</a></li>
|
||||
<li><a href='interfaces/'><img src='images/16/connect.png' border=0 align=absmiddle> All Ports</a></li>
|
||||
|
||||
<?php
|
||||
|
||||
if($_SESSION['userlevel'] >= '5') {
|
||||
echo("<li><hr width=140 /></li>");
|
||||
if($show_if_customers) { echo("<li><a href='?page=customers'><img src='images/16/group_link.png' border=0 align=absmiddle> Customers</a></li>"); $ifbreak = 1;}
|
||||
|
||||
if($show_if_bills) { echo("<li><a href='?page=bills'><img src='images/16/money_pound.png' border=0 align=absmiddle> Traffic Bills</a></li>"); $ifbreak = 1;}
|
||||
|
||||
if($show_if_l2tp) { echo("<li><a href='?page=iftype&type=l2tp'><img src='images/16/user.png'border=0 align=absmiddle> L2TP</a></li>"); $ifbreak = 1; }
|
||||
|
||||
if($show_if_transit) { echo("<li><a href='?page=iftype&type=transit'><img src='images/16/world_link.png' border=0 align=absmiddle> Transit</a></li>"); $ifbreak = 1; }
|
||||
if($show_if_peering) { echo("<li><a href='?page=iftype&type=peering'><img src='images/16/bug_link.png' border=0 align=absmiddle> Peering</a></li>"); $ifbreak = 1; }
|
||||
|
||||
if($show_if_core) { echo("<li><a href='?page=iftype&type=core'><img src='images/16/brick_link.png' border=0 align=absmiddle> Core</a></li>"); $ifbreak = 1;}
|
||||
if($config['int_customers']) { echo("<li><a href='customers/'><img src='images/16/group_link.png' border=0 align=absmiddle> Customers</a></li>"); $ifbreak = 1;}
|
||||
if($config['int_bills']) { echo("<li><a href='bills/'><img src='images/16/money_pound.png' border=0 align=absmiddle> Traffic Bills</a></li>"); $ifbreak = 1;}
|
||||
if($config['int_l2tp']) { echo("<li><a href='?page=iftype&type=l2tp'><img src='images/16/user.png'border=0 align=absmiddle> L2TP</a></li>"); $ifbreak = 1; }
|
||||
if($config['int_transit']) { echo("<li><a href='?page=iftype&type=transit'><img src='images/16/world_link.png' border=0 align=absmiddle> Transit</a></li>"); $ifbreak = 1; }
|
||||
if($config['int_peering']) { echo("<li><a href='?page=iftype&type=peering'><img src='images/16/bug_link.png' border=0 align=absmiddle> Peering</a></li>"); $ifbreak = 1; }
|
||||
if($config['int_core']) { echo("<li><a href='?page=iftype&type=core'><img src='images/16/brick_link.png' border=0 align=absmiddle> Core</a></li>"); $ifbreak = 1;}
|
||||
}
|
||||
|
||||
if($ifbreak && $interface_alerts) { echo("<li><hr width=140 /></li>"); }
|
||||
|
@@ -36,7 +36,7 @@ if(@mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id =
|
||||
</li>");
|
||||
}
|
||||
|
||||
if($device['bgpLocalAs']) {
|
||||
if($config['enable_bgp'] && $device['bgpLocalAs']) {
|
||||
echo("
|
||||
<li class=" . $select['dev-bgp'] . ">
|
||||
<a href='?page=device&id=" . $device['device_id'] . "§ion=dev-bgp' >
|
||||
|
@@ -1,22 +1,36 @@
|
||||
<?php
|
||||
|
||||
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
echo("<tr><td colspan=6><h2>Local AS : " . $device['bgpLocalAs'] . "</h2></td></tr>");
|
||||
|
||||
$i = "1";
|
||||
$peer_query = mysql_query("select * from bgpPeers WHERE device_id = '".$device['device_id']."' ORDER BY bgpPeerRemoteAs, bgpPeerIdentifier");
|
||||
while($peer = mysql_fetch_array($peer_query)) {
|
||||
|
||||
if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
if($peer['bgpPeerAdminStatus'] == "start") { $img = "images/16/accept.png"; } else { $img = "images/16/delete.png"; }
|
||||
#if($peer['bgpPeerAdminStatus'] == "start") { $img = "images/16/accept.png"; } else { $img = "images/16/delete.png"; }
|
||||
if($peer['bgpPeerState'] == "established") { $col = "green"; } else { $col = "red"; $bg_colour = "#fcc"; }
|
||||
if($peer['bgpPeerAdminStatus'] == "start") { $admin_col = "green"; } else { $admin_col = "red"; $bg_colour = "#ccc"; }
|
||||
|
||||
if($peer['bgpPeerRemoteAs'] == $device['bgpLocalAs']) { $peer_type = "<span style='color: #00f;'>iBGP</span>"; } else { $peer_type = "<span style='color: #0a0;'>eBGP</span>"; }
|
||||
|
||||
|
||||
$peerhost = mysql_fetch_array(mysql_query("SELECT * FROM ipaddr AS A, interfaces AS I, devices AS D WHERE A.addr = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
|
||||
|
||||
if($peerhost) { $peername = generatedevicelink($peerhost); } else { unset($peername); }
|
||||
|
||||
echo("<tr bgcolor=$bg_colour><th>$i</td><td><span class=list-large>" . $peer['bgpPeerIdentifier'] . "</span><br />".$peername."</td><td>AS" . $peer['bgpPeerRemoteAs'] . "<br />" . $peer['astext'] . "</td><td><img src='$img'></td><td><span style='color: $col;'>" . $peer['bgpPeerState'] . "</span></td><td>" .formatUptime($peer['bgpPeerFsmEstablishedTime']). "</td></tr>");
|
||||
echo("<tr bgcolor=$bg_colour>
|
||||
<td width=20><h3><center>$i</center></h3></td>
|
||||
<td><span class=list-large>" . $peer['bgpPeerIdentifier'] . "</span><br />".$peername."</td>
|
||||
<td>$peer_type</td>
|
||||
<td><strong>AS" . $peer['bgpPeerRemoteAs'] . "</strong><br />" . $peer['astext'] . "</td>
|
||||
<td><strong><span style='color: $admin_col;'>" . $peer['bgpPeerAdminStatus'] . "<span><br /><span style='color: $col;'>" . $peer['bgpPeerState'] . "</span></strong></td>
|
||||
<td>" .formatUptime($peer['bgpPeerFsmEstablishedTime']). "<br />
|
||||
Updates <img src='images/16/arrow_down.png' align=absmiddle> " . $peer['bgpPeerInUpdates'] . "
|
||||
<img src='images/16/arrow_up.png' align=absmiddle> " . $peer['bgpPeerOutUpdates'] . "</td></tr>");
|
||||
|
||||
# if($graphs) {
|
||||
if($graphs) {
|
||||
|
||||
$graph_type = "bgpupdates";
|
||||
|
||||
@@ -47,7 +61,7 @@
|
||||
echo("</td></tr>");
|
||||
|
||||
|
||||
# }
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
@@ -2,6 +2,8 @@
|
||||
|
||||
echo("Polling BGP peers\n");
|
||||
|
||||
if(!$config['enable_bgp']) { echo("BGP Support Disabled\n"); } else {
|
||||
|
||||
$query = "SELECT * FROM bgpPeers WHERE device_id = '" . $device['device_id'] . "'";
|
||||
$peers = mysql_query($query);
|
||||
while($peer = mysql_fetch_array($peers)) {
|
||||
@@ -37,11 +39,12 @@ while($peer = mysql_fetch_array($peers)) {
|
||||
echo("$peerrrd N:$bgpPeerOutUpdates:$bgpPeerInUpdates:$bgpPeerOutTotalMessages:$bgpPeerInTotalMesages:$bgpPeerFsmEstablishedTime");
|
||||
|
||||
$update = "UPDATE bgpPeers SET bgpPeerState = '$bgpPeerState', bgpPeerAdminStatus = '$bgpPeerAdminStatus', ";
|
||||
$update .= "bgpPeerFsmEstablishedTime = '$bgpPeerFsmEstablishedTime'";
|
||||
$update .= "bgpPeerFsmEstablishedTime = '$bgpPeerFsmEstablishedTime', bgpPeerInUpdates = '$bgpPeerInUpdates' , bgpPeerOutUpdates = '$bgpPeerOutUpdates'";
|
||||
$update .= " WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "'";
|
||||
|
||||
mysql_query($update);
|
||||
|
||||
}
|
||||
} ## End While loop on peers
|
||||
|
||||
} ## End check for BGP support
|
||||
?>
|
||||
|
13
map.php
13
map.php
@@ -104,10 +104,13 @@ echo("\n}\n");
|
||||
|
||||
}
|
||||
|
||||
echo("\"thnlon-pe01\" -> \"thelon-cs01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
|
||||
echo("\"thnlon-pe01\" -> \"thelon-cs02\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
|
||||
|
||||
echo("\"Internet\" -> \"thlon-pe01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
|
||||
echo("\"Internet\" -> \"thlon-lns01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
|
||||
echo("\"ADSL\" -> \"thlon-lns01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
|
||||
echo("\"Internet\" -> \"thelon-pe01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
|
||||
echo("\"Internet\" -> \"thelon-pe02\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
|
||||
echo("\"Internet\" -> \"thnlon-pe01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
|
||||
echo("\"ADSL\" -> \"thnlon-pe01\" [ arrowhead=none arrowtail=none color=navyblue weight=5 style=\"setlinewidth(8)\"];\n");
|
||||
|
||||
$links_sql = "SELECT *, X.ifDescr AS sif, I.ifDescr AS dif FROM links AS L, interfaces AS I, interfaces AS X, devices as D, devices as Y WHERE D.hostname LIKE '%vostron.net' AND I.device_id = D.device_id AND X.device_id = Y.device_id AND D.hostname NOT LIKE '%cust%' AND L.src_if = I.interface_id AND X.interface_id = L.dst_if AND D.location != Y.location AND D.hostname NOT LIKE '%cust.vostron.net' AND Y.hostname NOT LIKE '%cust.vostron.net' ORDER BY D.location DESC";
|
||||
$links_result = mysql_query($links_sql);
|
||||
@@ -153,8 +156,8 @@ while($link_data = mysql_fetch_array($links_result)) {
|
||||
$dif = makeshortif($link_data[dif]);
|
||||
|
||||
if(!$die){
|
||||
# echo("\"$src\" -> \"$dst\" [taillabel=\"$dif\" headlabel=\"$sif\" arrowhead=none arrowtail=none $info];\n");
|
||||
echo("\"$src\" -> \"$dst\" [ arrowhead=none arrowtail=none $info];\n");
|
||||
echo("\"$src\" -> \"$dst\" [taillabel=\"$dif\" headlabel=\"$sif\" arrowhead=none arrowtail=none $info];\n");
|
||||
# echo("\"$src\" -> \"$dst\" [ arrowhead=none arrowtail=none $info];\n");
|
||||
$linkdone[] = "$src $link_data[sif] $dst $link_data[dif]";
|
||||
$x++;
|
||||
}
|
||||
|
16
poll-os.php
16
poll-os.php
@@ -7,15 +7,11 @@ include("includes/functions.php");
|
||||
$device_query = mysql_query("SELECT device_id,hostname,os,community,snmpver FROM `devices` WHERE `device_id` LIKE '%" . $argv[1] . "' AND status = '1' ORDER BY device_id DESC");
|
||||
while ($device = mysql_fetch_array($device_query)) {
|
||||
|
||||
$id = $device['device_id'];
|
||||
$hostname = $device['hostname'];
|
||||
$old_os = $device['os'];
|
||||
$community = $device['community'];
|
||||
$host = trim(strtolower($hostname));
|
||||
$host_os = getHostOS($host, $community, $device[snmpver]);
|
||||
if($old_os != $host_os) {
|
||||
$sql = mysql_query("UPDATE `devices` SET `os` = '$host_os' WHERE `device_id` = '$id'");
|
||||
echo("Updated host : $host ($host_os)\n");
|
||||
} else echo("Not Updated host : $host ($host_os)\n");
|
||||
$os = getHostOS($device['hostname'], $device['community'], $device[snmpver]);
|
||||
|
||||
if($os != $device['os']) {
|
||||
$sql = mysql_query("UPDATE `devices` SET `os` = '$os' WHERE `device_id` = '".$device['device_id']."'");
|
||||
echo("Updated host : ".$device['hostname']." ($os)\n");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user