cleanups + remove space in astext

git-svn-id: http://www.observium.org/svn/observer/trunk@867 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-02-16 00:52:40 +00:00
parent e4bd888152
commit 6a9940fe5e

View File

@@ -248,18 +248,17 @@ function percent_colour($perc)
function print_error($text)
{
echo("<table class=errorbox cellpadding=3><tr><td><img src='/images/15/exclamation.png' align=absmiddle> $text</td></tr></table>");
echo('<table class="errorbox" cellpadding="3"><tr><td><img src="/images/15/exclamation.png" align="absmiddle">'.$text.'</td></tr></table>');
}
function print_message($text)
{
echo("<table class=messagebox cellpadding=3><tr><td><img src='/images/16/tick.png' align=absmiddle> $text</td></tr></table>");
echo('<table class="messagebox" cellpadding="3"><tr><td><img src="/images/16/tick.png" align="absmiddle">'.$text.'</td></tr></table>');
}
function interface_rates ($rrd_file) // Returns the last in/out value in RRD
{
global $config;
#$rrdfile = $config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
$cmd = $config['rrdtool']." fetch -s -600s -e now $rrd_file AVERAGE | grep : | cut -d\" \" -f 2,3 | grep e";
$data = trim(`$cmd`);
foreach( explode("\n", $data) as $entry) {
@@ -273,7 +272,6 @@ function interface_rates ($rrd_file) // Returns the last in/out value in RRD
function interface_errors ($rrd_file, $period = '-1d') // Returns the last in/out errors value in RRD
{
global $config;
#$rrdfile = $config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
$cmd = $config['rrdtool']." fetch -s $period -e -300s $rrd_file AVERAGE | grep : | cut -d\" \" -f 4,5";
$data = trim(shell_exec($cmd));
foreach( explode("\n", $data) as $entry) {
@@ -289,7 +287,6 @@ function interface_errors ($rrd_file, $period = '-1d') // Returns the last in/ou
function interface_packets ($rrd_file) // Returns the last in/out pps value in RRD
{
global $config;
#$rrdfile = $config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
$cmd = $config['rrdtool']." fetch -s -1d -e -300s $rrd_file AVERAGE | grep : | cut -d\" \" -f 6,7";
$data = trim(shell_exec($cmd));
foreach( explode("\n", $data) as $entry) {
@@ -806,8 +803,9 @@ function get_astext($asn)
{
$result = dns_get_record("AS$asn.asn.cymru.com",DNS_TXT);
$txt = explode('|',$result[0]['txt']);
$cache['astext'][$asn] = $txt[4];
return trim(str_replace('"', '', $txt[4]));
$result = trim(str_replace('"', '', $txt[4]));
$cache['astext'][$asn] = $result;
return $result;
}
}
}