> For the complete documentation index, see [llms.txt](https://docs.mspp.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mspp.io/ninjaone-auto-documentation/performance-graphs.md).

# Performance Graphs

These scripts are designed to populate performance information into WYSIWYG custom fields. There are two scripts; one to gather the required performance information into a local json file on a device and a second to aggregate the data and generate the graphs. There are three options for the graphs you can generate (you can  generate all 3 to their own fields or just the ones you want):

24 Hours - This will show the performance data for last 24 hours

Last 30 Days to 24 Hours - This will generate a graph for the last 30 days up until 24 hours in the past.

Last 90 Days to 30 Days - This will generate a graph for the last 90 days until 30 days in the past.

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

### Setup

To configure this you will need to create 3 device custom fields to store the different graphs:

| Field Name            | Field Description        | Type    | Automation Permissions | Definition Scope |
| --------------------- | ------------------------ | ------- | ---------------------- | ---------------- |
| 24HourPerformanceData | 24 Hour Performance Data | WYSIWYG | Write                  | Device           |
| 30DayPerformanceData  | 30 Day Performance Data  | WYSIWYG | Write                  | Device           |
| 90DayPerformanceData  | 90 Day Performance Data  | WYSIWYG | Write                  | Device           |

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

Optionally you can also set the Advanced Setting to automatically expand the fields if you wish.

### The Scripts

#### Data Gathering

Add this script to your automation library and then add it as a script condition set to run every 5 minutes to the policy of any windows devices you wish to monitor.

{% @github-files/github-code-block url="<https://github.com/lwhitelock/NinjaOneAutomation/blob/main/PerformanceGraphs/Data-Gathering.ps1>" %}

#### Graph Generation and Data Aggregation

Configure this script either as a scheduled task or as a condition set to run once per hour. This script relies on the data generated by the data generation script.

{% @github-files/github-code-block url="<https://github.com/lwhitelock/NinjaOneAutomation/blob/main/PerformanceGraphs/Graph-Aggregation.ps1>" %}
