fix a couple of graphs

git-svn-id: http://www.observium.org/svn/observer/trunk@1158 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-06-12 20:14:41 +00:00
parent d33dfc87a1
commit aa9540007d
3 changed files with 10 additions and 9 deletions

View File

@ -9,17 +9,17 @@ shell_exec("rm ips.txt && touch ips.txt");
$handle = fopen("ips.txt", "w+");
$query = mysql_query("SELECT * FROM `networks`");
$query = mysql_query("SELECT * FROM `ipv4_networks`");
while ($data = mysql_fetch_array($query)) {
$cidr = $data['cidr'];
list ($network, $bits) = split("/", $cidr);
$cidr = $data['ipv4_network'];
list ($network, $bits) = preg_split("@\/@", $cidr);
if($bits != '32' && $bits != '32' && $bits > '22') {
$broadcast = trim(shell_exec($config['ipcalc']." $cidr | grep Broadcast | cut -d\" \" -f 2"));
$ip = ip2long($network) + '1';
$end = ip2long($broadcast);
while($ip < $end) {
$ipdotted = long2ip($ip);
if(mysql_result(mysql_query("SELECT count(id) FROM ipaddr WHERE addr = '$ipdotted'"),0) == '0' && match_network($config['nets'], $ipdotted)) {
if(mysql_result(mysql_query("SELECT count(ipv4_address_id) FROM ipv4_addresses WHERE ipv4_address = '$ipdotted'"),0) == '0' && match_network($config['nets'], $ipdotted)) {
fputs($handle, $ipdotted . "\n");
}
$ip++;

View File

@ -1,12 +1,13 @@
<?php
$query = mysql_query("SELECT * FROM `hrDevice` where `device_id` = '".$id."' AND hrDeviceType = 'hrDeviceProcessor'");
$device = device_by_id_cache($id);
$query = mysql_query("SELECT * FROM `hrDevice` where `device_id` = '".mres($_GET['id'])."' AND hrDeviceType = 'hrDeviceProcessor'");
$device = device_by_id_cache(mres($device_id));
$i=0;
while($proc = mysql_fetch_array($query)) {
$rrd_filename = $config['rrd_dir'] . "/."$device['hostname']."/" . safename("hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd");
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd");
if(is_file($rrd_filename)) {
@ -37,7 +38,7 @@ include ("generic_multi_line.inc.php");
} else {
include("common.inc.php");
$rrd_filename = $config['rrd_dir'] . "/" . $hostname . "/" . "ucd_cpu.rrd";
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . "ucd_cpu.rrd";
$rrd_options .= " DEF:user=$rrd_filename:user:AVERAGE";
$rrd_options .= " DEF:nice=$rrd_filename:nice:AVERAGE";
$rrd_options .= " DEF:system=$rrd_filename:system:AVERAGE";

View File

@ -17,7 +17,7 @@ $select[$section] = "selected";
$device_query = mysql_query("SELECT * FROM `devices` WHERE `device_id` = '" . $_GET['id'] . "'");
while($device = mysql_fetch_array($device_query)) {
if($os_groups[$device['os']]) {$device['os_group'] = $os_groups[$device['os']]; echo "(".$device['os_group'].")";}
if($os_groups[$device['os']]) {$device['os_group'] = $os_groups[$device['os']]; }
echo('<table cellpadding="15" cellspacing="0" class="devicetable" width="100%">');
include("includes/device-header.inc.php");