Generate an event

You can use the nzevent generate command to trigger an event for the event manager. If the event matches a current event rule, the system takes the action that is defined by the event rule.

You might generate events for the following cases:
  • To simulate a system event to test an event rule.
  • To add new events because the system is not generating events for conditions for which you would like notification.
If the event that you want to generate has a restriction, specify the arguments that would trigger the restriction by using the -eventArgs option.
Note: Make sure that any restriction argument in the -eventArgs string does not contain " " as input, as it might cause failure in event generation with appropriate error code.
For example, if a runaway query event has a restriction that the duration of the query must be greater than 30 seconds, use a command similar to the following to ensure that a generated event is triggered:
nzevent generate -eventtype runawayquery -eventArgs 'duration=50'

In this example, the duration meets the event criteria (greater than 30) and the event is triggered. If you do not specify a value for a restriction argument in the -eventArgs string, the command uses default values for the arguments. In this example, duration has a default of 0, so the event would not be triggered since it did not meet the event criteria.

To generate an event for a system state change:
nzevent generate -eventType sysStateChanged 
-eventArgs 'previousState=online, currentState=paused'