private EventSourceRest convertEventSource(EventSource source) { EventSourceRest esr = new EventSourceRest(); esr.setId(source.getId()); esr.setDescription(source.getEventDefinition().getDescription()); esr.setDisplayName(source.getEventDefinition().getDisplayName()); esr.setName(source.getEventDefinition().getName()); esr.setLocation(source.getLocation()); esr.setResourceId(source.getResourceId()); return esr; }
private Integer getAgentId(EventSource source) { try { int resourceId = source.getResource().getId(); Integer agentId = agentManager.getAgentIdByResourceId(resourceId); return agentId; } catch (Throwable t) { log.error("Error looking up agent by EventSource", t); } return null; }
warningEvent = new Event(eventSource.getEventDefinition().getName(), eventSource.getLocation(), now, EventSeverity.WARN, warningMessage, eventSource); eventSet.add(warningEvent);
for (EventSource eventSource : events.keySet()) { int paramIndex = 1; ps.setString(paramIndex++, eventSource.getEventDefinition().getName()); ps.setString(paramIndex++, eventSource.getEventDefinition().getResourceType().getName()); ps.setString(paramIndex++, eventSource.getEventDefinition().getResourceType().getPlugin()); ps.setInt(paramIndex++, eventSource.getResource().getId()); ps.setString(paramIndex++, eventSource.getLocation()); ps.setString(paramIndex++, eventSource.getEventDefinition().getName()); ps.setString(paramIndex++, eventSource.getEventDefinition().getResourceType().getName()); ps.setString(paramIndex++, eventSource.getEventDefinition().getResourceType().getPlugin()); ps.setInt(paramIndex++, eventSource.getResource().getId()); ps.setString(paramIndex++, eventSource.getLocation()); for (Event event : eventData) { int paramIndex = 1; ps.setString(paramIndex++, eventSource.getEventDefinition().getName()); ps.setString(paramIndex++, eventSource.getEventDefinition().getResourceType().getName()); ps.setString(paramIndex++, eventSource.getEventDefinition().getResourceType().getPlugin()); ps.setInt(paramIndex++, eventSource.getResource().getId()); ps.setString(paramIndex++, eventSource.getLocation()); ps.setLong(paramIndex++, event.getTimestamp()); ps.setString(paramIndex++, event.getSeverity().toString());
Resource resource = source.getResource(); List<EventCacheElement> cacheElements = lookupEventCacheElements(resource.getId()); int matched = stats.matched; processCacheElements(cacheElements, event.getSeverity(), event.getTimestamp(), stats, "sourceLocation=" + source.getLocation(), event.getDetail()); if (matched < stats.matched) { break;
private EventSource createEventSource(Event event, Resource resource) { EventDefinition eventDefinition = EventUtility.getEventDefinition(event.getType(), resource.getResourceType()); if (eventDefinition == null) { throw new IllegalArgumentException("Unknown type - no EventDefinition found with name '" + event.getType() + "'."); } //noinspection ConstantConditions return new EventSource(event.getSourceLocation(), eventDefinition, resource); }
public Event(@NotNull long timestamp, @NotNull EventSeverity severity, @NotNull EventSource source, @NotNull String detail) { if(source==null) throw new IllegalArgumentException("Source must not be null."); this.timestamp = timestamp; this.severity = severity; this.detail = detail; this.sourceLocation = source.getLocation(); this.source = source; }
criteria.addFilterSourceId(source.getId()); if (startTime>0) { criteria.addFilterStartTime(startTime);
source = new EventSource(esr.getLocation(),eventDefinition,resource); em.persist(source); } else if (sources.size()==1) {
private EventRest convertEvent(Event event) { EventRest er = new EventRest(); er.setDetail(event.getDetail()); er.setId(event.getId()); er.setSeverity(event.getSeverity().toString()); er.setTimestamp(event.getTimestamp()); er.setSourceId(event.getSource().getId()); return er; }
log.error("Could not find agent for resourceId = " + source.getResource().getId()); return new AlertConditionCacheStats();