Package org.apache.helix.alerts

Examples of org.apache.helix.alerts.AlertValueAndStatus


    for(int i = 0; i < nAlerts1; i++)
    {
      String alertName = "esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
      alertResultMap1.put(alertName, valueAndStatus);
    }
   
    for(int i = 0; i < nAlerts2; i++)
    {
      String alertName = "esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
      alertResultMap1.put(alertName, valueAndStatus);
    }
   
    beanCollection.setAlerts(originAlert1, alertResultMap1, clusterName);
    beanCollection.setAlerts(originAlert2, alertResultMap2, clusterName);
   
    beanCollection.refreshAlertDelta(clusterName);
    String summaryKey = ClusterAlertMBeanCollection.ALERT_SUMMARY + "_" + clusterName;
    jmxMBeanObserver.refresh();
   
    // Get the history list
    String beanName = "HelixAlerts:alert=" + summaryKey;
    Map<String, Object> beanValueMap = jmxMBeanObserver._beanValueMap.get(beanName);
    String history1 = (String) (beanValueMap.get("AlertFiredHistory"));
   
    StringReader sr = new StringReader(history1);
    ObjectMapper mapper = new ObjectMapper();

    // check the history
  
    Map<String, String> delta = beanCollection.getRecentAlertDelta();
    Assert.assertEquals(delta.size(), nAlerts1 + nAlerts2);
    for(int i = 0; i < nAlerts1; i++)
    {
      String alertBeanName = "(esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MinServerLatency)GREATER(10)";
      Assert.assertTrue(delta.get(alertBeanName).equals("ON"));
    }
   
    for(int i = 0; i < nAlerts2; i++)
    {
      String alertBeanName = "(esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MaxServerLatency)GREATER(10)";
      Assert.assertTrue(delta.get(alertBeanName).equals("ON"));
    }
   
    alertResultMap1 = new HashMap<String, AlertValueAndStatus>();
    for(int i = 0; i < 3; i++)
    {
      String alertName = "esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
      alertResultMap1.put(alertName, valueAndStatus);
    }
   
    for(int i = 3; i < 5; i++)
    {
      String alertName = "esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , false);
      alertResultMap1.put(alertName, valueAndStatus);
    }
   
    for(int i = 7; i < 9; i++)
    {
      String alertName = "esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
      alertResultMap1.put(alertName, valueAndStatus);
    }
   
    for(int i = 0; i < 2; i++)
    {
      String alertName = "esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , false);
      alertResultMap1.put(alertName, valueAndStatus);
    }
   
    for(int i = 2; i < 3; i++)
    {
      String alertName = "esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
      alertResultMap1.put(alertName, valueAndStatus);
    }
    for(int i = 7; i < 9; i++)
    {
      String alertName = "esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
      alertResultMap1.put(alertName, valueAndStatus);
    }
   
    beanCollection.setAlerts(originAlert1, alertResultMap1, clusterName);
    beanCollection.refreshAlertDelta(clusterName);
View Full Code Here


    for(int i = 0; i < nAlerts1; i++)
    {
      String alertName = "esv4-app7" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
      alertResultMap1.put(alertName, valueAndStatus);
    }
   
    for(int i = 0; i < nAlerts2; i++)
    {
      String alertName = "esv4-app9" + i + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value , true);
      alertResultMap2.put(alertName, valueAndStatus);
    }
   
    beanCollection.setAlerts(originAlert1, alertResultMap1, clusterName);
    beanCollection.setAlerts(originAlert2, alertResultMap2, clusterName);
