Alona Kaplan has uploaded a new change for review.

Change subject: engine: event should contain the iface which exceeded defined 
threshold
......................................................................

engine: event should contain the iface which exceeded defined threshold

A general event was reported per host when any of the host's NICs exceeded
the threshold (based TX or RX values). The event didn't contain the nics
name. And containd just the max TX or RX from all the interfaces.
This patch extends it to a specific event per interface.

Change-Id: I22b3510398ac6fa3acf93fcb596dd6ea10b26366
Bug-Url: https://bugzilla.redhat.com/1070667
Signed-off-by: Alona Kaplan <[email protected]>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
M 
frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
A 
packaging/dbscripts/upgrade/03_04_0720_add_host_interface_high_network_use_event.sql
7 files changed, 22 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/39/26239/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
index 02ef01d..ecac38b 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
@@ -28,6 +28,7 @@
     VDS_MANUAL_FENCE_FAILED_CALL_FENCE_SPM(530),
     VDS_LOW_MEM(531, AuditLogTimeInterval.MINUTE.getValue() * 30),
     VDS_HIGH_MEM_USE(532, AuditLogTimeInterval.MINUTE.getValue() * 30),
+    @Deprecated
     VDS_HIGH_NETWORK_USE(533, AuditLogTimeInterval.MINUTE.getValue() * 30),
     VDS_HIGH_CPU_USE(534, AuditLogTimeInterval.MINUTE.getValue() * 30),
     VDS_HIGH_SWAP_USE(535, AuditLogTimeInterval.MINUTE.getValue() * 30),
@@ -84,6 +85,8 @@
     HOST_REFRESHED_CAPABILITIES(606),
     HOST_REFRESH_CAPABILITIES_FAILED(607),
 
+    HOST_INTERFACE_HIGH_NETWORK_USE(608, 
AuditLogTimeInterval.MINUTE.getValue() * 30),
+
     // Disk alignment audit logs
     DISK_ALIGNMENT_SCAN_START(700),
     DISK_ALIGNMENT_SCAN_FAILURE(701),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
index 05f8b2c..1fce252 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
@@ -31,7 +31,7 @@
         AddEventNotificationEntry(EventNotificationEntity.Host, 
AuditLogType.VDS_SET_NONOPERATIONAL);
         AddEventNotificationEntry(EventNotificationEntity.Host, 
AuditLogType.VDS_SET_NONOPERATIONAL_IFACE_DOWN);
         AddEventNotificationEntry(EventNotificationEntity.Host, 
AuditLogType.VDS_HIGH_MEM_USE);
-        AddEventNotificationEntry(EventNotificationEntity.Host, 
AuditLogType.VDS_HIGH_NETWORK_USE);
+        AddEventNotificationEntry(EventNotificationEntity.Host, 
AuditLogType.HOST_INTERFACE_HIGH_NETWORK_USE);
         AddEventNotificationEntry(EventNotificationEntity.Host, 
AuditLogType.VDS_HIGH_CPU_USE);
         AddEventNotificationEntry(EventNotificationEntity.Host, 
AuditLogType.VDS_HIGH_SWAP_USE);
         AddEventNotificationEntry(EventNotificationEntity.Host, 
AuditLogType.VDS_LOW_SWAP);
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
index 2fb132c..a8c07dd 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -604,7 +604,7 @@
 STORAGE_DOMAIN_ERROR=The error message for connection ${Connection} returned 
by VDSM was: ${ErrorMessage}
 VDS_LOW_MEM=Available memory of host ${HostName} [${AvailableMemory} MB] is 
under defined threshold [${Threshold} MB].
 VDS_HIGH_MEM_USE=Used memory of host ${HostName} [${UsedMemory}%] exceeded 
defined threshold [${Threshold}%].
-VDS_HIGH_NETWORK_USE=Used Network resources of host ${HostName} 
[${UsedNetwork}%] exceeded defined threshold [${Threshold}%].
+HOST_INTERFACE_HIGH_NETWORK_USE=Host ${HostName} has network interface which 
exceeded the defined threshold [${Threshold}%] (${InterfaceName}: transmit 
rate[${TransmitRate}%], receive rate [${ReceiveRate}%])
 VDS_HIGH_CPU_USE=Used CPU of host ${HostName} [${UsedCpu}%] exceeded defined 
threshold [${Threshold}%].
 VDS_HIGH_SWAP_USE=Used swap memory of host ${HostName} [${UsedSwap}%] exceeded 
