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
6 files changed, 29 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/09/25609/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 6827867..6f54456 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
@@ -35,8 +35,6 @@
             AuditLogTimeInterval.MINUTE.getValue() * 30),
     VDS_HIGH_MEM_USE(532, AuditLogSeverity.WARNING,
             AuditLogTimeInterval.MINUTE.getValue() * 30),
-    VDS_HIGH_NETWORK_USE(533, AuditLogSeverity.WARNING,
-            AuditLogTimeInterval.MINUTE.getValue() * 30),
     VDS_HIGH_CPU_USE(534, AuditLogSeverity.WARNING,
             AuditLogTimeInterval.MINUTE.getValue() * 30),
     VDS_HIGH_SWAP_USE(535, AuditLogSeverity.WARNING,
@@ -108,6 +106,11 @@
     HOST_REFRESHED_CAPABILITIES(606),
     HOST_REFRESH_CAPABILITIES_FAILED(607, AuditLogSeverity.ERROR),
 
+    RECEIVE_RATE(608),
+    TRANSMIT_RATE(609),
+    VDS_INTERFACE_HIGH_NETWORK_USE(610, AuditLogSeverity.WARNING,
+            AuditLogTimeInterval.MINUTE.getValue() * 30),
+
     // Disk alignment audit logs
     DISK_ALIGNMENT_SCAN_START(700),
     DISK_ALIGNMENT_SCAN_FAILURE(701, AuditLogSeverity.WARNING),
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..4caa639 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.VDS_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 8821f09..c9174a3 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -609,7 +609,9 @@
 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}%].
+RECEIVE_RATE=receive
+TRANSMIT_RATE=transmit
+VDS_INTERFACE_HIGH_NETWORK_USE=Host ${HostName} has network interface 
${InterfaceName} with ${RateType} rate [${UsedNetwork}%] which exceeded defined 
threshold [${Threshold}%].
 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 010c11b..77efe89 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
@@ -299,15 +299,28 @@
      * @param stat
      */
     private void checkVdsNetworkThreshold(VdsStatistics stat) {
+        for (VdsNetworkInterface iface : _vds.getInterfaces()) {
+            checkNetwrokInterfaceThreshold(iface,
+                    iface.getStatistics().getReceiveRate(),
+                    AuditLogType.RECEIVE_RATE);
+            checkNetwrokInterfaceThreshold(iface,
+                    iface.getStatistics().getTransmitRate(),
+                    AuditLogType.TRANSMIT_RATE);
+        }
+    }
 
+    private void checkNetwrokInterfaceThreshold(VdsNetworkInterface iface, 
Double rate,
+            AuditLogType rateType) {
         Integer maxUsedPercentageThreshold = 
Config.getValue(ConfigValues.LogMaxNetworkUsedThresholdInPercentage);
-        if (stat.getusage_network_percent() != null
-                && stat.getusage_network_percent() > 
maxUsedPercentageThreshold) {
-            AuditLogableBase logable = new AuditLogableBase(stat.getId());
+        if (rate != null && rate.intValue() > maxUsedPercentageThreshold) {
+            AuditLogableBase logable = new AuditLogableBase(_vds.getId());
+            logable.setCustomId(iface.getName().toString() + 
rateType.toString());
+            logable.addCustomValue("InterfaceName", iface.getName());
             logable.addCustomValue("HostName", _vds.getName());
-            logable.addCustomValue("UsedNetwork", 
stat.getusage_network_percent().toString());
+            logable.addCustomValue("RateType", 
AuditLogDirector.getMessage(rateType));
+            logable.addCustomValue("UsedNetwork", 
String.valueOf(rate.intValue()));
             logable.addCustomValue("Threshold", 
maxUsedPercentageThreshold.toString());
-            auditLog(logable, AuditLogType.VDS_HIGH_NETWORK_USE);
+            auditLog(logable, AuditLogType.VDS_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 24ecbbb..78caf5d 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
@@ -796,7 +796,7 @@
 
     String AuditLogType___VDS_HIGH_MEM_USE();
 
-    String AuditLogType___VDS_HIGH_NETWORK_USE();
+    String AuditLogType___VDS_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 53330be..3859233 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
@@ -396,7 +396,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___VDS_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


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

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

Reply via email to