View Full Code Here

        }
      }
    }
    Tuple<String> t = new Tuple<String>();
    t.add("0");
    AlertValueAndStatus summaryStatus = new AlertValueAndStatus(t, fired);
    if(!_alertBeans.containsKey(summaryKey))
    {
      ClusterAlertSummary item = new ClusterAlertSummary(summaryKey, summaryStatus);
      onNewAlertMbeanAdded(item);
      item.setAdditionalInfo(alertsFired);
View Full Code Here

        }
      }
    }
    Tuple<String> t = new Tuple<String>();
    t.add("0");
    AlertValueAndStatus summaryStatus = new AlertValueAndStatus(t, fired);
    if (!_alertBeans.containsKey(summaryKey)) {
      ClusterAlertSummary item = new ClusterAlertSummary(summaryKey, summaryStatus);
      onNewAlertMbeanAdded(item);
      item.setAdditionalInfo(alertsFired);
      _alertBeans.put(summaryKey, item);
View Full Code Here

      String alertName =
          "esv4-app7" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    for (int i = 0; i < nAlerts2; i++) {
      String alertName =
          "esv4-app9" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    beanCollection.setAlerts(originAlert1, alertResultMap1, clusterName);
    beanCollection.setAlerts(originAlert2, alertResultMap2, clusterName);

    beanCollection.refreshAlertDelta(clusterName);
    String summaryKey = ClusterAlertMBeanCollection.ALERT_SUMMARY + "_" + clusterName;
    jmxMBeanObserver.refresh();

    // Get the history list
    String beanName = "HelixAlerts:alert=" + summaryKey;
    Map<String, Object> beanValueMap = jmxMBeanObserver._beanValueMap.get(beanName);
    String history1 = (String) (beanValueMap.get("AlertFiredHistory"));

    StringReader sr = new StringReader(history1);
    ObjectMapper mapper = new ObjectMapper();

    // check the history

    Map<String, String> delta = beanCollection.getRecentAlertDelta();
    Assert.assertEquals(delta.size(), nAlerts1 + nAlerts2);
    for (int i = 0; i < nAlerts1; i++) {
      String alertBeanName =
          "(esv4-app7"
              + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MinServerLatency)GREATER(10)";
      Assert.assertTrue(delta.get(alertBeanName).equals("ON"));
    }

    for (int i = 0; i < nAlerts2; i++) {
      String alertBeanName =
          "(esv4-app9"
              + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MaxServerLatency)GREATER(10)";
      Assert.assertTrue(delta.get(alertBeanName).equals("ON"));
    }

    alertResultMap1 = new HashMap<String, AlertValueAndStatus>();
    for (int i = 0; i < 3; i++) {
      String alertName =
          "esv4-app7" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    for (int i = 3; i < 5; i++) {
      String alertName =
          "esv4-app7" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, false);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    for (int i = 7; i < 9; i++) {
      String alertName =
          "esv4-app7" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    for (int i = 0; i < 2; i++) {
      String alertName =
          "esv4-app9" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, false);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    for (int i = 2; i < 3; i++) {
      String alertName =
          "esv4-app9" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }
    for (int i = 7; i < 9; i++) {
      String alertName =
          "esv4-app9" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    beanCollection.setAlerts(originAlert1, alertResultMap1, clusterName);
    beanCollection.refreshAlertDelta(clusterName);
View Full Code Here

      String alertName =
          "esv4-app7" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    for (int i = 0; i < nAlerts2; i++) {
      String alertName =
          "esv4-app9" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap2.put(alertName, valueAndStatus);
    }

    beanCollection.setAlerts(originAlert1, alertResultMap1, clusterName);
    beanCollection.setAlerts(originAlert2, alertResultMap2, clusterName);
View Full Code Here

      String alertName =
          "esv4-app7" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    for (int i = 0; i < nAlerts2; i++) {
      String alertName =
          "esv4-app9" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    beanCollection.setAlerts(originAlert1, alertResultMap1, clusterName);
    beanCollection.setAlerts(originAlert2, alertResultMap2, clusterName);

    beanCollection.refreshAlertDelta(clusterName);
    String summaryKey = ClusterAlertMBeanCollection.ALERT_SUMMARY + "_" + clusterName;
    jmxMBeanObserver.refresh();

    // Get the history list
    String beanName = "HelixAlerts:alert=" + summaryKey;
    Map<String, Object> beanValueMap = jmxMBeanObserver._beanValueMap.get(beanName);
    String history1 = (String) (beanValueMap.get("AlertFiredHistory"));

    StringReader sr = new StringReader(history1);
    ObjectMapper mapper = new ObjectMapper();

    // check the history

    Map<String, String> delta = beanCollection.getRecentAlertDelta();
    Assert.assertEquals(delta.size(), nAlerts1 + nAlerts2);
    for (int i = 0; i < nAlerts1; i++) {
      String alertBeanName =
          "(esv4-app7"
              + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MinServerLatency)GREATER(10)";
      Assert.assertTrue(delta.get(alertBeanName).equals("ON"));
    }

    for (int i = 0; i < nAlerts2; i++) {
      String alertBeanName =
          "(esv4-app9"
              + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName#BizProfile.MaxServerLatency)GREATER(10)";
      Assert.assertTrue(delta.get(alertBeanName).equals("ON"));
    }

    alertResultMap1 = new HashMap<String, AlertValueAndStatus>();
    for (int i = 0; i < 3; i++) {
      String alertName =
          "esv4-app7" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    for (int i = 3; i < 5; i++) {
      String alertName =
          "esv4-app7" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, false);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    for (int i = 7; i < 9; i++) {
      String alertName =
          "esv4-app7" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    for (int i = 0; i < 2; i++) {
      String alertName =
          "esv4-app9" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, false);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    for (int i = 2; i < 3; i++) {
      String alertName =
          "esv4-app9" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }
    for (int i = 7; i < 9; i++) {
      String alertName =
          "esv4-app9" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    beanCollection.setAlerts(originAlert1, alertResultMap1, clusterName);
    beanCollection.refreshAlertDelta(clusterName);
View Full Code Here

      String alertName =
          "esv4-app7" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MinServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap1.put(alertName, valueAndStatus);
    }

    for (int i = 0; i < nAlerts2; i++) {
      String alertName =
          "esv4-app9" + i
              + ".stg.linkedin.com_12918.RestQueryStats@DBName=BizProfile.MaxServerLatency";
      Tuple<String> value = new Tuple<String>();
      value.add("22" + i);
      AlertValueAndStatus valueAndStatus = new AlertValueAndStatus(value, true);
      alertResultMap2.put(alertName, valueAndStatus);
    }

    beanCollection.setAlerts(originAlert1, alertResultMap1, clusterName);
    beanCollection.setAlerts(originAlert2, alertResultMap2, clusterName);
View Full Code Here

TOP

Related Classes of org.apache.helix.alerts.AlertValueAndStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.