From 0cb93e20ccc571e1b870443cb0d27c5f5b514a03 Mon Sep 17 00:00:00 2001
From: Jason Rothacker <jason.rothacker@gsa.gov>
Date: Thu, 16 Jan 2025 07:50:17 -0800
Subject: [PATCH] Creating a dashboard that displays details at the endpoint
 level.

---
 .../modules/newrelic/endpoints.json.tftpl     | 387 +++++++++++++
 .../newrelic/high_level_page.json.tftpl       | 541 ++++++++++++++++++
 .../shared/modules/newrelic/monitoring.tf     |  40 ++
 .../newrelic/monitoring_dashboard.json.tftpl  |  11 +
 .../shared/modules/newrelic/variables.tf      |   2 +-
 5 files changed, 980 insertions(+), 1 deletion(-)
 create mode 100644 terraform/shared/modules/newrelic/endpoints.json.tftpl
 create mode 100644 terraform/shared/modules/newrelic/high_level_page.json.tftpl
 create mode 100644 terraform/shared/modules/newrelic/monitoring.tf
 create mode 100644 terraform/shared/modules/newrelic/monitoring_dashboard.json.tftpl

diff --git a/terraform/shared/modules/newrelic/endpoints.json.tftpl b/terraform/shared/modules/newrelic/endpoints.json.tftpl
new file mode 100644
index 0000000000..cb79e00ff0
--- /dev/null
+++ b/terraform/shared/modules/newrelic/endpoints.json.tftpl
@@ -0,0 +1,387 @@
+{
+  "name": "Endpoint Details",
+  "description": null,
+  "widgets": [
+    %{~ for index, endpoint in endpoint_config  ~}
+        %{if index!=0},%{ endif }
+        {
+          "title": "",
+          "layout": {
+            "column": 1,
+            "row": ${(index * 10) + 1 },
+            "width": 10,
+            "height": 1
+          },
+          "linkedEntityGuids": null,
+          "visualization": {
+            "id": "viz.markdown"
+          },
+          "rawConfiguration": {
+            "text": "# ${endpoint.name}"
+          }
+        },
+        {
+          "title": "Transactions (last hour)",
+          "layout": {
+            "column": 1,
+            "row": ${(index * 10) + 2 },
+            "width": 2,
+            "height": 3
+          },
+          "linkedEntityGuids": null,
+          "visualization": {
+            "id": "viz.billboard"
+          },
+          "rawConfiguration": {
+            "nrqlQueries": [
+              {
+                "accountIds": [
+                  ${new_relic_account_id}
+                ],
+                "query": "FROM Transaction SELECT count(*) AS 'Transactions (last hour)' WHERE (appName = 'gsa-fac-${env}') AND (request.uri LIKE '${endpoint.uri}%') SINCE 1 hour ago"
+              }
+            ]
+          }
+        },
+        {
+          "title": "Transactions Target: ${endpoint.transactions_sla.critical} (per hour/past week)",
+          "description": "Average number of transactions per hour over the past week",
+          "layout": {
+            "column": 3,
+            "row": ${(index * 10) + 2 },
+            "width": 2,
+            "height": 3
+          },
+          "linkedEntityGuids": null,
+          "visualization": {
+            "id": "viz.billboard"
+          },
+          "rawConfiguration": {
+            "dataFormatters": [
+              {
+                "name": "Transactions Per Hour",
+                "precision": "0",
+                "type": "decimal"
+              }
+            ],
+            "linkedEntityGuids": [],
+            "nrqlQueries": [
+              {
+                "accountIds": [
+                  ${new_relic_account_id}
+                ],
+                "query": "FROM Transaction SELECT rate(count(*), 1 hour) AS 'Transactions (per hour)' WHERE appName ='gsa-fac-${env}' AND request.uri LIKE '${endpoint.uri}%' SINCE 7 days ago"
+              }
+            ],
+            "thresholds": [
+              {
+                "alertSeverity": "WARNING",
+                "value": ${endpoint.transactions_sla.warning}
+              },
+              {
+                "alertSeverity": "CRITICAL",
+                "value": ${endpoint.transactions_sla.critical}
+              }
+            ],
+            "vizcoConfiguration": {
+              "billboard": {
+                "thresholds": [
+                  {
+                    "limit": ${endpoint.transactions_sla.warning},
+                    "type": "warning"
+                  },
+                  {
+                    "limit": ${endpoint.transactions_sla.critical},
+                    "type": "critical"
+                  }
+                ]
+              },
+              "dataFormatters": [
+                {
+                  "name": "Transactions Per Hour",
+                  "precision": "0",
+                  "type": "decimal"
+                }
+              ]
+            }
+          }
+        },
+        {
+          "title": "Transactions",
+          "layout": {
+            "column": 5,
+            "row": ${(index * 10) + 2 },
+            "width": 6,
+            "height": 3
+          },
+          "linkedEntityGuids": null,
+          "visualization": {
+            "id": "viz.line"
+          },
+          "rawConfiguration": {
+            "nrqlQueries": [
+              {
+                "accountId": ${new_relic_account_id},
+                "query": "FROM Transaction SELECT count(*) AS 'Transactions' WHERE appName = 'gsa-fac-${env}' and request.uri LIKE '${endpoint.uri}%' SINCE 14 days ago TIMESERIES"
+              }
+            ]
+          }
+        },
+        {
+          "title": "Errors (last hour)",
+          "layout": {
+            "column": 1,
+            "row": ${(index * 10) + 5 },
+            "width": 2,
+            "height": 3
+          },
+          "linkedEntityGuids": null,
+          "visualization": {
+            "id": "viz.billboard"
+          },
+          "rawConfiguration": {
+            "nrqlQueries": [
+              {
+                "accountIds": [
+                  ${new_relic_account_id}
+                ],
+                "query": "FROM TransactionError SELECT count(*) AS 'Errors (last hour)' WHERE (appName = 'gsa-fac-${env}') AND (request.uri LIKE '${endpoint.uri}%') SINCE 1 hour ago"
+              }
+            ]
+          }
+        },
+        {
+          "title": "Success Rate Target: Above ${endpoint.success_rate_sla.critical * 100}%",
+          "layout": {
+            "column": 3,
+            "row": ${(index * 10) + 5 },
+            "width": 2,
+            "height": 3
+          },
+          "linkedEntityGuids": null,
+          "visualization": {
+            "id": "viz.billboard"
+          },
+          "rawConfiguration": {
+            "dataFormatters": [
+              {
+                "name": "Success Rate (%)",
+                "precision": "4",
+                "type": "decimal"
+              }
+            ],
+            "linkedEntityGuids": [],
+            "nrqlQueries": [
+              {
+                "accountIds": [
+                  ${new_relic_account_id}
+                ],
+                "query": "FROM Transaction SELECT 100 - percentage(count(*), WHERE error is true) AS 'Success Rate' WHERE appName ='gsa-fac-${env}' AND request.uri LIKE '${endpoint.uri}%' SINCE 7 days ago "
+              }
+            ],
+            "thresholds": [
+              {
+                "alertSeverity": "WARNING",
+                "value": ${endpoint.success_rate_sla.warning}
+              },
+              {
+                "alertSeverity": "CRITICAL",
+                "value": ${endpoint.success_rate_sla.critical}
+              }
+            ],
+            "vizcoConfiguration": {
+              "billboard": {
+                "thresholds": [
+                  {
+                    "limit": ${endpoint.success_rate_sla.warning},
+                    "type": "warning"
+                  },
+                  {
+                    "limit": ${endpoint.success_rate_sla.critical},
+                    "type": "critical"
+                  }
+                ]
+              },
+              "dataFormatters": [
+                {
+                  "name": "Success Rate (%)",
+                  "precision": "4",
+                  "type": "decimal"
+                }
+              ]
+            }
+          }
+        },
+        {
+          "title": "Errors",
+          "layout": {
+            "column": 5,
+            "row": ${(index * 10) + 5 },
+            "width": 6,
+            "height": 3
+          },
+          "linkedEntityGuids": null,
+          "visualization": {
+            "id": "viz.line"
+          },
+          "rawConfiguration": {
+            "nrqlQueries": [
+              {
+                "accountId": ${new_relic_account_id},
+                "query": "FROM TransactionError SELECT count(*) AS 'Errors (last hour)' WHERE (appName = 'gsa-fac-${env}') AND (request.uri LIKE '${endpoint.uri}%') SINCE 14 days ago TIMESERIES"
+              }
+            ]
+          }
+        },
+        {
+          "title": "Latency (last hour)",
+          "layout": {
+            "column": 1,
+            "row": ${(index * 10) + 8 },
+            "width": 2,
+            "height": 3
+          },
+          "linkedEntityGuids": null,
+          "visualization": {
+            "id": "viz.billboard"
+          },
+          "rawConfiguration": {
+            "dataFormatters": [
+              {
+                "name": "p95",
+                "type": "decimal"
+              },
+              {
+                "name": "p50",
+                "type": "decimal"
+              },
+              {
+                "name": "Average",
+                "type": "decimal"
+              }
+            ],
+            "facet": {
+              "showOtherSeries": false
+            },
+            "nrqlQueries": [
+              {
+                "accountIds": [
+                  ${new_relic_account_id}
+                ],
+                "query": "FROM Transaction SELECT average(convert(duration, 's', 'ms')) AS 'Average', percentile(convert(duration, 's', 'ms'), 50) AS 'p50', percentile(convert(duration, 's', 'ms'), 95) AS 'p95' WHERE (appName = 'gsa-fac-${env}') AND (request.uri LIKE '${endpoint.uri}%') SINCE 1 hour ago"
+              }
+            ],
+            "platformOptions": {
+              "ignoreTimeRange": false
+            }
+          }
+        },
+        {
+          "title": "Average Latency Target (last week): ${endpoint.latency_sla.critical}ms",
+          "layout": {
+            "column": 3,
+            "row": ${(index * 10) + 8 },
+            "width": 2,
+            "height": 3
+          },
+          "linkedEntityGuids": null,
+          "visualization": {
+            "id": "viz.billboard"
+          },
+          "rawConfiguration": {
+            "dataFormatters": [
+              {
+                "name": "Average Latency (ms)",
+                "precision": "0",
+                "type": "decimal"
+              }
+            ],
+            "linkedEntityGuids": [],
+            "nrqlQueries": [
+              {
+                "accountIds": [
+                  ${new_relic_account_id}
+                ],
+                "query": "FROM Transaction SELECT average(convert(duration, 's', 'ms')) AS 'Average' WHERE (appName = 'gsa-fac-${env}') AND (request.uri LIKE '${endpoint.uri}%') SINCE 7 days ago "
+              }
+            ],
+            "thresholds": [
+              {
+                "alertSeverity": "CRITICAL",
+                "value": ${endpoint.latency_sla.critical}
+              },
+              {
+                "alertSeverity": "WARNING",
+                "value": ${endpoint.latency_sla.warning}
+              }
+            ],
+            "vizcoConfiguration": {
+              "billboard": {
+                "thresholds": [
+                  {
+                    "limit": ${endpoint.latency_sla.critical},
+                    "type": "critical"
+                  },
+                  {
+                    "limit": ${endpoint.latency_sla.warning},
+                    "type": "warning"
+                  }
+                ]
+              },
+              "dataFormatters": [
+                {
+                  "name": "Average Latency (ms)",
+                  "precision": "0",
+                  "type": "decimal"
+                }
+              ]
+            }
+          }
+        },
+        {
+          "title": "Latency",
+          "layout": {
+            "column": 5,
+            "row": ${(index * 10) + 8 },
+            "width": 6,
+            "height": 3
+          },
+          "linkedEntityGuids": null,
+          "visualization": {
+            "id": "viz.line"
+          },
+          "rawConfiguration": {
+            "facet": {
+              "showOtherSeries": false
+            },
+            "legend": {
+              "enabled": true
+            },
+            "nrqlQueries": [
+              {
+                "accountIds": [
+                  ${new_relic_account_id}
+                ],
+                "query": "FROM Transaction SELECT average(convert(duration, 's', 'ms')) AS 'Average', percentile(convert(duration, 's', 'ms'), 50) AS 'p50', percentile(convert(duration, 's', 'ms'), 95) AS 'p95'  WHERE (appName = 'gsa-fac-${env}') AND (request.uri LIKE '${endpoint.uri}%') SINCE 14 days ago TIMESERIES"
+              }
+            ],
+            "platformOptions": {
+              "ignoreTimeRange": false
+            },
+            "thresholds": {
+              "isLabelVisible": true
+            },
+            "units": {
+              "unit": "MS"
+            },
+            "yAxisLeft": {
+              "zero": true
+            },
+            "yAxisRight": {
+              "zero": true
+            }
+          }
+        }
+    %{ endfor ~}
+  ]
+}
diff --git a/terraform/shared/modules/newrelic/high_level_page.json.tftpl b/terraform/shared/modules/newrelic/high_level_page.json.tftpl
new file mode 100644
index 0000000000..e5d2d080b9
--- /dev/null
+++ b/terraform/shared/modules/newrelic/high_level_page.json.tftpl
@@ -0,0 +1,541 @@
+{
+  "name": "At A Glance",
+  "description": null,
+  "widgets": [
+    {
+      "title": "Uptime (last hour)",
+      "layout": {
+        "column": 1,
+        "row": 2,
+        "width": 2,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.billboard"
+      },
+      "rawConfiguration": {
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "FROM SyntheticCheck SELECT percentage(count(result), WHERE result = 'SUCCESS') AS 'Uptime' WHERE monitorName = 'Fac Ping ${title(env)}' SINCE 1 hour ago"
+          }
+        ]
+      }
+    },
+    {
+      "title": "Uptime Target: Above ${uptime_sla.critical * 100}%",
+      "layout": {
+        "column": 3,
+        "row": 1,
+        "width": 2,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.billboard"
+      },
+      "rawConfiguration": {
+        "dataFormatters": [
+          {
+            "name": "Uptime (%)",
+            "precision": "4",
+            "type": "decimal"
+          }
+        ],
+        "linkedEntityGuids": [],
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "FROM SyntheticCheck SELECT percentage(count(result), WHERE result = 'SUCCESS') WHERE monitorName = 'Fac Ping ${title(env)}' SINCE 7 days ago"
+          }
+        ],
+        "thresholds": [
+          {
+            "alertSeverity": "WARNING",
+            "value": ${uptime_sla.warning}
+        },
+          {
+            "alertSeverity": "CRITICAL",
+            "value": ${uptime_sla.critical}
+        }
+        ],
+        "vizcoConfiguration": {
+          "billboard": {
+            "thresholds": [
+              {
+                "limit": ${uptime_sla.warning},
+                "type": "warning"
+              },
+              {
+                "limit": ${uptime_sla.critical},
+                "type": "critical"
+              }
+            ]
+          },
+          "dataFormatters": [
+            {
+              "name": "Uptime (%)",
+              "precision": "4",
+              "type": "decimal"
+            }
+          ]
+        }
+      }
+    },
+    {
+      "title": "Uptime",
+      "layout": {
+        "column": 5,
+        "row": 1,
+        "width": 6,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.line"
+      },
+      "rawConfiguration": {
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "FROM SyntheticCheck SELECT percentage(count(result), WHERE result = 'SUCCESS') WHERE monitorName = 'Fac Ping ${title(env)}' SINCE 14 days AGO TIMESERIES"
+          }
+        ]
+      }
+    },
+    {
+      "title": "Transactions (last hour)",
+      "layout": {
+        "column": 1,
+        "row": 4,
+        "width": 2,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.billboard"
+      },
+      "rawConfiguration": {
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "FROM Transaction SELECT count(*) AS 'Transactions' WHERE appName = 'gsa-fac-${env}' SINCE 1 hour ago"
+          }
+        ]
+      }
+    },
+    {
+      "title": "Transactions Target: ${transactions_sla.critical} (average per hour/last week)",
+      "layout": {
+        "column": 3,
+        "row": 4,
+        "width": 2,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.billboard"
+      },
+      "rawConfiguration": {
+        "dataFormatters": [
+          {
+            "name": "Transactions Per Hour",
+            "precision": "0",
+            "type": "decimal"
+          }
+        ],
+        "linkedEntityGuids": [],
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "FROM Transaction SELECT rate(count(*), 1 hour) AS 'Transactions (per hour)' WHERE appName ='gsa-fac-${env}' SINCE 7 days ago"
+          }
+        ],
+        "thresholds": [
+          {
+            "alertSeverity": "WARNING",
+            "value": ${transactions_sla.warning}
+        },
+          {
+            "alertSeverity": "CRITICAL",
+            "value": ${transactions_sla.critical}
+        }
+        ],
+        "vizcoConfiguration": {
+          "billboard": {
+            "thresholds": [
+              {
+                "limit": ${transactions_sla.warning},
+                "type": "warning"
+              },
+              {
+                "limit": ${transactions_sla.critical},
+                "type": "critical"
+              }
+            ]
+          },
+          "dataFormatters": [
+            {
+              "name": "Transactions Per Hour",
+              "precision": "0",
+              "type": "decimal"
+            }
+          ]
+        }
+      }
+    },
+    {
+      "title": "Transactions",
+      "layout": {
+        "column": 5,
+        "row": 4,
+        "width": 6,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.line"
+      },
+      "rawConfiguration": {
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "FROM Transaction SELECT count(*) AS 'Transactions' WHERE appName = 'gsa-fac-${env}' SINCE 14 days ago TIMESERIES"
+          }
+        ]
+      }
+    },
+    {
+      "title": "Errors (last hour)",
+      "layout": {
+        "column": 1,
+        "row": 7,
+        "width": 2,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.billboard"
+      },
+      "rawConfiguration": {
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "FROM TransactionError SELECT count(*) AS 'Errors (last hour)' SINCE 1 hour ago"
+          }
+        ]
+      }
+    },
+    {
+      "title": "Success Rate Target: Above ${success_rate_sla.critical * 100}%",
+      "layout": {
+        "column": 3,
+        "row": 7,
+        "width": 2,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.billboard"
+      },
+      "rawConfiguration": {
+        "dataFormatters": [
+          {
+            "name": "Success Rate (%)",
+            "precision": "4",
+            "type": "decimal"
+          }
+        ],
+        "linkedEntityGuids": [],
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "FROM Transaction SELECT 100 - percentage(count(*), WHERE error is true) AS 'Success Rate' WHERE appName ='gsa-fac-${env}' SINCE 7 days ago "
+          }
+        ],
+        "thresholds": [
+          {
+            "alertSeverity": "WARNING",
+            "value": ${success_rate_sla.warning}
+        },
+          {
+            "alertSeverity": "CRITICAL",
+            "value": ${success_rate_sla.critical}
+        }
+        ],
+        "vizcoConfiguration": {
+          "billboard": {
+            "thresholds": [
+              {
+                "limit": ${success_rate_sla.warning},
+                "type": "warning"
+              },
+              {
+                "limit": ${success_rate_sla.critical},
+                "type": "critical"
+              }
+            ]
+          },
+          "dataFormatters": [
+            {
+              "name": "Success Rate (%)",
+              "precision": "4",
+              "type": "decimal"
+            }
+          ]
+        }
+      }
+    },
+    {
+      "title": "Errors",
+      "layout": {
+        "column": 5,
+        "row": 7,
+        "width": 6,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.line"
+      },
+      "rawConfiguration": {
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "FROM TransactionError SELECT count(*) AS 'Errors (last hour)' WHERE (appName = 'gsa-fac-${env}') SINCE 14 days ago TIMESERIES"
+          }
+        ]
+      }
+    },
+    {
+      "title": "Latency (last hour)",
+      "layout": {
+        "column": 1,
+        "row": 10,
+        "width": 2,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.billboard"
+      },
+      "rawConfiguration": {
+        "dataFormatters": [
+          {
+            "name": "p95",
+            "type": "decimal"
+          },
+          {
+            "name": "p50",
+            "type": "decimal"
+          },
+          {
+            "name": "Average",
+            "type": "decimal"
+          }
+        ],
+        "facet": {
+          "showOtherSeries": false
+        },
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "FROM Transaction SELECT average(convert(duration, 's', 'ms')) AS 'Average', percentile(convert(duration, 's', 'ms'), 50) AS 'p50', percentile(convert(duration, 's', 'ms'), 95) AS 'p95'  WHERE appName = 'gsa-fac-${env}' SINCE 1 hour ago"
+          }
+        ],
+        "platformOptions": {
+          "ignoreTimeRange": false
+        }
+      }
+    },
+    {
+      "title": "Average Latency Target (last week): ${latency_sla.critical}ms",
+      "layout": {
+        "column": 3,
+        "row": 10,
+        "width": 2,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.billboard"
+      },
+      "rawConfiguration": {
+        "dataFormatters": [
+          {
+            "name": "Average Latency (ms)",
+            "precision": "0",
+            "type": "decimal"
+          }
+        ],
+        "linkedEntityGuids": [],
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "FROM Transaction SELECT average(convert(duration, 's', 'ms')) AS 'Average' WHERE (appName = 'gsa-fac-${env}') SINCE 7 days ago "
+          }
+        ],
+        "thresholds": [
+          {
+            "alertSeverity": "CRITICAL",
+            "value": ${latency_sla.critical}
+        },
+          {
+            "alertSeverity": "WARNING",
+            "value": ${latency_sla.warning}
+        }
+        ],
+        "vizcoConfiguration": {
+          "billboard": {
+            "thresholds": [
+              {
+                "limit": ${latency_sla.critical},
+                "type": "critical"
+              },
+              {
+                "limit": ${latency_sla.warning},
+                "type": "warning"
+              }
+            ]
+          },
+          "dataFormatters": [
+            {
+              "name": "Average Latency (ms)",
+              "precision": "0",
+              "type": "decimal"
+            }
+          ]
+        }
+      }
+    },
+    {
+      "title": "Latency",
+      "layout": {
+        "column": 5,
+        "row": 10,
+        "width": 6,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.line"
+      },
+      "rawConfiguration": {
+        "facet": {
+          "showOtherSeries": false
+        },
+        "legend": {
+          "enabled": true
+        },
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "FROM Transaction SELECT average(duration) AS 'Average', percentile(duration, 50) AS 'p50', percentile(duration, 95) AS 'p95' WHERE appName = 'gsa-fac-${env}' SINCE 14 days ago TIMESERIES"
+          }
+        ],
+        "platformOptions": {
+          "ignoreTimeRange": false
+        },
+        "thresholds": {
+          "isLabelVisible": true
+        },
+        "units": {
+          "unit": "MS"
+        },
+        "yAxisLeft": {
+          "zero": true
+        },
+        "yAxisRight": {
+          "zero": true
+        }
+      }
+    },
+    {
+      "title": "",
+      "layout": {
+        "column": 1,
+        "row": 13,
+        "width": 10,
+        "height": 1
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.markdown"
+      },
+      "rawConfiguration": {
+        "text": "# Host Metrics"
+      }
+    },
+    {
+      "title": "Per-host CPU usage",
+      "layout": {
+        "column": 1,
+        "row": 14,
+        "width": 5,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.line"
+      },
+      "rawConfiguration": {
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as cpuUsage WHERE appName = 'gsa-fac-${env}' FACET `host` LIMIT 20 SINCE 7 days ago TIMESERIES"
+          }
+        ]
+      }
+    },
+    {
+      "title": "Per-host memory usage",
+      "layout": {
+        "column": 6,
+        "row": 14,
+        "width": 5,
+        "height": 3
+      },
+      "linkedEntityGuids": null,
+      "visualization": {
+        "id": "viz.line"
+      },
+      "rawConfiguration": {
+        "nrqlQueries": [
+          {
+            "accountIds": [
+              ${new_relic_account_id}
+            ],
+            "query": "SELECT (average(apm.service.memory.physical) * rate(count(apm.service.instance.count), 1 minute)) / 1000 AS memoryUsage FROM Metric WHERE appName = 'gsa-fac-${env}' FACET `host` LIMIT 20 SINCE 7 days ago TIMESERIES"
+          }
+        ]
+      }
+    }
+  ]
+}
diff --git a/terraform/shared/modules/newrelic/monitoring.tf b/terraform/shared/modules/newrelic/monitoring.tf
new file mode 100644
index 0000000000..d9b224184e
--- /dev/null
+++ b/terraform/shared/modules/newrelic/monitoring.tf
@@ -0,0 +1,40 @@
+locals {
+  high_level_page = templatefile("${path.module}/high_level_page.json.tftpl", {
+    env                  = var.cf_space_name
+    new_relic_account_id = var.new_relic_account_id
+    uptime_sla           = { critical = 0.95, warning = 0.99 }   # Uptime Percentage
+    transactions_sla     = { critical = 100, warning = 300 }     # Number of Transactions per hour
+    success_rate_sla     = { critical = 0.975, warning = 0.985 } # Success Rate Percentage
+    latency_sla          = { critical = 1000, warning = 800 }    # Average Latency over a week, in ms
+  })
+
+  endpoint_page = templatefile("${path.module}/endpoints.json.tftpl", {
+    env                  = var.cf_space_name
+    new_relic_account_id = var.new_relic_account_id
+    endpoint_config = [
+      { name             = "UEI Validation"
+        uri              = "/api/sac/ueivalidation"
+        transactions_sla = { critical = 1, warning = 5 }         # Number of Transactions per hour
+        success_rate_sla = { critical = 0.975, warning = 0.985 } # Success Rate Percentage
+        latency_sla      = { critical = 1000, warning = 800 }    # Average Latency over a week, in ms
+      },
+      { name             = "Submit Audit"
+        uri              = "/audit/submission"
+        transactions_sla = { critical = 100, warning = 250 }    # Number of Transactions per hour
+        success_rate_sla = { critical = 0.99, warning = 0.995 } # Success Rate Percentage
+        latency_sla      = { critical = 500, warning = 450 }    # Average Latency over a week, in ms
+      }
+    ]
+  })
+}
+
+locals {
+  template_renderer = templatefile("${path.module}/monitoring_dashboard.json.tftpl", {
+    env   = var.cf_space_name
+    pages = [local.high_level_page, local.endpoint_page]
+  })
+}
+
+resource "newrelic_one_dashboard_json" "fac_monitoring" {
+  json = local.template_renderer
+}
diff --git a/terraform/shared/modules/newrelic/monitoring_dashboard.json.tftpl b/terraform/shared/modules/newrelic/monitoring_dashboard.json.tftpl
new file mode 100644
index 0000000000..6124ecc09a
--- /dev/null
+++ b/terraform/shared/modules/newrelic/monitoring_dashboard.json.tftpl
@@ -0,0 +1,11 @@
+{
+    "name": "FAC Monitoring - ${title(env)}",
+    "description": "FAC Monitoring",
+    "permissions": "PUBLIC_READ_ONLY",
+    "pages": [
+        %{~ for index, page in pages  ~}
+            %{if index!=0},%{ endif }
+            ${page}
+        %{ endfor ~}
+    ]
+}
diff --git a/terraform/shared/modules/newrelic/variables.tf b/terraform/shared/modules/newrelic/variables.tf
index 9586222844..c18212b0dc 100644
--- a/terraform/shared/modules/newrelic/variables.tf
+++ b/terraform/shared/modules/newrelic/variables.tf
@@ -11,4 +11,4 @@ variable "new_relic_api_key" {
 variable "cf_space_name" {
   type        = string
   description = "cloud.gov space name for New Relic"
-}
\ No newline at end of file
+}