Log in to ask questions, share your expertise, or stay connected to content you value. Don’t have a login? Learn how to become a member.
See matching posts in thread - reordering security policy's in different ......RE:...
To commit a configuration on occurrence of an event, the following configuration can be used: 1 [edit] 2 user@host # show event-options 3 policy <policy-name> ( 4 events <event-name>; 5 then ( 6 change-configuration ( 7 commands ( 8 "set system login message hello" ; 9 ) 10 ) 11 ) 12 ) 13 14 [edit] 15 user@host # As per the above configuration, when a specified event occurs in the system, this policy get executed and a configuration statement defined in policy will be committed. A user can specify more that one configuration statement in a single policy
Commit a Configuration Using an Event Policy To commit a configuration on occurrence of an event, you can use the following configuration: 1 [edit] 2 user@host# show event-options 3 policy <policy-name> ( 4 events <event-name>; 5 then ( 6 change-configuration ( 7 commands ( 8 "set system login message hello"; 9 ) 10 ) 11 ) 12 ) 13 14 [edit] 15 user@host# As shown in the configuration, when a specified event occurs in the system, the policy gets executed and a configuration statement defined in policy is committed. You can specify more that one configuration statement in a single policy
To raise an SNMP trap on occurrence of an event following configuration, use the following: 1 [edit] 2 user@host # show event-options 3 policy <policy-name> ( 4 events <event-name>; 5 then ( 6 raise- trap ; 7 ) 8 ) 9 10 [edit] 11 user@host # As per the above configuration, when a specified event occurs in the system, this policy is executed and an SNMP trap will be raised
To raise an SNMP trap on occurrence of an event following configuration, use the following: 1 [edit] 2 user@host# show event-options 3 policy <policy-name> ( 4 events <event-name>; 5 then ( 6 raise-trap; 7 ) 8 ) 9 10 [edit] 11 user@host# As per the above configuration, when a specified event occurs in the system, this policy is executed and an SNMP trap will be raised
"; ) /* * This API element is used to retrieve the configuration. Either the candidate or the committed * configuration can be used
Execute CLI Commands Using an Event Policy To execute a CLI command on occurrence of an event, use the following configuration: 1 [edit] 2 user@host # show event-options 3 policy <policy-name> ( 4 events <event-name>; 5 then ( 6 execute-commands ( 7 commands ( 8 "show version" ; 9 ) 10 output-filename cmd output; 11 destination test dest; 12 ) 13 ) 14 ) 15 destinations ( 16 test dest ( 17 archive-sites ( 18 /var/tmp; 19 ) 20 ) 21 ) 22 23 [edit] 24 user@host # As per the above configuration, when a specified event occurs in the system, this policy is executed and a CLI command mentioned in the policy will execute (in this case "show version")
Execute CLI Commands Using an Event Policy To execute a CLI command on occurrence of an event, use the following configuration: 1 [edit] 2 user@host# show event-options 3 policy <policy-name> ( 4 events <event-name>; 5 then ( 6 execute-commands ( 7 commands ( 8 "show version"; 9 ) 10 output-filename cmd output; 11 destination test dest; 12 ) 13 ) 14 ) 15 destinations ( 16 test dest ( 17 archive-sites ( 18 /var/tmp; 19 ) 20 ) 21 ) 22 23 [edit] 24 user@host# As described in the previous configuration example, when a specified event occurs in the system, the policy is executed and a CLI command mentioned in the policy executes (in this example, "show version")
The policy configuration will be as follows: 01 [edit] 02 user@host# show event-options 03 policy <policy-name> ( 04 events TEST; 05 within 60 events TEST; 06 then ( 07 ignore; 08 ) 09 ) 10 policy <policy-name> ( 11 events TEST; 12 then ( 13 execute-commands ( 14 commands ( 15 "show version"; 16 ) 17 output-filename cmd output; 18 destination test dest; 19 ) 20 ) 21 ) 22 destinations ( 23 test dest ( 24 archive-sites ( 25 /var/tmp; 26 ) 27 ) 28 ) 29 30 [edit] 31 user@host# As per the above configuration, if event 'TEST' occurs the first time, then the second policy will get executed, and if 'TEST' occurs again within 60 seconds, then it will be ignored as per the first policy