# Metric Ingestion - Query

**URL:** <https://community.dynatrace.com/t/metric-ingestion-query/41508>\
**Category:** Dynatrace Managed\
**Tags:** dynatrace-managed\
**Created:** [September 5, 2023, 3:10am UTC](https://community.dynatrace.com/t/metric-ingestion-query/41508 "2023-09-05T03:10:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hasan](https://avatars.discourse-cdn.com/v4/letter/h/df705f/32.png) [@Hasan](https://community.dynatrace.com/u/Hasan)\
**Post date:** [September 5, 2023, 3:10am UTC](https://community.dynatrace.com/t/metric-ingestion-query/41508/1 "2023-09-05T03:10:56Z")

</div>

Hi There,

Using metric ingest we have created a metric which is configured for 2 servers (1 live server and 1 is fallback server ), the client wants alert to be generated only when both the nodes are not fulfilling the requests, refer screen below for a sample metric created, kindly advise how we can fulfil this.  
Please note\*\*:\*\* with the current configured metric we are getting alerts for both the nodes as separate alert.

 ![Metrics Ingestion.png](https://global.discourse-cdn.com/dynatrace/original/2X/1/11de032689a7256a30827207cf307d4e8a629ada.png)

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [September 6, 2023, 11:35am UTC](https://community.dynatrace.com/t/metric-ingestion-query/41508/2 "2023-09-06T11:35:04Z")

</div>

Hi&nbsp;[@Hasan](https://community.dynatrace.com/user/46403)&nbsp;,

I am assuming both nodes are will send the same metric key.

When both of them fail no metric data points will be sent into Dynatrace so data will be missing

→ “alertOnNoData”: true,

Using a metric event like following would alert you if the metric is completely missing, i.e. primary and secondary both have failed.

```markup
[{
    "schemaId": "builtin:anomaly-detection.metric-events",
    "schemaVersion": "1.0.15",
    "scope": "environment",
    "value": {
      "enabled": true,
      "summary": "Important Metric is missing",
      "queryDefinition": {
        "type": "METRIC_SELECTOR",
        "metricSelector": "very.important.metric.that.has.to.be.there",
        "managementZone": null,
        "queryOffset": null
      },
      "modelProperties": {
        "type": "STATIC_THRESHOLD",
        "threshold": -1,
        "alertOnNoData": true,
        "alertCondition": "BELOW",
        "violatingSamples": 3,
        "samples": 5,
        "dealertingSamples": 5
      },
      "eventTemplate": {
        "title": "Very important metric is missing",
        "description": "The {metricname} value was {alert_condition} normal behavior.",
        "eventType": "AVAILABILITY",
        "davisMerge": true,
        "metadata": []
      },
      "eventEntityDimensionKey": null,
      "legacyId": null
    }
  }
]

```

---

<div class="post-metadata">

**Author:** ![Hasan](https://avatars.discourse-cdn.com/v4/letter/h/df705f/32.png) [@Hasan](https://community.dynatrace.com/u/Hasan)\
**Post date:** [September 7, 2023, 5:43am UTC](https://community.dynatrace.com/t/metric-ingestion-query/41508/3 "2023-09-07T05:43:51Z")

</div>

Hi Mark,  
Both nodes are sending separate metric key sharing the same below along with screenshots.  
Metric in Live server

icardonline.prod.host119.FALCON.55382

Metric in Fallback server

icardonline.prodfb.host118.FALCON.55382

 ![Fallback_Host118 _Falcon.png](https://global.discourse-cdn.com/dynatrace/original/2X/7/7a21ea1f7238fdaa693a688afcd2ea12b36ec04a.png)  
 ![Live_Host119 _Falcon.png](https://global.discourse-cdn.com/dynatrace/original/2X/7/75708aa77732f22a574a2a0fdf687e7ecd9200ef.png)

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [September 11, 2023, 10:05am UTC](https://community.dynatrace.com/t/metric-ingestion-query/41508/4 "2023-09-11T10:05:37Z")

</div>

Hi&nbsp;[@Hasan](https://community.dynatrace.com/user/46403)

I cannot recommend using dimensions in the metric key, that is what metric dimensions are for.

> **[Metric ingestion protocol](https://docs.dynatrace.com/docs/ingest-from/extend-dynatrace/extend-metrics/reference/metric-ingestion-protocol)**
>
> Learn how the data ingestion protocol for Dynatrace Metrics API works.

You would send a metric line like this and both hosts would send this with different dimension values e.g.:

```markup
icardonline,stage=prodfb,host=host118.FALCON.5538 <metric data>
icardonline,stage=prod,host=host119.FALCON.55382 <metric data>

```

If you do not want or cannot use above’s format, you still could use a metric query in the metric event adding up both metrics and alerting if data is missing, but again this is not recommended.

BR,

Mark
