mirror of https://github.com/apache/cloudstack.git
Adding eventDateTime to all event generation locations
This commit is contained in:
parent
e48e75625d
commit
14ee684ce3
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package com.cloud.event;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -189,6 +191,10 @@ public class ActionEventUtils {
|
|||
eventDescription.put("status", state.toString());
|
||||
eventDescription.put("entity", entityType);
|
||||
eventDescription.put("entityuuid", entityUuid);
|
||||
|
||||
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
eventDescription.put("eventDateTime", eventDate);
|
||||
|
||||
event.setDescription(eventDescription);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -31,8 +31,10 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
@Component
|
||||
public class AlertGenerator {
|
||||
|
|
@ -83,6 +85,10 @@ public class AlertGenerator {
|
|||
} else {
|
||||
eventDescription.put("podId", null);
|
||||
}
|
||||
|
||||
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
eventDescription.put("eventDateTime", eventDate);
|
||||
|
||||
event.setDescription(eventDescription);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -148,6 +150,10 @@ public class UsageEventUtils {
|
|||
eventDescription.put("event", usageEventType);
|
||||
eventDescription.put("resource", resourceType);
|
||||
eventDescription.put("id", resourceUUID);
|
||||
|
||||
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
eventDescription.put("eventDateTime", eventDate);
|
||||
|
||||
event.setDescription(eventDescription);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ import org.apache.log4j.Logger;
|
|||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -80,6 +82,10 @@ public class NetworkStateListener implements StateListener<State, Event, Network
|
|||
eventDescription.put("id", vo.getUuid());
|
||||
eventDescription.put("old-state", oldState.name());
|
||||
eventDescription.put("new-state", newState.name());
|
||||
|
||||
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
eventDescription.put("eventDateTime", eventDate);
|
||||
|
||||
eventMsg.setDescription(eventDescription);
|
||||
try {
|
||||
_eventBus.publish(eventMsg);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ import com.cloud.storage.SnapshotVO;
|
|||
import com.cloud.utils.fsm.StateListener;
|
||||
import com.cloud.utils.component.ComponentContext;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -79,6 +81,10 @@ public class SnapshotStateListener implements StateListener<State, Event, Snapsh
|
|||
eventDescription.put("id", vo.getUuid());
|
||||
eventDescription.put("old-state", oldState.name());
|
||||
eventDescription.put("new-state", newState.name());
|
||||
|
||||
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
eventDescription.put("eventDateTime", eventDate);
|
||||
|
||||
eventMsg.setDescription(eventDescription);
|
||||
try {
|
||||
_eventBus.publish(eventMsg);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ import org.apache.cloudstack.framework.events.EventBusException;
|
|||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -74,6 +76,10 @@ public class VolumeStateListener implements StateListener<State, Event, Volume>
|
|||
eventDescription.put("id", vo.getUuid());
|
||||
eventDescription.put("old-state", oldState.name());
|
||||
eventDescription.put("new-state", newState.name());
|
||||
|
||||
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
eventDescription.put("eventDateTime", eventDate);
|
||||
|
||||
eventMsg.setDescription(eventDescription);
|
||||
try {
|
||||
_eventBus.publish(eventMsg);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ import org.apache.log4j.Logger;
|
|||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -116,6 +118,10 @@ public class UserVmStateListener implements StateListener<State, VirtualMachine.
|
|||
eventDescription.put("id", vo.getUuid());
|
||||
eventDescription.put("old-state", oldState.name());
|
||||
eventDescription.put("new-state", newState.name());
|
||||
|
||||
String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
eventDescription.put("eventDateTime", eventDate);
|
||||
|
||||
eventMsg.setDescription(eventDescription);
|
||||
try {
|
||||
_eventBus.publish(eventMsg);
|
||||
|
|
|
|||
Loading…
Reference in New Issue