Number of polls can be set for "diff" type thresholds
authorVictor Kirhenshtein <victor@netxms.org>
Wed, 28 Sep 2016 06:42:18 +0000 (09:42 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Wed, 28 Sep 2016 06:42:18 +0000 (09:42 +0300)
ChangeLog
src/java/netxms-eclipse/DataCollection/src/org/netxms/ui/eclipse/datacollection/ThresholdLabelProvider.java
src/java/netxms-eclipse/DataCollection/src/org/netxms/ui/eclipse/datacollection/views/helpers/DciLabelProvider.java
src/server/core/dcithreshold.cpp
webui/webapp/DataCollection/src/org/netxms/ui/eclipse/datacollection/ThresholdLabelProvider.java
webui/webapp/DataCollection/src/org/netxms/ui/eclipse/datacollection/views/helpers/DciLabelProvider.java

index 293e673..579053f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,7 @@
 - Agent environment variables can be set in configuration file
 - Added method "getResourceOwner" and attribute "nodes" to NXSL "Cluster" class
 - New object tool type "server script"
+- Number of polls can be set for "diff" type thresholds 
 - New agent metrics for self-monitoring:
        Agent.SyslogProxy.IsEnabled, Agent.SyslogProxy.ReceivedMessages, Agent.SyslogProxy.QueueSize
 - Management console
index 6a9f08a..6cbc244 100644 (file)
@@ -35,7 +35,7 @@ import org.netxms.ui.eclipse.shared.ConsoleSharedData;
  */
 public class ThresholdLabelProvider extends LabelProvider implements ITableLabelProvider
 {
-       public static final String[] FUNCTIONS = { "last(", "average(", "deviation(", "diff()", "error(", "sum(", "script(" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+       public static final String[] FUNCTIONS = { "last(", "average(", "deviation(", "diff(", "error(", "sum(", "script(" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
        public static final String[] OPERATIONS = { "<", "<=", "==", ">=", ">", "!=", "like", "!like" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
        
        private WorkbenchLabelProvider eventLabelProvider = new WorkbenchLabelProvider();
@@ -70,15 +70,8 @@ public class ThresholdLabelProvider extends LabelProvider implements ITableLabel
                        case Thresholds.COLUMN_OPERATION:
                                int f = ((Threshold)element).getFunction();
                                StringBuilder text = new StringBuilder(FUNCTIONS[f]);
-                               if (f != Threshold.F_DIFF)
-                               {
-                                       text.append(((Threshold)element).getSampleCount());
-                                       text.append(") "); //$NON-NLS-1$
-                               }
-                               else
-                               {
-                                       text.append(' ');
-                               }
+                               text.append(((Threshold)element).getSampleCount());
+                               text.append(") "); //$NON-NLS-1$
                                if (f != Threshold.F_SCRIPT)
                                {
                                text.append(OPERATIONS[((Threshold)element).getOperation()]);
index e95519e..879a9be 100644 (file)
@@ -142,15 +142,8 @@ public class DciLabelProvider implements ITableLabelProvider
                   Threshold tr = list.get(i);
                   int f = tr.getFunction();
                   StringBuilder text = new StringBuilder(ThresholdLabelProvider.FUNCTIONS[f]);
-                  if (f != Threshold.F_DIFF)
-                  {
-                     text.append(tr.getSampleCount());
-                     text.append(") "); //$NON-NLS-1$
-                  }
-                  else
-                  {
-                     text.append(' ');
-                  }
+                  text.append(tr.getSampleCount());
+                  text.append(") "); //$NON-NLS-1$
                   if (f != Threshold.F_SCRIPT)
                   {
                      text.append(ThresholdLabelProvider.OPERATIONS[tr.getOperation()]);
@@ -158,7 +151,7 @@ public class DciLabelProvider implements ITableLabelProvider
                      text.append(tr.getValue());
                   }
                   thresholds.append(text);
-                  if( i+1 != list.size() )
+                  if (i < list.size() - 1)
                      thresholds.append(", "); //$NON-NLS-1$
                }
                           
index 39a8667..0ce0d01 100644 (file)
@@ -479,7 +479,7 @@ ThresholdCheckResult Threshold::check(ItemValue &value, ItemValue **ppPrevValues
    }
 
        // Check for number of consecutive matches
-       if ((m_function == F_LAST) || (m_function == F_SCRIPT))
+       if ((m_function == F_LAST) || (m_function == F_DIFF) || (m_function == F_SCRIPT))
        {
                if (bMatch)
                {
index 6a9f08a..6cbc244 100644 (file)
@@ -35,7 +35,7 @@ import org.netxms.ui.eclipse.shared.ConsoleSharedData;
  */
 public class ThresholdLabelProvider extends LabelProvider implements ITableLabelProvider
 {
-       public static final String[] FUNCTIONS = { "last(", "average(", "deviation(", "diff()", "error(", "sum(", "script(" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+       public static final String[] FUNCTIONS = { "last(", "average(", "deviation(", "diff(", "error(", "sum(", "script(" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
        public static final String[] OPERATIONS = { "<", "<=", "==", ">=", ">", "!=", "like", "!like" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
        
        private WorkbenchLabelProvider eventLabelProvider = new WorkbenchLabelProvider();
@@ -70,15 +70,8 @@ public class ThresholdLabelProvider extends LabelProvider implements ITableLabel
                        case Thresholds.COLUMN_OPERATION:
                                int f = ((Threshold)element).getFunction();
                                StringBuilder text = new StringBuilder(FUNCTIONS[f]);
-                               if (f != Threshold.F_DIFF)
-                               {
-                                       text.append(((Threshold)element).getSampleCount());
-                                       text.append(") "); //$NON-NLS-1$
-                               }
-                               else
-                               {
-                                       text.append(' ');
-                               }
+                               text.append(((Threshold)element).getSampleCount());
+                               text.append(") "); //$NON-NLS-1$
                                if (f != Threshold.F_SCRIPT)
                                {
                                text.append(OPERATIONS[((Threshold)element).getOperation()]);
index e95519e..879a9be 100644 (file)
@@ -142,15 +142,8 @@ public class DciLabelProvider implements ITableLabelProvider
                   Threshold tr = list.get(i);
                   int f = tr.getFunction();
                   StringBuilder text = new StringBuilder(ThresholdLabelProvider.FUNCTIONS[f]);
-                  if (f != Threshold.F_DIFF)
-                  {
-                     text.append(tr.getSampleCount());
-                     text.append(") "); //$NON-NLS-1$
-                  }
-                  else
-                  {
-                     text.append(' ');
-                  }
+                  text.append(tr.getSampleCount());
+                  text.append(") "); //$NON-NLS-1$
                   if (f != Threshold.F_SCRIPT)
                   {
                      text.append(ThresholdLabelProvider.OPERATIONS[tr.getOperation()]);
@@ -158,7 +151,7 @@ public class DciLabelProvider implements ITableLabelProvider
                      text.append(tr.getValue());
                   }
                   thresholds.append(text);
-                  if( i+1 != list.size() )
+                  if (i < list.size() - 1)
                      thresholds.append(", "); //$NON-NLS-1$
                }