Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

iCall script not working

ikkut23
Altostratus
Altostratus

Hi guys ,

 

 i have a scenario with a pool with two members ,Server A and Server B with priority group activated .

Server A - 192.168.16.80 pga 15

Server B 192.168.18.211 pga 10

i created an iCall script and what  i`m trying to accomplish is that when Server A will be down i want Server B to have a higher priority group so when Server A is back online it will be join pool as standby.

 

1) i created an alert /user_alert.conf

 

alert server1-down "Pool /Common/TeststanbyNode /Common/192.168.16.80:80 monitor status down." {
exec command="tmsh generate sys icall event change_pga context { { name ip value 192.168.16.80 } {name port value 80} }" }

 

2)created script 

 

sys icall script /Common/pool_member1_down {
app-service none
definition {
exec modify ltm pool TeststanbyNode members modify { 192.168.18.211:80 {priority-group 20}}
}
description none
events none
}

3)Handler

create sys icall handler triggered pool_member_down script pool_member1_down subscriptions add { change_pga {event-name change_priority} }
 
 
any idea what is wrong with my script 
 
 
Thank you in advance
Regards
 
6 REPLIES 6

JRahm
Community Manager
Community Manager

you're calling event change_pga from alertd but then icall script is expecting change-priority. Align those and you should be good to go.

ikkut23
Altostratus
Altostratus

Hi Jason thnx a lot , now i`m getting this error on /var/ltm logs  when i execute :

generate sys icall event change_priority

tmsh[19010]: 01420006:3: members: required brace is missing "{"
err scriptd[3868]: 014f0013:3: Script (/Common/pool_member1_down) generated this Tcl error: (script did not successfully complete: (Syntax Error: members: required brace is missing "{"

and when i manually put node down no errors on /var/ltm logs except that pool member monitor is down but no change on priority.

 

Thnx 

JRahm
Community Manager
Community Manager

ah..two things. 

  1. Use tmsh::modify instead of exec, no need to leave the script to modify objects (this is an optimization, not a fix)
  2. Escape your braces:
tmsh::modify ltm pool TeststanbyNode members modify \{ 192.168.18.211:80 \{priority-group 20\}\}

yeapp that did work , 

but still cant figure out with smth with alertd,when i mark the node down manually i can see on ltm log that 

Pool /Common/TeststanbyNode member /Common/192.168.16.80:80 monitor status node down.

but lets say its not triggering the event

alert server1-down "Pool /Common/TeststanbyNode /Common/192.168.16.80:80 monitor status node down." {
exec command="tmsh generate sys icall event change_pga context { { name ip value 192.168.16.80 } {name port value 80} }" }

 

can you double check ,and also idk if its worth mentioning but Big-IP version is 14.1.2.3.

 

ah also if i try and run "generate sys icall event .. " it works and script changes the pga.

 

Thnx

 

HI ikkut23:

I tested it a little bit The following is my config,

It can work normally, for your reference

#
cat /config/user_alert.conf
alert server1-down "Pool /Common/TeststanbyNode member /Common/node_10.1.20.13:80 monitor status down." {
   exec command="tmsh generate sys icall event change_pga context { { name ip value node_10.1.20.13 } {name port value 80} }"
}
#
tmsh list sys icall script pool_member1_down
sys icall script pool_member1_down {
    app-service none
    definition {
        foreach var { ip port } {
            set $var $EVENT::context($var)
        }
        tmsh::modify ltm pool TeststanbyNode members modify \{ $ip:$port \{priority-group 20\} \}
    }
    description none
    events none
}
#
tmsh list sys icall handler triggered change_pga
sys icall handler triggered change_pga {
    script pool_member1_down
    subscriptions {
        change_pga {
            event-name change_pga
        }
    }
}

have a good day!

v1.pngv2.png

kh-sectest
Nimbostratus
Nimbostratus

Thanks