diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-01-24 01:10:09 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-01-24 01:10:09 +0000 |
commit | 87c4907f7fc19e7b29afd34f67553400fddd8fb4 (patch) | |
tree | 64a8f346c84c9128182b7e28692e4d5236bfc20e | |
parent | 5ee43dc752b511452a9b8283ff8205364ee5ee4e (diff) | |
download | pfsense-packages-87c4907f7fc19e7b29afd34f67553400fddd8fb4.tar.gz pfsense-packages-87c4907f7fc19e7b29afd34f67553400fddd8fb4.tar.bz2 pfsense-packages-87c4907f7fc19e7b29afd34f67553400fddd8fb4.zip |
Use monitorip if available.
-rw-r--r-- | packages/tinydns/tinydns.inc | 7 | ||||
-rw-r--r-- | packages/tinydns/tinydns_status.php | 32 |
2 files changed, 27 insertions, 12 deletions
diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc index 18bf5c6c..76152040 100644 --- a/packages/tinydns/tinydns.inc +++ b/packages/tinydns/tinydns.inc @@ -232,13 +232,16 @@ function tinydns_setup_ping_items() { else $row['pingthreshold'] = ""; if($row['monitorip']) - fwrite($fd, $row['monitorip'] . "|" . $row['failoverip'] . "|3|/usr/local/pkg/tinydns_down.php|/usr/local/pkg/tinydns_up.php|{$pingthreshold}\n"); + fwrite($fd, ip . "|" . $row['monitorip'] . "|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"); + fwrite($fd, $ip . "|" . $row['monitorip'] . "|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"); + } fclose($fd); conf_mount_ro(); diff --git a/packages/tinydns/tinydns_status.php b/packages/tinydns/tinydns_status.php index 7bc5a441..49f07a10 100644 --- a/packages/tinydns/tinydns_status.php +++ b/packages/tinydns/tinydns_status.php @@ -84,7 +84,11 @@ foreach($config['installedpackages']['tinydnsdomains']['config'] as $ping) { continue; $ipaddress = $ping['ipaddress']; $hostname = $ping['hostname']; - $status = file_get_contents("/var/db/pingstatus/$ipaddress"); + $monitorip = $ping['monitorip']; + if(file_exists("/var/db/pingstatus/$monitorip")) + $status = file_get_contents("/var/db/pingstatus/$monitorip"); + else + $status = "N/A"; if(stristr($tinydns_data, "+{$hostname}:{$ipaddress}")) $inservice = "<FONT COLOR='GREEN'>YES</FONT>"; else @@ -97,7 +101,7 @@ foreach($config['installedpackages']['tinydnsdomains']['config'] as $ping) { if(stristr($status,"DOWN")) echo "<FONT COLOR='red'>DOWN</FONT>"; else - echo $status; + echo "UP"; echo "</td>"; echo "<td class=\"listlr\">"; @@ -105,8 +109,10 @@ foreach($config['installedpackages']['tinydnsdomains']['config'] as $ping) { echo "</td>"; echo "<td class=\"listlr\">"; - if(file_exists("/var/db/pingmsstatus/$ipaddress")) - $msstatus = file_get_contents("/var/db/pingmsstatus/$ipaddress"); + if(!$monitorip) + $monitorip = $ipaddress; + if(file_exists("/var/db/pingmsstatus/$monitorip")) + $msstatus = file_get_contents("/var/db/pingmsstatus/$monitorip"); else $msstatus = "N/A"; echo $msstatus; @@ -115,13 +121,17 @@ foreach($config['installedpackages']['tinydnsdomains']['config'] as $ping) { foreach($ping['row'] as $row) { $ipaddress = $row['failoverip']; - $status = file_get_contents("/var/db/pingstatus/$ipaddress"); + $monitorip = $row['monitorip']; + if(file_exists("/var/db/pingstatus/$monitorip")) + $status = file_get_contents("/var/db/pingstatus/$monitorip"); + else + $status = "N/A"; echo "<tr>"; echo "<td class=\"listlr\"> |-> "; echo $ipaddress; if($row['loadbalance']) echo " (LB)"; - if(stristr($tinydns_data, "+{$hostname}:{$row['failoverip']}")) + if(stristr($tinydns_data, "+{$hostname}:{$row['monitorip']}")) $inservice = "<FONT COLOR='GREEN'>YES</FONT>"; else $inservice = "<FONT COLOR='BLUE'>NO</FONT>"; @@ -130,7 +140,7 @@ foreach($config['installedpackages']['tinydnsdomains']['config'] as $ping) { if(stristr($status,"DOWN")) echo "<FONT COLOR='red'>DOWN</FONT>"; else - echo $status; + echo "UP"; echo "</td>"; echo "<td class=\"listlr\">"; @@ -138,14 +148,16 @@ foreach($config['installedpackages']['tinydnsdomains']['config'] as $ping) { echo "</td>"; echo "<td class=\"listlr\">"; - if(file_exists("/var/db/pingmsstatus/$ipaddress")) - $msstatus = file_get_contents("/var/db/pingmsstatus/$ipaddress"); + if(!$monitorip) + $monitorip = $ipaddress; + if(file_exists("/var/db/pingmsstatus/$monitorip")) + $msstatus = file_get_contents("/var/db/pingmsstatus/$monitorip"); else $msstatus = "N/A"; + echo $msstatus; echo "</td>"; echo "</tr>"; - } echo "<tr><td> </td></tr>"; } |