defined threshold [${Threshold}%].
 VDS_LOW_SWAP=Available swap memory of host ${HostName} [${AvailableSwapMemory} 
MB] is under defined threshold [${Threshold} MB].
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
index f295d9e..bb3c64d 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
@@ -281,15 +281,21 @@
      * @param stat
      */
     private void checkVdsNetworkThreshold(VdsStatistics stat) {
-
         Integer maxUsedPercentageThreshold = 
Config.getValue(ConfigValues.LogMaxNetworkUsedThresholdInPercentage);
-        if (stat.getusage_network_percent() != null
-                && stat.getusage_network_percent() > 
maxUsedPercentageThreshold) {
-            AuditLogableBase logable = new AuditLogableBase(stat.getId());
-            logable.addCustomValue("HostName", _vds.getName());
-            logable.addCustomValue("UsedNetwork", 
stat.getusage_network_percent().toString());
-            logable.addCustomValue("Threshold", 
maxUsedPercentageThreshold.toString());
-            auditLog(logable, AuditLogType.VDS_HIGH_NETWORK_USE);
+        for (VdsNetworkInterface iface : _vds.getInterfaces()) {
+            Double transmitRate = iface.getStatistics().getTransmitRate();
+            Double receiveRate = iface.getStatistics().getReceiveRate();
+            if ((transmitRate != null && 
iface.getStatistics().getTransmitRate().intValue() > maxUsedPercentageThreshold)
+                    || (receiveRate != null && 
iface.getStatistics().getReceiveRate().intValue() > 
maxUsedPercentageThreshold)) {
+                AuditLogableBase logable = new AuditLogableBase(_vds.getId());
+                logable.setCustomId(iface.getName());
+                logable.addCustomValue("HostName", _vds.getName());
+                logable.addCustomValue("InterfaceName", iface.getName());
+                logable.addCustomValue("Threshold", 
maxUsedPercentageThreshold.toString());
+                logable.addCustomValue("TransmitRate", 
String.valueOf(transmitRate.intValue()));
+                logable.addCustomValue("ReceiveRate", 
String.valueOf(receiveRate.intValue()));
+                auditLog(logable, 
AuditLogType.HOST_INTERFACE_HIGH_NETWORK_USE);
+            }
         }
     }
 
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
index fa1a564..2ddb87d 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
@@ -792,7 +792,7 @@
 
     String AuditLogType___VDS_HIGH_MEM_USE();
 
-    String AuditLogType___VDS_HIGH_NETWORK_USE();
+    String AuditLogType___HOST_INTERFACE_HIGH_NETWORK_USE();
 
     String AuditLogType___VDS_HIGH_CPU_USE();
 
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
 
b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
index f41757a..d0fbf69 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
+++ 
b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
@@ -394,7 +394,7 @@
 AuditLogType___VDS_SET_NONOPERATIONAL_DOMAIN=Host state was set to 
non-operational due to inaccessible Storage Domain
 AuditLogType___SYSTEM_CHANGE_STORAGE_POOL_STATUS_NO_HOST_FOR_SPM=Failed 
electing an SPM for the Data-Center
 AuditLogType___VDS_HIGH_MEM_USE=Host memory usage exceeded defined threshold
-AuditLogType___VDS_HIGH_NETWORK_USE=Host network usage exceeded defined 
threshold
+AuditLogType___HOST_INTERFACE_HIGH_NETWORK_USE=Host network interface usage 
exceeded defined threshold
 AuditLogType___VDS_HIGH_CPU_USE=Host cpu usage exceeded defined threshold
 AuditLogType___VDS_HIGH_SWAP_USE=Host swap memory usage exceeded defined 
threshold
 AuditLogType___VDS_LOW_SWAP=Host free swap memory is under defined threshold
diff --git 
a/packaging/dbscripts/upgrade/03_04_0720_add_host_interface_high_network_use_event.sql
 
b/packaging/dbscripts/upgrade/03_04_0720_add_host_interface_high_network_use_event.sql
new file mode 100644
index 0000000..9f05eca
--- /dev/null
+++ 
b/packaging/dbscripts/upgrade/03_04_0720_add_host_interface_high_network_use_event.sql
@@ -0,0 +1 @@
+update event_map set event_up_name = 'HOST_INTERFACE_HIGH_NETWORK_USE' where 
event_up_name='VDS_HIGH_NETWORK_USE';


-- 
To view, visit http://gerrit.ovirt.org/26239
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I22b3510398ac6fa3acf93fcb596dd6ea10b26366
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Alona Kaplan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to