Search

1 to 10 of 34
Sort by

Blog Entry
How-To: Raise SNMP traps using event 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


Blog Entry
Scripting How-To: Raise SNMP traps using event 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


Blog Entry
How-To: Simulate an event for testing event-policy

From Junos OS Release 9.1 onwards, you can test event-policy by using the 'logger' utility to simulate the desired event


Blog Entry
Scripting How-To: Simulate an event for testing event policy

Simulate an Event for Testing Event Policy From Junos OS Release 9.1 and later, you can test event policy by using the 'logger' utility to simulate the desired event


Blog Entry
Scripting How-To: Execute CLI commands using an event policy

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")


Blog Entry
Scripting How-To: Commit a configuration using an event policy

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


Blog Entry
Scripting How-To: Call shell commands with an event policy

Users cannot run shell commands through an event policy because of security reasons. Only CLI commands are allowed to run from an event policy action


Blog Entry
Scripting How-To: Execute CLI commands using an event policy

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")


Blog Entry
Scripting How-To: Commit a configuration using an event 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


Blog Entry
Scripting How-To: Control execution of an event policy (dampening logic)

Overview Controlled event policy execution. Resolution In some cases, you might want to control the execution of an event policy. For example, if you don't want to execute the configured policy for an event more than once in 60 seconds, you can write a policy to ignore that event if it occurs again within 60 seconds. 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