コード例 #1
0
    def parse_alert_metrics(self, alert_json):
        """{

          EvalData: {
            evalMatches:[{
              metric: "tendrl.clusters.ab3b125e-4769-4071-
                      a349-e82b380c11f4.nodes.{host_name}.
                      bricks.|root|gluster_bricks
                      |vol1_b2.utilization.percent-percent_bytes",
              tags: null,
              value: 15.614466017499998
            }]
          },
          Settings: {
            conditions: - [{
              evaluator: - {
                params: - [15],
                type: "gt"
              },
              query : {
                model : {
                  target: "tendrl.clusters.ab3b125e-4769-
                          4071-a349-e82b380c11f4.nodes.dhcp42-208_lab_eng_blr_
                          redhat_com.bricks.|root|
                          gluster_bricks|vol1_b2.utilization.percent-
                          percent_bytes"
                }
              }
            }]
          }
        }
        """

        alert = {}
        alert['tags'] = {}
        alert['current_value'] = utils.find_current_value(
            alert_json['EvalData'])
        target = utils.find_alert_target(alert_json['Settings']['conditions'])
        # For alert backward compatibility
        alert['tags']['plugin_instance'] = target.replace(
            grafana_constants.BRICK_PATH_SEPARATOR, "|")
        alert['tags']['warning_max'] = utils.find_warning_max(
            alert_json['Settings']['conditions'][0]['evaluator']['params'])
        result = utils.parse_target(target, self.template)
        alert['tags']['integration_id'] = result["integration_id"]
        cluster_name = utils.find_cluster_short_name(result["integration_id"])
        alert['tags']['cluster_short_name'] = cluster_name
        alert["tags"]["fqdn"] = result["host_name"].replace("_", ".")
        alert['tags']['brick_path'] = result["brick_path"]
        return alert
コード例 #2
0
    def parse_alert_metrics(self, alert_json):
        """{

         "EvalData": {
             "evalMatches": [{
                 "metric": "sumSeries(sumSeries(tendrl.clusters.ab3b125e-4769
                           -4071-a349-e82b380c11f4.nodes.{host_name}.
                           cpu.percent-system),sumSeries(tendrl.clusters.ab3b125e-4769-4071
                           -a349-e82b380c11f4.nodes.{host_name}.cpu.
                           percent-user))",
                 "tags": null,
                 "value": 31.97861830493573
              }]},
         "Settings": {
             "conditions": [{
                "evaluator": {
                   "params": [29],
                   "type": "gt"},
                query": {
                  "model": {
                    "target"    : "sumSeries(#A, #B).select metric",
                    "targetFull": "sumSeries(sumSeries(tendrl.clusters.
                                   ab3b125e-4769-4071-a349-e82b380c11f4.nodes.
                                   {host_name}.cpu.percent-system),
                                   sumSeries(tendrl.clusters.ab3b125e-4769-4071-a349-e82b
                                   380c11f4.nodes.{host_name}.cpu.
                                   percent-user)).select metric"
                   }
                }
             }]
         }
        }
        """

        alert = {}
        alert['tags'] = {}
        alert['current_value'] = utils.find_current_value(
            alert_json['EvalData'])
        target = utils.find_alert_target(alert_json['Settings']['conditions'])
        alert['tags']['warning_max'] = utils.find_warning_max(
            alert_json['Settings']['conditions'][0]['evaluator']['params'])
        # identifying integration_id and node_id from target
        # Cpu target is an aggregation, So spliting and giving [0]
        # Because both have same cluster and node ids
        result = utils.parse_target(target, self.template)
        alert['tags']['integration_id'] = result["integration_id"]
        cluster_name = utils.find_cluster_short_name(result["integration_id"])
        alert['tags']['cluster_short_name'] = cluster_name
        alert["tags"]["fqdn"] = result["host_name"].replace("_", ".")
        return alert
