# Virtual Machine

In the VM we'll look at how to set up dashboards in CloudWatch and add different kinds of widgets to them. This will demonstrate how the service can enable more effective monitoring in your cloud environment. We’ll finish by reading data from widgets to answer questions about activity in the account.

<figure><img src="/files/pTEEkc8Sh3JfVHxdOPNE" alt=""><figcaption><p>Caption Cloudtrail management console.</p></figcaption></figure>

In the CloudTrail console, select the metrolio-management-trail.

In the CloudWatch Logs section, click on Edit.\
\
Enable CloudWatch logs with a new log group called metrolio-management-logs and use the existing IAM role MetrolioCloudWatchRole.

<figure><img src="/files/w1cjqZTspj0xLKbNiLiI" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ybC7hFEL44UndweZY8kY" alt=""><figcaption></figcaption></figure>

Navigate to the CloudWatch console and ensure you're in the the same region.

recommend changing the displayed timescale on dashboards to 30 minutes (select Custom, next to the options) and setting the Period Override to 1 minute (located in the Actions

<figure><img src="/files/Yoc5RkAEfEMuKUrfzr4l" alt=""><figcaption></figcaption></figure>

Create a new CloudWatch dashboard and name it Metrolio-CloudTrail.\
\
On the Add widget screen, select Logs table.\
\
Select the log group you created for the CloudTrail.

Paste the query stats count(\*) by eventSource, eventName, awsRegion over the pre-filled query in the box and Create widget, then Save Dashboard. You may be presented with red banner errors during this process, but you should still be able to complete all aspects of the task.\
\
It may take a couple of minutes for the information to be viewable in CloudWatch.

<figure><img src="/files/FLT7J3I4PxFXtYrUG640" alt=""><figcaption></figcaption></figure>

Navigate to the metrolio-overview dashboard in CloudWatch.\
\
Select Add widget (+ button on the top right) and create a Gauge widget.\
\
In the Browse tab, select the Lambda namespace; the metric should monitor across all functions and select the metric Throttles.\
\
In the Graphed metrics tab, change the statistic to Sum and Period to 1 minute.\
\
In the Options tab, set the range of the Gauge to be between 0 and 10.\
\
Click Create Widget. Then click Save dashboard.

<figure><img src="/files/llIwbm9c2NLv0wQQoWmB" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/bMusBGFgcJA8WOcJ82H9" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/eAkWRvFq31YSM96RZtJE" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/3YPKpPZG6KguHfXnrPkX" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/Khpmd5CLo5Yx751qeYFk" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/36XcFkBUQJfXTJfnYuDM" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/wrlhfuHwmxUtoVHgY69a" alt=""><figcaption></figcaption></figure>

Dashboard should look like this once saved

<figure><img src="/files/wUemnmisorZZvDFl1bvW" alt=""><figcaption></figcaption></figure>

What's the name of the Lambda function that's generating errors?

Metrolio-Payroll

What's the name of the Lambda function that's taking over four seconds to run?

Metrolio-MachineLearner

By navigating to the Metrolio-MachineLearner log group, what is the serial being printed to the logs for the Metrolio-MachineLearner function?

<figure><img src="/files/H7NEV3JQGWXRjD3Pa30C" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/lfMZ0EQ2Q0xRxHlRlIEY" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://oklencodes.gitbook.io/untitled/cloud/aws/using-different-aws-services-with-splunk/cloudwatch/the-cloudwatch-dashboard/virtual-machine.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
