Skip to content

Instantly share code, notes, and snippets.

@mresetar
Created December 20, 2017 12:25
Show Gist options
  • Save mresetar/6b1f85167fb38e2a4902076e69598625 to your computer and use it in GitHub Desktop.
Save mresetar/6b1f85167fb38e2a4902076e69598625 to your computer and use it in GitHub Desktop.
Delete FEM events by using the filter
# lookup the failed event manager
objstr = AdminControl.completeObjectName('WebSphere:*,type=FailedEventManager')
obj = AdminControl.makeObjectName(objstr)
# 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 )
print "Executing search by filter...."
fecount = AdminControl.invoke_jmx(obj, 'getFailedEventCount', [filter1], ['com.ibm.wbiserver.manualrecovery.QueryFilters'])
print "The number of failed events for filter:"
print fecount
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 after de
fecount2 = AdminControl.invoke_jmx(obj, 'getFailedEventCount', [filter1], ['com.ibm.wbiserver.manualrecovery.QueryFilters'])
print "Events for filter after delete"
print fecount2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment