mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
remove dead map.php code, rename some .inc to .inc.php files, general trailing space cleanup part 1, some reindent. No expected functionality change whatsoever ;)
git-svn-id: http://www.observium.org/svn/observer/trunk@1824 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -6,54 +6,63 @@ include("includes/functions.php");
|
||||
|
||||
$sql = "SELECT * FROM devices AS D, services AS S WHERE S.device_id = D.device_id ORDER by D.device_id DESC";
|
||||
$query = mysql_query($sql);
|
||||
while ($service = mysql_fetch_array($query)) {
|
||||
|
||||
if($service['status'] = "1") {
|
||||
while ($service = mysql_fetch_array($query))
|
||||
{
|
||||
if ($service['status'] = "1")
|
||||
{
|
||||
unset($check, $service_status, $time, $status);
|
||||
$service_status = $service['service_status'];
|
||||
$service_type = strtolower($service['service_type']);
|
||||
$service_param = $service['service_param'];
|
||||
$checker_script = $config['install_dir'] . "/includes/services/" . $service_type . "/check.inc";
|
||||
if(is_file($checker_script)) {
|
||||
|
||||
if (is_file($checker_script))
|
||||
{
|
||||
include($checker_script);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$status = "2";
|
||||
$check = "Error : Script not found ($checker_script)";
|
||||
}
|
||||
if($service_status != $status) {
|
||||
|
||||
if ($service_status != $status)
|
||||
{
|
||||
$updated = ", `service_changed` = '" . time() . "' ";
|
||||
if($service['sysContact']) { $email = $service['sysContact']; } else { $email = $config['email_default']; }
|
||||
if($status == "1") {
|
||||
if ($service['sysContact']) { $email = $service['sysContact']; } else { $email = $config['email_default']; }
|
||||
if ($status == "1")
|
||||
{
|
||||
$msg = "Service Up: " . $service['service_type'] . " on " . $service['hostname'];
|
||||
$msg .= " at " . date($config['timestamp_format']);
|
||||
notify($device, "Service Up: " . $service['service_type'] . " on " . $service['hostname'], $msg);
|
||||
} elseif ($status == "0") {
|
||||
}
|
||||
elseif ($status == "0")
|
||||
{
|
||||
$msg = "Service Down: " . $service['service_type'] . " on " . $service['hostname'];
|
||||
$msg .= " at " . date($config['timestamp_format']);
|
||||
notify($device, "Service Down: " . $service['service_type'] . " on " . $service['hostname'], $msg);
|
||||
}
|
||||
|
||||
} else { unset($updated); }
|
||||
|
||||
$update_sql = "UPDATE `services` SET `service_status` = '$status', `service_message` = '" . addslashes($check) . "', `service_checked` = '" . time() . "' $updated WHERE `service_id` = '" . $service['service_id']. "'";
|
||||
mysql_query($update_sql);
|
||||
} else {
|
||||
$status = "0";
|
||||
}
|
||||
|
||||
|
||||
$rrd = $config['rrd_dir'] . "/" . $service['hostname'] . "/" . safename("service-" . $service['service_type'] . "-" . $service['service_id'] . ".rrd");
|
||||
|
||||
if (!is_file($rrd)) {
|
||||
$create = $config['rrdtool'] . " create $rrd \
|
||||
--step 300 \
|
||||
if (!is_file($rrd))
|
||||
{
|
||||
rrdtool_create($rrd,"--step 300 \
|
||||
DS:status:GAUGE:600:0:1 \
|
||||
RRA:AVERAGE:0.5:1:1200 \
|
||||
RRA:AVERAGE:0.5:12:2400";
|
||||
shell_exec($create);
|
||||
RRA:AVERAGE:0.5:12:2400");
|
||||
}
|
||||
|
||||
if($status == "1" || $status == "0") {
|
||||
if ($status == "1" || $status == "0")
|
||||
{
|
||||
rrdtool_update($rrd,"N:".$status);
|
||||
}
|
||||
}
|
||||
} # while
|
||||
?>
|
||||
|
@@ -5,26 +5,35 @@
|
||||
$device = device_by_id_cache($id);
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$id."'");
|
||||
while($int = mysql_fetch_assoc($query)) {
|
||||
while ($int = mysql_fetch_assoc($query))
|
||||
{
|
||||
$ignore = 0;
|
||||
if(is_array($config['device_traffic_iftype'])) {
|
||||
foreach($config['device_traffic_iftype'] as $iftype) {
|
||||
if (preg_match($iftype ."i", $int['ifType'])) {
|
||||
if (is_array($config['device_traffic_iftype']))
|
||||
{
|
||||
foreach ($config['device_traffic_iftype'] as $iftype)
|
||||
{
|
||||
if (preg_match($iftype ."i", $int['ifType']))
|
||||
{
|
||||
$ignore = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(is_array($config['device_traffic_descr'])) {
|
||||
foreach($config['device_traffic_descr'] as $ifdescr) {
|
||||
if (preg_match($ifdescr."i", $int['ifDescr']) || preg_match($ifdescr."i", $int['ifName']) || preg_match($ifdescr."i", $int['portName'])) {
|
||||
if (is_array($config['device_traffic_descr']))
|
||||
{
|
||||
foreach ($config['device_traffic_descr'] as $ifdescr)
|
||||
{
|
||||
if (preg_match($ifdescr."i", $int['ifDescr']) || preg_match($ifdescr."i", $int['ifName']) || preg_match($ifdescr."i", $int['portName']))
|
||||
{
|
||||
$ignore = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd")) && $ignore != 1) {
|
||||
if (is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd")) && $ignore != 1)
|
||||
{
|
||||
$rrd_filenames[] = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd");
|
||||
}
|
||||
|
||||
unset($ignore);
|
||||
}
|
||||
|
||||
|
@@ -36,6 +36,7 @@ while($toner = mysql_fetch_array($sql))
|
||||
unset($iter);
|
||||
break;
|
||||
}
|
||||
|
||||
if (stripos($toner['toner_descr'],"cyan" ) !== false || substr($toner['toner_descr'],-1) == 'C') { $colour = "55D6D3"; }
|
||||
if (stripos($toner['toner_descr'],"magenta") !== false || substr($toner['toner_descr'],-1) == 'M') { $colour = "F24AC8"; }
|
||||
if (stripos($toner['toner_descr'],"yellow" ) !== false || substr($toner['toner_descr'],-1) == 'Y') { $colour = "FFF200"; }
|
||||
@@ -56,5 +57,4 @@ while($toner = mysql_fetch_array($sql))
|
||||
$iter++;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@@ -1,17 +1,16 @@
|
||||
<?php
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$units_descr = substr(str_pad($units_descr, 18),0,18);
|
||||
$units_descr = substr(str_pad($units_descr, 18),0,18);
|
||||
|
||||
$i = 0;
|
||||
$rrd_options .= " COMMENT:'$units_descr Current Average Maximum\\n'";
|
||||
if(!$nototal) {$rrd_options .= " COMMENT:' Tot'";}
|
||||
$rrd_options .= " COMMENT:'\\n'";
|
||||
$i = 0;
|
||||
$rrd_options .= " COMMENT:'$units_descr Current Average Maximum\\n'";
|
||||
if(!$nototal) {$rrd_options .= " COMMENT:' Tot'";}
|
||||
$rrd_options .= " COMMENT:'\\n'";
|
||||
|
||||
|
||||
|
||||
foreach($rrd_list as $rrd) {
|
||||
foreach($rrd_list as $rrd)
|
||||
{
|
||||
if(!$config['graph_colours'][$colours_in][$iter] || !$config['graph_colours'][$colours_out][$iter]) { $iter = 0; }
|
||||
|
||||
$colour_in=$config['graph_colours'][$colours_in][$iter];
|
||||
@@ -26,29 +25,36 @@
|
||||
$rrd_options .= " CDEF:outB".$i."=out".$i.",$multiplier,*";
|
||||
$rrd_options .= " CDEF:outB".$i."_neg=outB".$i.",-1,*";
|
||||
$rrd_options .= " CDEF:octets".$i."=inB".$i.",outB".$i.",+";
|
||||
if(!$args['nototal']) {
|
||||
if(!$args['nototal'])
|
||||
{
|
||||
$rrd_options .= " VDEF:totin".$i."=inB".$i.",TOTAL";
|
||||
$rrd_options .= " VDEF:totout".$i."=outB".$i.",TOTAL";
|
||||
$rrd_options .= " VDEF:tot".$i."=octets".$i.",TOTAL";
|
||||
}
|
||||
|
||||
if($i) {$stack="STACK";}
|
||||
|
||||
$rrd_options .= " AREA:inB".$i."#" . $colour_in . ":'" . substr(str_pad($rrd['descr'], 10),0,10) . "In ':$stack";
|
||||
$rrd_options .= " GPRINT:inB".$i.":LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inB".$i.":AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inB".$i.":MAX:%6.2lf%s";
|
||||
|
||||
if(!$nototal) { $rrd_options .= " GPRINT:totin".$i.":%6.2lf%s$total_units"; }
|
||||
|
||||
$rrd_options .= " COMMENT:'\\n'";
|
||||
$rrd_optionsb .= " AREA:outB".$i."_neg#" . $colour_out . "::$stack";
|
||||
$rrd_options .= " HRULE:999999999999999#" . $colour_out . ":'" . substr(str_pad('', 10),0,10) . "Out':";
|
||||
$rrd_options .= " GPRINT:outB".$i.":LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outB".$i.":AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outB".$i.":MAX:%6.2lf%s";
|
||||
|
||||
if(!$nototal) { $rrd_options .= " GPRINT:totout".$i.":%6.2lf%s$total_unit"; }
|
||||
|
||||
$rrd_options .= " COMMENT:'\\n'";
|
||||
$i++; $iter++;
|
||||
}
|
||||
$rrd_options .= $rrd_optionsb;
|
||||
$rrd_options .= " HRULE:0#999999";
|
||||
}
|
||||
|
||||
$rrd_options .= $rrd_optionsb;
|
||||
$rrd_options .= " HRULE:0#999999";
|
||||
|
||||
?>
|
||||
|
@@ -1,22 +1,32 @@
|
||||
<?php
|
||||
|
||||
$iftype = fixiftype($interface[ifType]);
|
||||
$iftype = fixiftype($interface[ifType]);
|
||||
|
||||
echo("<p class=interface-header>$inf</p>");
|
||||
if($ifalias && $ifalias != "") { echo("<span class=box-desc>$ifalias</span><br />"); }
|
||||
if($iftype && $iftype != "") { echo("<span class=box-desc>$iftype</span> ");
|
||||
if($mac && $mac != "") { echo("<span class=box-desc>$mac</span><br />");
|
||||
} else { echo("<br />"); }
|
||||
echo("<p class=interface-header>$inf</p>");
|
||||
|
||||
if (isset($ifalias) && $ifalias != "") { echo('<span class="box-desc">'.$ifalias.'</span><br />'); }
|
||||
if (isset($iftype) && $iftype != "")
|
||||
{
|
||||
echo('<span class="box-desc">'.$iftype.'</span> ');
|
||||
if ($mac && $mac != "")
|
||||
{
|
||||
echo("<span class=box-desc>$mac</span><br />");
|
||||
}
|
||||
|
||||
if($interface[ifType] != "softwareLoopback") {
|
||||
if($speed == '0') { $speed = "0bps"; }
|
||||
echo("<span class=box-desc>$speed");
|
||||
if($interface[ifDuplex] != unknown) { echo(" / $interface[ifDuplex]-duplex"); }
|
||||
if($interface[ifMtu] && $interface[ifMtu] != "") { echo(" / $interface[ifMtu]MTU</span>"); }
|
||||
echo("</span>");
|
||||
else
|
||||
{
|
||||
echo("<br />");
|
||||
}
|
||||
}
|
||||
|
||||
echo("<span class=box-desc><b>$status</b></span>");
|
||||
if ($interface[ifType] != "softwareLoopback")
|
||||
{
|
||||
if ($speed == '0') { $speed = "0bps"; }
|
||||
echo('<span class="box-desc">'.$speed);
|
||||
if ($interface[ifDuplex] != unknown) { echo(" / $interface[ifDuplex]-duplex"); }
|
||||
if ($interface[ifMtu] && $interface[ifMtu] != "") { echo(" / $interface[ifMtu]MTU</span>"); }
|
||||
echo('</span>');
|
||||
}
|
||||
|
||||
echo('<span class="box-desc"><b>'.$status.'</b></span>');
|
||||
|
||||
?>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
|
||||
echo("<tr bgcolor='$bg_colour'>");
|
||||
|
||||
@@ -9,13 +9,14 @@ echo("<td width=200 class=box-desc>" . $vlan['vlan_descr'] . "</td>");
|
||||
|
||||
echo("<td class=list-bold>");
|
||||
$ports_query = mysql_query("SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND `ifVlan` = '" . $vlan['vlan_vlan'] . "' ");
|
||||
while($port = mysql_fetch_array($ports_query)) {
|
||||
|
||||
if($_GET['opta']) {
|
||||
while($port = mysql_fetch_array($ports_query))
|
||||
{
|
||||
if ($_GET['opta'])
|
||||
{
|
||||
$graph_type = $_GET['opta'];
|
||||
|
||||
echo("<div style='display: block; padding: 2px; margin: 2px; min-width: 139px; max-width:139px; min-height:85px; max-height:85px; text-align: center; float: left; background-color: ".$list_colour_b_b.";'>
|
||||
<div style='font-weight: bold;'>".makeshortif($port['ifDescr'])."</div>
|
||||
<div style='font-weight: bold;'>".makeshortif ($port['ifDescr'])."</div>
|
||||
<a href='device/".$device['device_id']."/interface/".$port['interface_id']."/' onmouseover=\"return overlib('\
|
||||
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$port['ifDescr']."</div>\
|
||||
".$port['ifAlias']." \
|
||||
@@ -25,15 +26,14 @@ while($port = mysql_fetch_array($ports_query)) {
|
||||
</a>
|
||||
<div style='font-size: 9px;'>".truncate(short_port_descr($port['ifAlias']), 22, '')."</div>
|
||||
</div>");
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
echo($vlan['port_sep'] . generate_port_link($port, makeshortif($port['ifDescr'])));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo($vlan['port_sep'] . generate_port_link($port, makeshortif ($port['ifDescr'])));
|
||||
$vlan['port_sep'] = ", ";
|
||||
}
|
||||
}
|
||||
echo("</td>");
|
||||
echo("</tr>");
|
||||
|
||||
echo('</td></tr>');
|
||||
|
||||
?>
|
@@ -16,7 +16,7 @@ print_optionbar_end();
|
||||
$i = "1";
|
||||
$vlan_query = mysql_query("select * from vlans WHERE device_id = '".$_GET['id']."' ORDER BY 'vlan_vlan'");
|
||||
while($vlan = mysql_fetch_array($vlan_query)) {
|
||||
include("includes/print-vlan.inc");
|
||||
include("includes/print-vlan.inc.php");
|
||||
$i++;
|
||||
}
|
||||
echo("</table>");
|
||||
|
@@ -122,7 +122,7 @@ echo('<table cellpadding="7" cellspacing="0" class="devicetable" width="100%">
|
||||
$device_query = mysql_query($sql);
|
||||
while ($device = mysql_fetch_array($device_query)) {
|
||||
if ( device_permitted($device['device_id']) ) {
|
||||
include("includes/hostbox.inc");
|
||||
include("includes/hostbox.inc.php");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@ echo("<tr class=interface-desc bgcolor=#e5e5e5 style='font-weight:bold;'>
|
||||
|
||||
while($device = mysql_fetch_array($device_query)) {
|
||||
|
||||
include("includes/hostbox.inc");
|
||||
include("includes/hostbox.inc.php");
|
||||
|
||||
}
|
||||
|
||||
|
9
irc.php
9
irc.php
@@ -8,11 +8,9 @@ include("includes/discovery/functions.inc.php");
|
||||
|
||||
include_once('Net/SmartIRC.php');
|
||||
|
||||
|
||||
class observiumbot
|
||||
{
|
||||
|
||||
function device_info (&$irc, &$data)
|
||||
function device_info(&$irc, &$data)
|
||||
{
|
||||
$hostname = $data->messageex[1];
|
||||
|
||||
@@ -24,12 +22,10 @@ class observiumbot
|
||||
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'id'.$device['device_id'] . " " . $device['os'] . " " . $device['version'] . " " .
|
||||
$device['features'] . " " . $status);
|
||||
|
||||
}
|
||||
|
||||
function port_info (&$irc, &$data)
|
||||
function port_info(&$irc, &$data)
|
||||
{
|
||||
|
||||
$hostname = $data->messageex[1];
|
||||
$ifname = $data->messageex[2];
|
||||
|
||||
@@ -43,7 +39,6 @@ class observiumbot
|
||||
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'id' . $port['interface_id'] . " " . $port['ifAdminStatus'] . "/" . $port['ifOperStatus'] . " " .
|
||||
$bps_in. " > bps > " . $bps_out . " | " . $pps_in. "pps > PPS > " . $pps_out ."pps");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
115
map.php
115
map.php
@@ -1,115 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
include("config.php");
|
||||
include("includes/functions.php");
|
||||
|
||||
echo("digraph G { sep=0.6; size=\"40,20\"; pack=10; bgcolor=transparent;splines=true;
|
||||
node [ fontname=\"helvetica\", fontsize=38, fontstyle=bold, shape=box, style=bold];
|
||||
edge [ labelfontsize=10, labelfontname=\"helvetica\", overlap=false, fontstyle=bold];
|
||||
graph [bgcolor=transparent, remincross=true];
|
||||
|
||||
");
|
||||
|
||||
$linkdone = array();
|
||||
|
||||
$x = 1;
|
||||
|
||||
$loc_sql = "SELECT * FROM devices GROUP BY location";
|
||||
$loc_result = mysql_query($loc_sql);
|
||||
while($loc_data = mysql_fetch_array($loc_result)) {
|
||||
|
||||
echo("subgraph \"". $loc_data['location'] ."\" {\n
|
||||
label = \"". $loc_data['location'] ."\";
|
||||
style=filled;
|
||||
color=lightgrey;\n\n");
|
||||
|
||||
$dev_sql = "SELECT * FROM devices WHERE location = '" . $loc_data['location'] . "' and (`os` LIKE '%ios%' OR `os` LIKE '%catos%') AND disabled = 0";
|
||||
$dev_result = mysql_query($dev_sql);
|
||||
while($dev_data = mysql_fetch_array($dev_result)) {
|
||||
$device_id = $dev_data['device_id'];
|
||||
|
||||
# if(mysql_result(mysql_query("SELECT count(*) from links WHERE local_interface_id = '$device_id' OR remote_interface_id = '$device_id'"),0)) {
|
||||
$host = $dev_data['hostname'];
|
||||
unset($hostinfo);
|
||||
if(strpos($host, "cust." . $config['mydomain'])) { $hostinfo = "shape=egg style=filled fillcolor=pink"; }
|
||||
if(strpos($host, "bas")) { $hostinfo = "shape=rectangle style=filled fillcolor=skyblue"; }
|
||||
if(strpos($host, "crs")) { $hostinfo = "shape=box3d style=filled fillcolor=skyblue"; }
|
||||
if(strpos($host, "lcr")) { $hostinfo = "shape=tripleoctagon style=filled fillcolor=darkolivegreen4"; }
|
||||
if(strpos($host, "ler")) { $hostinfo = "shape=octagon style=filled fillcolor=darkolivegreen1"; }
|
||||
if(strpos($host, "pbr")) { $hostinfo = "shape=ellipse style=filled fillcolor=orange"; }
|
||||
if(strpos($host, "tbr")) { $hostinfo = "shape=ellipse style=filled fillcolor=orange"; }
|
||||
if(strstr($host, "gwr")) { $hostinfo = "shape=ellipse style=filled fillcolor=orange"; }
|
||||
if(strpos($host, "bgw")) { $hostinfo = "shape=ellipse style=filled fillcolor=orange"; }
|
||||
if(strpos($host, "vax")) { $hostinfo = "shape=rect style=filled fillcolor=skyblue"; }
|
||||
if(strpos($host, "vsx")) { $hostinfo = "shape=box3d style=filled fillcolor=skyblue"; }
|
||||
|
||||
$host = $dev_data['hostname'];
|
||||
$host = str_replace("." . $config['mydomain'],"", $host);
|
||||
echo("\"$host\" [$hostinfo]
|
||||
");
|
||||
# }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo("\n}\n");
|
||||
|
||||
}
|
||||
|
||||
$links_sql = "SELECT *, X.ifDescr AS sif, I.ifDescr AS dif FROM links AS L, ports AS I, ports AS X, devices as D, devices as Y WHERE I.device_id = D.device_id AND X.device_id = Y.device_id AND L.local_interface_id = I.interface_id AND X.interface_id = L.remote_interface_id";
|
||||
|
||||
$links_result = mysql_query($links_sql);
|
||||
while($link_data = mysql_fetch_array($links_result)) {
|
||||
|
||||
$local_interface_id = $link_data['local_interface_id'];
|
||||
$remote_interface_id = $link_data['remote_interface_id'];
|
||||
|
||||
$sq = mysql_fetch_row(mysql_query("SELECT `hostname`,`ifSpeed` FROM ports AS I, devices as D where I.device_id = D.device_id and I.interface_id = '$local_interface_id'"));
|
||||
$dq = mysql_fetch_row(mysql_query("SELECT `hostname`,`ifSpeed` FROM ports AS I, devices as D where I.device_id = D.device_id and I.interface_id = '$remote_interface_id'"));
|
||||
|
||||
$src = $sq[0];
|
||||
$dst = $dq[0];
|
||||
|
||||
$src_speed = $sq[1];
|
||||
$dst_speed = $dq[1];
|
||||
|
||||
$src = str_replace("." . $config['mydomain'], "", $src);
|
||||
$dst = str_replace("." . $config['mydomain'], "", $dst);
|
||||
|
||||
$info = "";
|
||||
|
||||
if($src_speed >= "10000000000") {
|
||||
$info .= "color=lightred weight=10 style=\"setlinewidth(8)\"";
|
||||
} elseif ($src_speed >= "1000000000") {
|
||||
$info .= "color=lightblue weight=5 style=\"setlinewidth(4)\"";
|
||||
} elseif ($src_speed >= "100000000") {
|
||||
$info .= "color=lightgrey weight=1 style=\"setlinewidth(2)\"";
|
||||
} elseif ($src_speed >= "10000000") {
|
||||
$info .= "style=\"setlinewidth(1)\" weight=1";
|
||||
}
|
||||
|
||||
unset($die);
|
||||
|
||||
$i = 0;
|
||||
while ($i < count($linkdone)) {
|
||||
$thislink = "$dst ".$link_data['dif']." $src ".$link_data['sif'];
|
||||
if ($linkdone[$i] == $thislink) { $die = "yes"; }
|
||||
$i++;
|
||||
}
|
||||
|
||||
$sif = makeshortif($link_data['sif']);
|
||||
$dif = makeshortif($link_data['dif']);
|
||||
|
||||
if(!$die){
|
||||
echo("\"$src\" -> \"$dst\" [taillabel=\"$dif\" headlabel=\"$sif\" arrowhead=dot arrowtail=dot $info];\n");
|
||||
# echo("\"$src\" -> \"$dst\" [ arrowhead=none arrowtail=none $info];\n");
|
||||
$linkdone[] = "$src ".$link_data['sif']." $dst ".$link_data['dif'];
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
|
||||
echo("}");
|
||||
|
||||
?>
|
@@ -7,16 +7,20 @@ include("includes/functions.php");
|
||||
|
||||
# Remove a host and all related data from the system
|
||||
|
||||
if($argv[1] && $argv[2]) {
|
||||
if($argv[1] && $argv[2])
|
||||
{
|
||||
$host = strtolower($argv[1]);
|
||||
$id = getidbyname($host);
|
||||
if($id) {
|
||||
if($id)
|
||||
{
|
||||
renamehost($id, $argv[2]);
|
||||
echo("Renamed $host\n");
|
||||
} else {
|
||||
echo("Host doesn't exist!\n");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
echo("Host Rename Tool\nUsage: ./renamehost.php <old hostname> <new hostname>\n");
|
||||
}
|
||||
|
||||
|
@@ -10,35 +10,33 @@ $devices = mysql_result(mysql_query("SELECT count(*) FROM devices"),0);
|
||||
|
||||
$dataHandle = fopen("http://www.observium.org/latest.php?i=$ports&d=$devices&v=".$config['version'], r);
|
||||
|
||||
if($dataHandle)
|
||||
if ($dataHandle)
|
||||
{
|
||||
while (!feof($dataHandle))
|
||||
{
|
||||
$data.= fread($dataHandle, 4096);
|
||||
}
|
||||
if($data)
|
||||
if ($data)
|
||||
{
|
||||
list($major, $minor, $release) = explode(".", $data);
|
||||
list($cur, $tag) = explode("-", $config['version']);
|
||||
list($cur_major, $cur_minor, $cur_release) = explode(".", $cur);
|
||||
|
||||
if($argv[1] == "--cron")
|
||||
if ($argv[1] == "--cron")
|
||||
{
|
||||
$fd = fopen('vrrd/version.txt','w');
|
||||
fputs($fd, "$major.$minor.$release");
|
||||
fclose($fd);
|
||||
|
||||
} else {
|
||||
|
||||
echo("Current Version $cur_major.$cur_minor.$cur_release \n");
|
||||
|
||||
if($major > $cur_major) {
|
||||
if ($major > $cur_major) {
|
||||
echo("New major release : $major.$minor.$release");
|
||||
} elseif ($major == $cur_major && $minor > $cur_minor) {
|
||||
echo("New minor release : $major.$minor.$release");
|
||||
} elseif ($major == $cur_major && $minor == $cur_minor && $release > $cur_release) {
|
||||
echo("New trivial release : $major.$minor.$release");
|
||||
} elseif($major < $cur_major || ($major == $cur_major && $minor < $cur_minor) || ($major == $cur_major && $minor == $cur_minor && $release < $cur_release)) {
|
||||
} elseif ($major < $cur_major || ($major == $cur_major && $minor < $cur_minor) || ($major == $cur_major && $minor == $cur_minor && $release < $cur_release)) {
|
||||
echo("Your release is newer than the official version!\n");
|
||||
} else {
|
||||
echo("Your release is up to date\n");
|
||||
|
Reference in New Issue
Block a user