|
| 1 | +--- |
| 2 | +title: View the code for a health model |
| 3 | +description: Learn how to see and make changes to the underlying JSON data structure for a health model resource by using code view. |
| 4 | +ms.topic: conceptual |
| 5 | +author: bwren |
| 6 | +ms.author: bwren |
| 7 | +ms.date: 12/12/2023 |
| 8 | +--- |
| 9 | + |
| 10 | +# Code view in Azure Monitor health models |
| 11 | + |
| 12 | +The code view for Azure Monitor health models enables you to view and modify the underlying JSON data structure that defines the health model. While the [designer view](./create-model.md#designer-view) is the recommended way to create and modify health models, the code view can be useful for making bulk changes. For example, use search and replace with the JSON to rename a large number of nodes or copy and paste a large number of nodes from another health model. You can also use the code view to create an [ARM template](./resource-manager-health-model.md) for a fully templatized deployment. |
| 13 | + |
| 14 | +:::image type="content" source="./media/health-model-code/health-model-resource-code-pane.png" lightbox="./media/health-model-code/health-model-resource-code-pane.png" alt-text="Screenshot of a health model resource in the Azure portal with the Code pane selected."::: |
| 15 | + |
| 16 | +## Code structure |
| 17 | + |
| 18 | + |
| 19 | +| Argument | Description | |
| 20 | +|:---|:---| |
| 21 | +| `nodeType` | Must be set to one of the following values:<br><br>- `AzureResourceNode` - Node that represents an Azure resource<br>- `AggregationNode` - Aggregation node with no signal defined<br>- `LogAnalyticsNode` - Aggregate node configured for Log Analytics signals<br>- `PrometheusNode` - Aggregation node configured for Prometheus signals | |
| 22 | +| `nodeId` | GUID that uniquely identifies the node. The root node always has a value of 0. | |
| 23 | +| `nodeKind` | Identifies the type of aggregation node. Not used with Azure resource nodes.<br>Must be set to one of the following values:<br><br>- `Generic`<br>- `UserFlow`<br>- `SystemComponent` | |
| 24 | +| `name` | Display name of the node. | |
| 25 | +| `logAnalyticsResourceId` | Resource ID of the Log Analytics workspace for nodes that are configured for Log Analytics signals. | |
| 26 | +| `logAnalyticsWorkspaceId` | Workspace ID of the Log Analytics workspace for nodes that are configured for Log Analytics signals. | |
| 27 | +| `azureMonitorWorkspaceResourceId` | Resource ID of the Azure Monitor workspace for nodes that are configured for Prometheus signals. | |
| 28 | +| `impact` | Specifies the [impact](./health-state.md#impact) of the node's health state.<br>Must be set to one of the following values:<br><br>- `Standard` (default)<br>- `Limited`<br>- `Suppressed`. | |
| 29 | +| `childNodeIds` | Array of `nodeId` values for any nodes that should be children of the current node. | |
| 30 | +| `visual` | Horizontal and vertical position of the node in the [designer view](./create-model.md#designer-view). | |
| 31 | +| `healthTargetPercentage` | Value for the target service level. Only used on the root entity. | |
| 32 | + |
| 33 | +## Example definition for an `AggregationNode` entity |
| 34 | + |
| 35 | +```json |
| 36 | + { |
| 37 | + "nodeType": "AggregationNode", |
| 38 | + "nodeId": "00000000-0000-0000-0000-000000000000", |
| 39 | + "name": "my-user-flow", |
| 40 | + "childNodeIds": [ |
| 41 | + "00000000-0000-0000-0000-000000000000", |
| 42 | + "00000000-0000-0000-0000-000000000000" |
| 43 | + ], |
| 44 | + "visual": { |
| 45 | + "x": 135, |
| 46 | + "y": -105 |
| 47 | + }, |
| 48 | + "nodeKind": "UserFlow", |
| 49 | + "impact": "Standard" |
| 50 | + } |
| 51 | +``` |
| 52 | + |
| 53 | + |
| 54 | +## Example definition for an `AzureResourceNode` entity |
| 55 | + |
| 56 | +```json |
| 57 | +{ |
| 58 | + "nodeType": "AzureResourceNode", |
| 59 | + "azureResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ContainerService/managedClusters/my-cluster", |
| 60 | + "logAnalyticsResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/workspaces/my-workspace", |
| 61 | + "logAnalyticsWorkspaceId": "00000000-0000-0000-0000-000000000000", |
| 62 | + "nodeId": "00000000-0000-0000-0000-000000000000", |
| 63 | + "name": "my-cluster", |
| 64 | + "credentialId": "SystemAssigned", |
| 65 | + "childNodeIds": [], |
| 66 | + "queries": [ |
| 67 | + { |
| 68 | + "queryType": "ResourceMetricsQuery", |
| 69 | + "metricName": "node_cpu_usage_percentage", |
| 70 | + "metricNamespace": "microsoft.containerservice/managedclusters", |
| 71 | + "aggregationType": "Average", |
| 72 | + "queryId": "00000000-0000-0000-0000-000000000000", |
| 73 | + "degradedThreshold": "75", |
| 74 | + "degradedOperator": "GreaterThan", |
| 75 | + "unhealthyThreshold": "85", |
| 76 | + "unhealthyOperator": "GreaterThan", |
| 77 | + "timeGrain": "PT15M", |
| 78 | + "dataUnit": "Percent", |
| 79 | + "enabledState": "Enabled" |
| 80 | + }, |
| 81 | + { |
| 82 | + "queryType": "ResourceMetricsQuery", |
| 83 | + "metricName": "node_disk_usage_percentage", |
| 84 | + "metricNamespace": "microsoft.containerservice/managedclusters", |
| 85 | + "aggregationType": "Average", |
| 86 | + "queryId": "00000000-0000-0000-0000-000000000000", |
| 87 | + "degradedThreshold": "75", |
| 88 | + "degradedOperator": "GreaterThan", |
| 89 | + "unhealthyThreshold": "90", |
| 90 | + "unhealthyOperator": "GreaterThan", |
| 91 | + "timeGrain": "PT15M", |
| 92 | + "dataUnit": "Percent", |
| 93 | + "enabledState": "Enabled" |
| 94 | + } |
| 95 | + ] |
| 96 | +} |
| 97 | +``` |
| 98 | + |
0 commit comments