mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 08:02:51 +02: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:
@@ -4,18 +4,18 @@ function authenticate($username,$password)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if(isset($_SERVER['REMOTE_USER']))
|
||||
if(isset($_SERVER['REMOTE_USER']))
|
||||
{
|
||||
$_SESSION['username'] = mres($_SERVER['REMOTE_USER']);
|
||||
|
||||
|
||||
$sql = "SELECT username FROM `users` WHERE `username`='".$_SESSION['username'] . "'";;
|
||||
$query = mysql_query($sql);
|
||||
$row = @mysql_fetch_array($query);
|
||||
if($row['username'] && $row['username'] == $_SESSION['username'])
|
||||
if($row['username'] && $row['username'] == $_SESSION['username'])
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['username'] = $config['http_auth_guest'];
|
||||
return 1;
|
||||
@@ -33,19 +33,19 @@ function changepassword($username,$newpassword)
|
||||
{
|
||||
# Not supported
|
||||
}
|
||||
|
||||
|
||||
function auth_usermanagement()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
function adduser($username, $password, $level, $email = "", $realname = "")
|
||||
{
|
||||
mysql_query("INSERT INTO `users` (`username`,`password`,`level`, `email`, `realname`) VALUES ('".mres($username)."',MD5('".mres($password)."'),'".mres($level)."','".mres($email)."','".mres($realname)."')");
|
||||
|
||||
|
||||
return mysql_affected_rows();
|
||||
}
|
||||
|
||||
|
||||
function user_exists($username)
|
||||
{
|
||||
return mysql_result(mysql_query("SELECT * FROM users WHERE username = '".mres($username)."'"),0);
|
||||
|
||||
@@ -58,12 +58,12 @@ function adduser($username, $password, $level, $email = "", $realname = "")
|
||||
# Not supported
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
function user_exists($username)
|
||||
{
|
||||
return 0; # FIXME to be implemented
|
||||
}
|
||||
|
||||
|
||||
function get_userlevel($username)
|
||||
{
|
||||
# FIXME should come from LDAP
|
||||
|
||||
@@ -6,7 +6,7 @@ function authenticate($username,$password)
|
||||
$sql = "SELECT username FROM `users` WHERE `username`='".$username."' AND `password`='".$encrypted."'";
|
||||
$query = mysql_query($sql);
|
||||
$row = @mysql_fetch_array($query);
|
||||
if($row['username'] && $row['username'] == $username)
|
||||
if($row['username'] && $row['username'] == $username)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -29,11 +29,11 @@ function auth_usermanagement()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
function adduser($username, $password, $level, $email = "", $realname = "")
|
||||
{
|
||||
mysql_query("INSERT INTO `users` (`username`,`password`,`level`, `email`, `realname`) VALUES ('".mres($username)."',MD5('".mres($password)."'),'".mres($level)."','".mres($email)."','".mres($realname)."')");
|
||||
|
||||
|
||||
return mysql_affected_rows();
|
||||
}
|
||||
|
||||
@@ -41,19 +41,19 @@ function user_exists($username)
|
||||
{
|
||||
return mysql_result(mysql_query("SELECT * FROM users WHERE username = '".mres($username)."'"),0);
|
||||
}
|
||||
|
||||
|
||||
function get_userlevel($username)
|
||||
{
|
||||
$sql = "SELECT level FROM `users` WHERE `username`='".mres($username)."'";
|
||||
$row = mysql_fetch_array(mysql_query($sql));
|
||||
return $row['level'];
|
||||
}
|
||||
|
||||
|
||||
function get_userid($username)
|
||||
{
|
||||
$sql = "SELECT user_id FROM `users` WHERE `username`='".mres($username)."'";
|
||||
$row = mysql_fetch_array(mysql_query($sql));
|
||||
return $row['user_id'];
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -5,31 +5,40 @@
|
||||
$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);
|
||||
}
|
||||
|
||||
$rra_in = "INOCTETS";
|
||||
$rra_out = "OUTOCTETS";
|
||||
$rra_out = "OUTOCTETS";
|
||||
|
||||
$colour_line_in = "006600";
|
||||
$colour_line_out = "000099";
|
||||
@@ -38,4 +47,4 @@ $colour_area_out = "C3D9FF";
|
||||
|
||||
include ("includes/graphs/generic_multi_bits.inc.php");
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -8,37 +8,37 @@ $rrd_options .= " -l 0 -E ";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '$id'");
|
||||
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
|
||||
while($current = mysql_fetch_array($sql))
|
||||
while($current = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
{
|
||||
case "1":
|
||||
$colour= "CC0000";
|
||||
break;
|
||||
$colour= "CC0000";
|
||||
break;
|
||||
case "2":
|
||||
$colour= "008C00";
|
||||
break;
|
||||
$colour= "008C00";
|
||||
break;
|
||||
case "3":
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
case "4":
|
||||
$colour= "73880A";
|
||||
$colour= "73880A";
|
||||
break;
|
||||
case "5":
|
||||
$colour= "D01F3C";
|
||||
$colour= "D01F3C";
|
||||
break;
|
||||
case "6":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
default:
|
||||
$colour= "FF0084";
|
||||
$colour= "FF0084";
|
||||
unset($iter);
|
||||
break;
|
||||
}
|
||||
|
||||
$hostname = gethostbyid($current['device_id']);
|
||||
|
||||
|
||||
$descr = substr(str_pad($current['sensor_descr'], 15),0,15);
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("current-" . $current['sensor_descr'] . ".rrd");
|
||||
|
||||
|
||||
@@ -9,31 +9,31 @@ $rrd_options .= " -l 0 -E ";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='fanspeed' AND device_id = '$id'");
|
||||
$rrd_options .= " COMMENT:'RPM Cur Min Max\\n'";
|
||||
while($fanspeed = mysql_fetch_array($sql))
|
||||
while($fanspeed = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
{
|
||||
case "1":
|
||||
$colour= "CC0000";
|
||||
break;
|
||||
$colour= "CC0000";
|
||||
break;
|
||||
case "2":
|
||||
$colour= "008C00";
|
||||
break;
|
||||
$colour= "008C00";
|
||||
break;
|
||||
case "3":
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
case "4":
|
||||
$colour= "73880A";
|
||||
$colour= "73880A";
|
||||
break;
|
||||
case "5":
|
||||
$colour= "D01F3C";
|
||||
$colour= "D01F3C";
|
||||
break;
|
||||
case "6":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
default:
|
||||
$colour= "FF0084";
|
||||
$colour= "FF0084";
|
||||
unset($iter);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -8,37 +8,37 @@ $rrd_options .= " -l 0 -E ";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='freq' AND device_id = '$id'");
|
||||
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
|
||||
while($frequency = mysql_fetch_array($sql))
|
||||
while($frequency = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
{
|
||||
case "1":
|
||||
$colour= "CC0000";
|
||||
break;
|
||||
$colour= "CC0000";
|
||||
break;
|
||||
case "2":
|
||||
$colour= "008C00";
|
||||
break;
|
||||
$colour= "008C00";
|
||||
break;
|
||||
case "3":
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
case "4":
|
||||
$colour= "73880A";
|
||||
$colour= "73880A";
|
||||
break;
|
||||
case "5":
|
||||
$colour= "D01F3C";
|
||||
$colour= "D01F3C";
|
||||
break;
|
||||
case "6":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
default:
|
||||
$colour= "FF0084";
|
||||
$colour= "FF0084";
|
||||
unset($iter);
|
||||
break;
|
||||
}
|
||||
|
||||
$hostname = gethostbyid($frequency['device_id']);
|
||||
|
||||
|
||||
$descr = substr(str_pad($frequency['sensor_descr'], 15),0,15);
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("freq-" . $frequency['sensor_descr'] . ".rrd");
|
||||
$sensor_id = $frequency['sensor_id'];
|
||||
|
||||
@@ -8,35 +8,35 @@ $rrd_options .= " -l 0 -E ";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='humidity' AND device_id = '$id' ORDER BY sensor_index");
|
||||
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
|
||||
while($humidity = mysql_fetch_array($sql))
|
||||
while($humidity = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
{
|
||||
case "1":
|
||||
$colour= "CC0000";
|
||||
break;
|
||||
$colour= "CC0000";
|
||||
break;
|
||||
case "2":
|
||||
$colour= "008C00";
|
||||
break;
|
||||
$colour= "008C00";
|
||||
break;
|
||||
case "3":
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
case "4":
|
||||
$colour= "73880A";
|
||||
$colour= "73880A";
|
||||
break;
|
||||
case "5":
|
||||
$colour= "D01F3C";
|
||||
$colour= "D01F3C";
|
||||
break;
|
||||
case "6":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
default:
|
||||
$colour= "FF0084";
|
||||
$colour= "FF0084";
|
||||
unset($iter);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$humidity['sensor_descr_fixed'] = substr(str_pad($humidity['sensor_descr'], 22),0,22);
|
||||
$humidityrrd = $config['rrd_dir'] . "/".$device['hostname']."/".safename("humidity-" . safename($humidity['sensor_type']."-".$humidity['sensor_index']) . ".rrd");
|
||||
$rrd_options .= " DEF:sensor" . $humidity['sensor_id'] . "=$humidityrrd:sensor:AVERAGE ";
|
||||
|
||||
@@ -9,35 +9,35 @@ $rrd_options .= " -l 0 -E ";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '$id' ORDER BY sensor_index");
|
||||
$rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\n'";
|
||||
while($temperature = mysql_fetch_array($sql))
|
||||
while($temperature = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
{
|
||||
case "1":
|
||||
$colour= "CC0000";
|
||||
break;
|
||||
$colour= "CC0000";
|
||||
break;
|
||||
case "2":
|
||||
$colour= "008C00";
|
||||
break;
|
||||
$colour= "008C00";
|
||||
break;
|
||||
case "3":
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
case "4":
|
||||
$colour= "73880A";
|
||||
$colour= "73880A";
|
||||
break;
|
||||
case "5":
|
||||
$colour= "D01F3C";
|
||||
$colour= "D01F3C";
|
||||
break;
|
||||
case "6":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
default:
|
||||
$colour= "FF0084";
|
||||
$colour= "FF0084";
|
||||
unset($iter);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$temperature['sensor_descr_fixed'] = substr(str_pad($temperature['sensor_descr'], $descr_len),0,$descr_len);
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/temperature-" . safename($temperature['sensor_type']."-".$temperature['sensor_index']) . ".rrd";
|
||||
$rrd_options .= " DEF:sensor" . $temperature['sensor_id'] . "=$rrd_file:sensor:AVERAGE ";
|
||||
|
||||
@@ -8,41 +8,42 @@ $rrd_options .= " -l 0 -E ";
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM toner where device_id = '$id'");
|
||||
$rrd_options .= " COMMENT:'Toner level Cur Min Max\\n'";
|
||||
while($toner = mysql_fetch_array($sql))
|
||||
while($toner = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
{
|
||||
case "1":
|
||||
$colour= "000000";
|
||||
break;
|
||||
$colour= "000000";
|
||||
break;
|
||||
case "2":
|
||||
$colour= "008C00";
|
||||
break;
|
||||
$colour= "008C00";
|
||||
break;
|
||||
case "3":
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
case "4":
|
||||
$colour= "73880A";
|
||||
$colour= "73880A";
|
||||
break;
|
||||
case "5":
|
||||
$colour= "D01F3C";
|
||||
$colour= "D01F3C";
|
||||
break;
|
||||
case "6":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
default:
|
||||
$colour= "FF0000";
|
||||
$colour= "FF0000";
|
||||
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"; }
|
||||
if (stripos($toner['toner_descr'],"black" ) !== false || substr($toner['toner_descr'],-1) == 'K') { $colour = "000000"; }
|
||||
|
||||
|
||||
$hostname = gethostbyid($toner['device_id']);
|
||||
|
||||
|
||||
$descr = substr(str_pad($toner['toner_descr'], 16),0,16);
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("toner-" . $toner['toner_descr'] . ".rrd");
|
||||
$toner_id = $toner['toner_id'];
|
||||
@@ -56,5 +57,4 @@ while($toner = mysql_fetch_array($sql))
|
||||
$iter++;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -10,36 +10,36 @@ $rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\
|
||||
|
||||
$iter = "1";
|
||||
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '$id'");
|
||||
while($sensor = mysql_fetch_array($sql))
|
||||
while($sensor = mysql_fetch_array($sql))
|
||||
{
|
||||
switch ($iter)
|
||||
{
|
||||
case "1":
|
||||
$colour= "CC0000";
|
||||
break;
|
||||
$colour= "CC0000";
|
||||
break;
|
||||
case "2":
|
||||
$colour= "008C00";
|
||||
break;
|
||||
$colour= "008C00";
|
||||
break;
|
||||
case "3":
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
$colour= "4096EE";
|
||||
break;
|
||||
case "4":
|
||||
$colour= "73880A";
|
||||
$colour= "73880A";
|
||||
break;
|
||||
case "5":
|
||||
$colour= "D01F3C";
|
||||
$colour= "D01F3C";
|
||||
break;
|
||||
case "6":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
$colour= "36393D";
|
||||
break;
|
||||
case "7":
|
||||
default:
|
||||
$colour= "FF0084";
|
||||
$colour= "FF0084";
|
||||
unset($iter);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], $descr_len),0,$descr_len);
|
||||
$sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
|
||||
|
||||
|
||||
@@ -1,54 +1,60 @@
|
||||
<?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)
|
||||
{
|
||||
if(!$config['graph_colours'][$colours_in][$iter] || !$config['graph_colours'][$colours_out][$iter]) { $iter = 0; }
|
||||
|
||||
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];
|
||||
$colour_out=$config['graph_colours'][$colours_out][$iter];
|
||||
|
||||
$colour_in=$config['graph_colours'][$colours_in][$iter];
|
||||
$colour_out=$config['graph_colours'][$colours_out][$iter];
|
||||
if($rrd['colour_area_in']) { $colour_in = $rrd['colour_area_in']; }
|
||||
if($rrd['colour_area_out']) {$colour_out = $rrd['colour_area_out']; }
|
||||
|
||||
if($rrd['colour_area_in']) { $colour_in = $rrd['colour_area_in']; }
|
||||
if($rrd['colour_area_out']) {$colour_out = $rrd['colour_area_out']; }
|
||||
|
||||
$rrd_options .= " DEF:in".$i."=".$rrd['filename'].":".$rrd['rra_in'].":AVERAGE ";
|
||||
$rrd_options .= " DEF:out".$i."=".$rrd['filename'].":".$rrd['rra_out'].":AVERAGE ";
|
||||
$rrd_options .= " CDEF:inB".$i."=in".$i.",$multiplier,* ";
|
||||
$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']) {
|
||||
$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 .= " DEF:in".$i."=".$rrd['filename'].":".$rrd['rra_in'].":AVERAGE ";
|
||||
$rrd_options .= " DEF:out".$i."=".$rrd['filename'].":".$rrd['rra_out'].":AVERAGE ";
|
||||
$rrd_options .= " CDEF:inB".$i."=in".$i.",$multiplier,* ";
|
||||
$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'])
|
||||
{
|
||||
$rrd_options .= " VDEF:totin".$i."=inB".$i.",TOTAL";
|
||||
$rrd_options .= " VDEF:totout".$i."=outB".$i.",TOTAL";
|
||||
$rrd_options .= " VDEF:tot".$i."=octets".$i.",TOTAL";
|
||||
}
|
||||
$rrd_options .= $rrd_optionsb;
|
||||
$rrd_options .= " HRULE:0#999999";
|
||||
|
||||
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";
|
||||
|
||||
?>
|
||||
|
||||
+24
-14
@@ -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>');
|
||||
|
||||
?>
|
||||
|
||||
@@ -20,7 +20,7 @@ if (isset($config['enable_bgp']) && $config['enable_bgp'])
|
||||
if ($this_alert) {
|
||||
$device_alerts++;
|
||||
$device_alert_sql .= " OR `device_id` = '" . $device['device_id'] . "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -272,7 +272,7 @@ echo(' <li><hr /></li>
|
||||
<?php if ($_SESSION['userlevel'] >= '10') {
|
||||
echo('
|
||||
<li><hr width="140" /></li>');
|
||||
|
||||
|
||||
if (auth_usermanagement())
|
||||
{
|
||||
echo('
|
||||
|
||||
@@ -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)) {
|
||||
while($port = mysql_fetch_array($ports_query))
|
||||
{
|
||||
if ($_GET['opta'])
|
||||
{
|
||||
$graph_type = $_GET['opta'];
|
||||
|
||||
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>
|
||||
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>
|
||||
<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>');
|
||||
|
||||
?>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$updated = '1';
|
||||
|
||||
$sql = "INSERT INTO `services` (`device_id`,`service_ip`,`service_type`,`service_desc`,`service_param`,`service_ignore`)
|
||||
$sql = "INSERT INTO `services` (`device_id`,`service_ip`,`service_type`,`service_desc`,`service_param`,`service_ignore`)
|
||||
VALUES ('" . mres($_POST['device']). "','" . mres($_POST['ip']) . "','" . mres($_POST['type']) . "',
|
||||
'" . mres($_POST['descr']) . "','" . mres($_POST['params']) . "','0')";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($_SESSION['userlevel'] == 10)
|
||||
if($_SESSION['userlevel'] == 10)
|
||||
{
|
||||
$devices['count'] = mysql_result(mysql_query("SELECT count(*) FROM devices"),0);
|
||||
$devices['up'] = mysql_result(mysql_query("SELECT count(*) FROM devices WHERE status = '1' AND `ignore` = '0'"),0);
|
||||
@@ -20,8 +20,8 @@ if($_SESSION['userlevel'] == 10)
|
||||
$services['down'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '0' AND service_ignore = '0'"),0);
|
||||
$services['ignored'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_ignore = '1'"),0);
|
||||
$services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_disabled = '1'"),0);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
$devices['count'] = mysql_result(mysql_query("SELECT count(D.device_id) FROM devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id"),0);
|
||||
$devices['up'] = mysql_result(mysql_query("SELECT count(D.device_id) FROM devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND D.status = '1' AND D.ignore = '0'"),0);
|
||||
|
||||
@@ -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");
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user