From 5ee43dc752b511452a9b8283ff8205364ee5ee4e Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 24 Jan 2007 00:15:21 +0000 Subject: Add monitor ip support --- packages/tinydns/tinydns.inc | 19 +++++++++++++++---- packages/tinydns/tinydns_domains.xml | 13 +++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) (limited to 'packages/tinydns') diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc index a59d2f9c..18bf5c6c 100644 --- a/packages/tinydns/tinydns.inc +++ b/packages/tinydns/tinydns.inc @@ -223,15 +223,22 @@ function tinydns_setup_ping_items() { */ foreach($config['installedpackages']['tinydnsdomains']['config'] as $domain) { fwrite($fd, $ip . "|" . $domain['ipaddress'] . "|3|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php\n"); + if($domain['monitorip'] <> "") + $monitorip = $domain['monitorip']; if($domain['row']) { foreach($domain['row'] as $row) { if($row['pingthreshold']) $pingthreshold = $row['pingthreshold']; else $row['pingthreshold'] = ""; - fwrite($fd, $ip . "|" . $row['failoverip'] . "|3|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n"); + if($row['monitorip']) + fwrite($fd, $row['monitorip'] . "|" . $row['failoverip'] . "|3|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n"); + else + fwrite($fd, $ip . "|" . $row['failoverip'] . "|3|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n"); } } + if($domain['monitorip']) + fwrite($fd, $domain['monitorip'] . "|" . $row['failoverip'] . "|3|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n"); } fclose($fd); conf_mount_ro(); @@ -254,9 +261,13 @@ function tinydns_create_zone_file() { /* check record status, if it is down request * backup server if defined. */ - $status = tinydns_get_record_status($ipaddress); - if(!$status) - $ipaddress = tinydns_get_backup_record($ipaddress); + if($domain['monitorip']) + $monitorip = $domain['monitorip']; + if($monitorip) { + $status = tinydns_get_record_status($monitorip); + if(!$status) + $ipaddress = tinydns_get_backup_record($ipaddress); + } $record_data = tinydns_get_rowline_data($ipaddress, $domain['recordtype'], $ttl, $hostname); if($record_data) fwrite($fd, $record_data . "\n"); diff --git a/packages/tinydns/tinydns_domains.xml b/packages/tinydns/tinydns_domains.xml index 15bed905..75e3c186 100644 --- a/packages/tinydns/tinydns_domains.xml +++ b/packages/tinydns/tinydns_domains.xml @@ -68,6 +68,12 @@ input 35 + + monitorip + IP to ping to ensure service is up + input + 35 + threshhold Time in minutes before DNS switches to backup host @@ -104,6 +110,13 @@ input 7 + + IP to ping to ensure service is up + monitorip + When the WAN MS ping time is surpassed, item will failover to next host + input + 15 + -- cgit v1.2.3