mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
keepalived UI: add dummy ip for HA state tracking
add dummy ip 192.0.2.1 in virutal_ipaddress from (TEST-NET-1) according to https://www.rfc-editor.org/rfc/rfc5737#section-3 for keepalived HA state tracking, the Master will always have the dummy ip assigned to green0. add refresh button for HA state refresh Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
This commit is contained in:
@@ -59,6 +59,7 @@ if (open(FILE, "$loxilbipfile")) {
|
|||||||
&Header::showhttpheaders();
|
&Header::showhttpheaders();
|
||||||
our @ITFs=('RED', 'GREEN');
|
our @ITFs=('RED', 'GREEN');
|
||||||
my @STATE= ('MASTER', 'BACKUP');
|
my @STATE= ('MASTER', 'BACKUP');
|
||||||
|
my $DUMMY_IP = '192.0.2.1'; #for HA master/backup state tracking
|
||||||
|
|
||||||
#Settings1 for the first screen box
|
#Settings1 for the first screen box
|
||||||
foreach my $itf (@ITFs) {
|
foreach my $itf (@ITFs) {
|
||||||
@@ -165,6 +166,14 @@ if ($hasettings{'ENABLE_HA'} eq "on") {
|
|||||||
$checked = "checked='checked'";
|
$checked = "checked='checked'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $hastate = "<table cellpadding='2' cellspacing='0' bgcolor='${Header::colourred}' width='50%'><tr><td align='center'><b><font color='#FFFFFF'>$Lang::tr{'standby'}</font></b></td></tr></table>";
|
||||||
|
|
||||||
|
my @ips = &General::get_ipaddresses_from_interface("green0");
|
||||||
|
|
||||||
|
if (grep { $_ eq $DUMMY_IP } @ips) {
|
||||||
|
$hastate = "<table cellpadding='2' cellspacing='0' bgcolor='${Header::colourgreen}' width='50%'><tr><td align='center'><b><font color='#FFFFFF'>$Lang::tr{'active'}</font></b></td></tr></table>";
|
||||||
|
}
|
||||||
|
|
||||||
my $sactive = "<table cellpadding='2' cellspacing='0' bgcolor='${Header::colourred}' width='50%'><tr><td align='center'><b><font color='#FFFFFF'>$Lang::tr{'stopped'}</font></b></td></tr></table>";
|
my $sactive = "<table cellpadding='2' cellspacing='0' bgcolor='${Header::colourred}' width='50%'><tr><td align='center'><b><font color='#FFFFFF'>$Lang::tr{'stopped'}</font></b></td></tr></table>";
|
||||||
|
|
||||||
my @status = &General::system_output('/usr/local/bin/keepalivedctrl', 'status');
|
my @status = &General::system_output('/usr/local/bin/keepalivedctrl', 'status');
|
||||||
@@ -183,10 +192,19 @@ print <<END;
|
|||||||
<td width='25%'> </td>
|
<td width='25%'> </td>
|
||||||
<tr><td class='boldbase'>$Lang::tr{'keepalived status'}</td>
|
<tr><td class='boldbase'>$Lang::tr{'keepalived status'}</td>
|
||||||
<td align='left'>$sactive</td>
|
<td align='left'>$sactive</td>
|
||||||
|
<td align='center'>$hastate</td>
|
||||||
|
<td align='right'>
|
||||||
|
<form method='GET' action='$ENV{'SCRIPT_NAME'}'>
|
||||||
|
<input type='submit' value='Refresh'>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan='4'> </td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width='50%' class='boldbase'>$Lang::tr{'enable'}
|
<td width='100%' class='boldbase'>$Lang::tr{'enable'}
|
||||||
<td><input type='checkbox' name='ENABLE_HA' $checked></td>
|
<td align='left'><input type='checkbox' name='ENABLE_HA' $checked></td>
|
||||||
<td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'enable'}'></td>
|
<td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'enable'}'></td>
|
||||||
</tr>
|
</tr>
|
||||||
END
|
END
|
||||||
@@ -337,6 +355,7 @@ sub buildconf {
|
|||||||
print FILE "\t}" . "\n";
|
print FILE "\t}" . "\n";
|
||||||
# virtual ipaddress
|
# virtual ipaddress
|
||||||
print FILE "\tvirtual_ipaddress {" . "\n";
|
print FILE "\tvirtual_ipaddress {" . "\n";
|
||||||
|
print FILE "\t\t$DUMMY_IP" . "\n";
|
||||||
my @vips = split(/\|/, $hasettings{"virtual_ipaddress_${itf}"});
|
my @vips = split(/\|/, $hasettings{"virtual_ipaddress_${itf}"});
|
||||||
foreach my $ip (@vips) {
|
foreach my $ip (@vips) {
|
||||||
print FILE "\t\t$ip" . "\n";
|
print FILE "\t\t$ip" . "\n";
|
||||||
|
|||||||
@@ -141,6 +141,7 @@
|
|||||||
'activate' => 'Activate',
|
'activate' => 'Activate',
|
||||||
'activate user' => 'Activate user',
|
'activate user' => 'Activate user',
|
||||||
'active' => 'Active',
|
'active' => 'Active',
|
||||||
|
'standby' => 'Standby',
|
||||||
'add' => 'Add',
|
'add' => 'Add',
|
||||||
'add a host' => 'Add a host',
|
'add a host' => 'Add a host',
|
||||||
'add a new rule' => 'Add a new rule:',
|
'add a new rule' => 'Add a new rule:',
|
||||||
|
|||||||
@@ -138,6 +138,7 @@
|
|||||||
'activate' => '激活',
|
'activate' => '激活',
|
||||||
'activate user' => '激活用户',
|
'activate user' => '激活用户',
|
||||||
'active' => 'Active',
|
'active' => 'Active',
|
||||||
|
'standby' => 'Standby',
|
||||||
'add' => '添加',
|
'add' => '添加',
|
||||||
'add a host' => '添加主机',
|
'add a host' => '添加主机',
|
||||||
'add a new rule' => '添加规则:',
|
'add a new rule' => '添加规则:',
|
||||||
|
|||||||
Reference in New Issue
Block a user