Description

Please follow the below steps to implement slax scripts using event-script configuration.

Solution

1) Copy the slax script in the following path in the router.

/var/db/scripts/event/script_name.slax

2) Configure the below event-options matching the symptoms in the respective slax script.

For eg, I am using the below slax script
 
set event-options generate-event fpc_deep_cstate_avoidance_gen time-interval 3600
set event-options policy fpc_deep_cstate_avoidance_periodic events fpc_deep_cstate_avoidance_gen
set event-options policy fpc_deep_cstate_avoidance_periodic then event-script fpc_deep_cstate_avoidance.slax
set event-options event-script file fpc_deep_cstate_avoidance.slax

set event-options policy fpc_deep_cstate_avoidance events chassisd_snmp_trap7
set event-options policy fpc_deep_cstate_avoidance within 30 trigger on
set event-options policy fpc_deep_cstate_avoidance within 30 trigger 1
set event-options policy fpc_deep_cstate_avoidance attributes-match chassisd_snmp_trap7.trap matches "Fru Online"
set event-options policy fpc_deep_cstate_avoidance attributes-match chassisd_snmp_trap7.value5 matches "FPC"
set event-options policy fpc_deep_cstate_avoidance then event-script fpc_deep_cstate_avoidance.slax

3) Optional but recommended configuration.

set event-options event-script 

set system scripts synchronize

4) Check the logs using the following commands.

show log escript.log

NOTE for the initial installation

In the first script installation, it will take 1 hour to the workaround to be applied for some slax scripts. This should not be any problem in normal case.
But in the case you want immediately apply the slax script, you can manually run the script from root user cli.

Router> op url /var/db/scripts/event/fpc_deep_cstate_avoidance.slax

(This is only needed in first script installation, later it will be done by event-policy.)

To completely remove the script

We need to delete/deactivate the event-policy first.
Then you still need to manually kill the FPC side script with below command (Requires root rights)

Router> op url /var/db/scripts/event/script_name.slax kill true

Modification History

2024-07-08 : Article Created