Skip to content

Instantly share code, notes, and snippets.

@mresetar
Created December 20, 2017 12:01
Show Gist options
  • Save mresetar/dd0d5bc68b7bc962e984b073427f6b8f to your computer and use it in GitHub Desktop.
Save mresetar/dd0d5bc68b7bc962e984b073427f6b8f to your computer and use it in GitHub Desktop.
Delete 100 FEM events
# lookup the failed event manager
objstr = AdminControl.completeObjectName('WebSphere:*,type=FailedEventManager')
obj = AdminControl.makeObjectName(objstr)
# count the overall number of failed events
fecount = AdminControl.invoke(objstr, "getFailedEventCount")
print "Before discarding failed events"
print fecount
# create filter and return filtered events
import com.ibm.wbiserver.manualrecovery.QueryFilters
filter1 = com.ibm.wbiserver.manualrecovery.QueryFilters()
#filter1.setFilterArray('EVENT_TYPE', ['SCA','JMS','BPC','MQ'])
filter1.setFilterArray('EVENT_TYPE', ['SCA'])
dateFilter = java.util.Date("12/1/2016");
filter1.setFilter('END_TIME', dateFilter )
failedevents = AdminControl.invoke_jmx(obj, 'queryFailedEvents',[filter1, 0, 100],['com.ibm.wbiserver.manualrecovery.QueryFilters', 'int', 'int'])
# discard 100 events in single batch run
print "Discarding 100 failed events"
AdminControl.invoke_jmx(obj,'discardFailedEvents', [failedevents],['java.util.List'])
# count the overall number of failed events
fecount2 = AdminControl.invoke(objstr,"getFailedEventCount")
print "After discarding failed events, the number of failed events:"
print fecount2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment