diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/keepalived/vyatta-keepalived.pl | 21 | ||||
-rwxr-xr-x | scripts/keepalived/vyatta-vrrp-state.pl | 9 |
2 files changed, 26 insertions, 4 deletions
diff --git a/scripts/keepalived/vyatta-keepalived.pl b/scripts/keepalived/vyatta-keepalived.pl index 1deeafe8..0f1301db 100755 --- a/scripts/keepalived/vyatta-keepalived.pl +++ b/scripts/keepalived/vyatta-keepalived.pl @@ -81,6 +81,21 @@ sub keepalived_get_values { } } + $config->setLevel("$path vrrp vrrp-group $group run-transition-scripts"); + my $run_backup_script = $config->returnValue("backup"); + if(!defined $run_backup_script){ + $run_backup_script = "null"; + } + my $run_fault_script = $config->returnValue("fault"); + if(!defined $run_fault_script){ + $run_fault_script = "null"; + } + my $run_master_script = $config->returnValue("master"); + if(!defined $run_master_script){ + $run_master_script = "null"; + } + + $output .= "vrrp_instance $vrrp_instance \{\n"; if ($preempt eq "false") { $output .= "\tstate BACKUP\n"; @@ -105,11 +120,11 @@ sub keepalived_get_values { } $output .= "\t\}\n"; $output .= "\tnotify_master "; - $output .= "\"$state_transition_script master $intf $group @vips\" \n"; + $output .= "\"$state_transition_script master $intf $group $run_master_script @vips\" \n"; $output .= "\tnotify_backup "; - $output .= "\"$state_transition_script backup $intf $group @vips\" \n"; + $output .= "\"$state_transition_script backup $intf $group $run_backup_script @vips\" \n"; $output .= "\tnotify_fault "; - $output .= "\"$state_transition_script fault $intf $group @vips\" \n"; + $output .= "\"$state_transition_script fault $intf $group $run_fault_script @vips\" \n"; $output .= "\}\n"; } diff --git a/scripts/keepalived/vyatta-vrrp-state.pl b/scripts/keepalived/vyatta-vrrp-state.pl index 8b813529..9e11b649 100755 --- a/scripts/keepalived/vyatta-vrrp-state.pl +++ b/scripts/keepalived/vyatta-vrrp-state.pl @@ -55,7 +55,8 @@ sub vrrp_state_log { my $vrrp_state = $ARGV[0]; my $vrrp_intf = $ARGV[1]; my $vrrp_group = $ARGV[2]; -my $vrrp_vip = $ARGV[3]; +my $vrrp_transitionscript = $ARGV[3]; +my $vrrp_vip = $ARGV[4]; my $sfile = VyattaKeepalived::get_state_file($vrrp_intf, $vrrp_group); my ($old_time, $old_intf, $old_group, $old_state, $old_ltime) = @@ -77,6 +78,12 @@ if ($vrrp_state eq "backup") { system("rm -f $mfile"); } + +if (!($vrrp_transitionscript eq "null")){ + exec("$vrrp_transitionscript"); +} + + exit 0; # end of file |