コード例 #3
0
    def parse_alert_metrics(self, alert_json):
        """{

          EvalData: {
            evalMatches: - [{
              metric: "tendrl.clusters.ab3b125e-
                      4769-4071-a349-e82b380c11f4.volumes.vol1.
                      nodes.*.bricks.*.utilization.percent-percent_bytes",
              tags: null,
              value: 13407092736
            }]
          },
          Settings: {
            conditions: - [{
              evaluator: - {
                params: - [12138888889],
                type: "gt"
              },
              query: - {
                model: - {
                  target: "tendrl.clusters.ab3b125e-
                          4769-4071-a349-e82b380c11f4.volumes.vol1.
                          nodes.*.bricks.*.utilization.percent-percent_bytes"
                },
              }
            }]
          }
        }
        """

        alert = {}
        alert['tags'] = {}
        alert['current_value'] = utils.find_current_value(
            alert_json['EvalData'])
        target = utils.find_alert_target(
            alert_json['Settings']['conditions'])
        alert['tags']['plugin_instance'] = target
        alert['tags']['warning_max'] = utils.find_warning_max(
            alert_json['Settings']['conditions'][0]['evaluator']['params'])
        result = utils.parse_target(target, self.template)
        alert['tags']['integration_id'] = result["integration_id"]
        cluster_name = utils.find_cluster_short_name(
            result["integration_id"]
        )
        alert['tags']['cluster_short_name'] = cluster_name
        alert['tags']['volume_name'] = result["volume_name"]
        return alert
コード例 #4
0
    def parse_alert_metrics(self, alert_json):
        """{

          "EvalData": {
            "evalMatches": [{
              "metric": "tendrl.clusters.ab3b125e-4769-4071-a349-
                        e82b380c11f4.nodes.{host_name}
                        .memory.percent-used",
              "tags": null,
              "value": 4096
            }]
          },
          "Settings": {
            "conditions": [{
              "evaluator": {
                "params": [3664],
                "type": "gt"
              },
            "query": {
              "model": {
                "target": "tendrl.clusters.ab3b125e-4769-4071-
                          a349-e82b380c11f4.nodes.{host_name}
                          .memory.percent-used"
              },
            }
          }
        }
        """

        alert = {}
        alert['tags'] = {}
        alert['current_value'] = utils.find_current_value(
            alert_json['EvalData'])
        target = utils.find_alert_target(alert_json['Settings']['conditions'])
        alert['tags']['warning_max'] = utils.find_warning_max(
            alert_json['Settings']['conditions'][0]['evaluator']['params'])
        # identifying integration_id and node_id from target
        result = utils.parse_target(target, self.template)
        alert['tags']['integration_id'] = result["integration_id"]
        cluster_name = utils.find_cluster_short_name(result["integration_id"])
        alert['tags']['cluster_short_name'] = cluster_name
        alert["tags"]["fqdn"] = result["host_name"].replace("_", ".")
        return alert
コード例 #5
0
 def parse_alert_metrics(self, alert_json):
     """
         {
           "EvalData": {
             "evalMatches": [{
               "metric": "tendrl.clusters.ab3b125e-4769-4071-a349-e82b38.
                   volumes.*.nodes.*.bricks.*.utilization.percent-percent_bytes",
               "tags": null,
               "value": 16.020626197595
             }]
           },
           Settings: - {
             conditions: - [{
               evaluator: {
                 params: [29],
                 type: "gt"
               }
               query: {
                 model: - {
                   target: "tendrl.clusters.ab3b125e-4769-4071-a349-e82b38.
                       volumes.*.nodes.*.bricks.*.utilization.percent-percent_bytes"
                 },
               }
           },
         }
     """
     alert = {}
     alert['tags'] = {}
     alert['current_value'] = utils.find_current_value(
         alert_json['EvalData'])
     target = utils.find_alert_target(alert_json['Settings']['conditions'])
     alert['tags']['warning_max'] = utils.find_warning_max(
         alert_json['Settings']['conditions'][0]['evaluator']['params'])
     result = utils.parse_target(target, self.template)
     alert['tags']['integration_id'] = result["cluster_id"]
     return alert