From 0c4fa28c5e2b4ef9dc1751380f05f8fadba93eb9 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Thu, 20 Nov 2008 14:58:11 +0000 Subject: [PATCH] fixes git-svn-id: http://www.observium.org/svn/observer/trunk@308 61d68cd4-352d-0410-923a-c4978735b2b8 --- contrib/generate-dnstext.php | 21 +++++++++++++++++---- includes/common.php | 22 ---------------------- includes/functions.php | 1 - includes/polling/interfaces.inc.php | 23 +++++++++++++---------- 4 files changed, 30 insertions(+), 37 deletions(-) delete mode 100644 includes/common.php diff --git a/contrib/generate-dnstext.php b/contrib/generate-dnstext.php index 673a3aab47..8600ba8162 100755 --- a/contrib/generate-dnstext.php +++ b/contrib/generate-dnstext.php @@ -20,11 +20,11 @@ while($ip = mysql_fetch_array($data)) { $hostname = str_replace(".wtibs.net", "", $hostname); $hostname = str_replace(".jerseytelecom.net", "", $hostname); - list($loc, $host) = explode("-", $hostname); + list($cc, $loc, $host) = explode(".", $hostname); if($host) { - $hostname = "$host.$loc.v4.jerseytelecom.net"; + $hostname = "$host.$loc.$cc.v4.jerseytelecom.net"; } else { - $host = $loc; unset ($loc); + $host = $cc; unset ($cc); $hostname = "$host.v4.jerseytelecom.net"; } @@ -47,8 +47,21 @@ while($ip = mysql_fetch_array($data)) { $reverse = "$fourth.$revzone"; $dnsname = "$interface.$hostname"; - echo(str_pad($reverse, 35)."IN ADDR ".str_pad($dnsname, 30)." $real_hostname\n"); + $dns_list[] = str_pad($revzone, 24) . "|" . str_pad($reverse, 30)."IN ADDR ".str_pad($dnsname, 30); +} + +sort ($dns_list); + +foreach ($dns_list as $entry) { + list($zone, $entry) = explode("|", $entry); + $zone = trim($zone); + + if($zone != $oldzone) { echo("\n$$zone\n------------------------------\n"); } + + echo("$entry \n"); + + $oldzone = $zone; } diff --git a/includes/common.php b/includes/common.php deleted file mode 100644 index dd49a1611a..0000000000 --- a/includes/common.php +++ /dev/null @@ -1,22 +0,0 @@ -MySQL Error"; - die; -} -mysql_select_db($config['db_name']); - -# Set some times needed by loads of scripts (it's dynamic, so we do it here!) - -$now = time(); -$day = time() - (24 * 60 * 60); -$twoday = time() - (2 * 24 * 60 * 60); -$week = time() - (7 * 24 * 60 * 60); -$month = time() - (31 * 24 * 60 * 60); -$year = time() - (365 * 24 * 60 * 60); - - -?> diff --git a/includes/functions.php b/includes/functions.php index c3155aadc0..ad1687d44d 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -7,7 +7,6 @@ include_once("Net/IPv6.php"); ## Observer Includes -include_once($config['install_dir'] . "/includes/common.php"); include_once($config['install_dir'] . "/includes/generic.php"); include_once($config['install_dir'] . "/includes/ios.php"); include_once($config['install_dir'] . "/includes/unix.php"); diff --git a/includes/polling/interfaces.inc.php b/includes/polling/interfaces.inc.php index 622118535d..33f341ea2e 100644 --- a/includes/polling/interfaces.inc.php +++ b/includes/polling/interfaces.inc.php @@ -32,21 +32,24 @@ while ($interface = mysql_fetch_array($interface_query)) { $ifAlias = trim(str_replace("\"", "", $ifAlias)); $ifAlias = trim($ifAlias); - $old_rrdfile = "rrd/" . $device['hostname'] . "." . $interface['ifIndex'] . ".rrd"; + $older_rrdfile = "rrd/" . $device['hostname'] . "." . $interface['ifIndex'] . ".rrd"; $rrdfile = $host_rrd . "/" . $interface['ifIndex'] . ".rrd"; - if(is_file($old_rrdfile) && !is_file($rrdfile)) { rename($old_rrdfile, $rrdfile); echo("Moving $old_rrdfile to $rrdfile"); } + if(is_file($older_rrdfile) && !is_file($rrdfile)) { rename($older_rrdfile, $rrdfile); echo("Moving $older_rrdfile to $rrdfile"); } + + + if(!is_file($rrdfile)) { $woo = `rrdtool create $rrdfile \ - DS:INOCTETS:COUNTER:600:0:18446744073709551615 \ - DS:OUTOCTETS:COUNTER:600:0:18446744073709551615 \ - DS:INERRORS:COUNTER:600:0:18446744073709551615 \ - DS:OUTERRORS:COUNTER:600:0:18446744073709551615 \ - DS:INUCASTPKTS:COUNTER:600:0:18446744073709551615 \ - DS:OUTUCASTPKTS:COUNTER:600:0:18446744073709551615 \ - DS:INNUCASTPKTS:COUNTER:600:0:18446744073709551615 \ - DS:OUTNUCASTPKTS:COUNTER:600:0:18446744073709551615 \ + DS:INOCTETS:COUNTER:600:0:12500000000 \ + DS:OUTOCTETS:COUNTER:600:0:12500000000 \ + DS:INERRORS:COUNTER:600:0:12500000000 \ + DS:OUTERRORS:COUNTER:600:0:12500000000 \ + DS:INUCASTPKTS:COUNTER:600:0:12500000000 \ + DS:OUTUCASTPKTS:COUNTER:600:0:12500000000 \ + DS:INNUCASTPKTS:COUNTER:600:0:12500000000 \ + DS:OUTNUCASTPKTS:COUNTER:600:0:12500000000 \ RRA:AVERAGE:0.5:1:600 \ RRA:AVERAGE:0.5:6:700 \ RRA:AVERAGE:0.5:24:775 \