Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[General workload issue]: Adding a service alerts for DBforMySQL #447

Open
1 task done
ChrisPolewiak opened this issue Dec 6, 2024 · 7 comments
Open
1 task done
Assignees
Labels
AMBA Core Issues / PR's related AMBA Core enhancement New feature or request

Comments

@ChrisPolewiak
Copy link

Check for previous/existing GitHub issues

  • I have checked for previous/existing GitHub issues

Issue Type?

Feature Request

Description

How to deploy a set of polices to monitor for example Azure DB for MySQL
Do I have to manually add all the policies from "azure-monitor-baseline-alerts/services/DBforMySQL/flexibleServers/templates" to my IaC code, or there is a parameter in alzArm.param.json which automatically add those polices?

I do not found a documentation about that, there are only policy (json, bicep, arm) definitions without an usage guide...

Thanks in advance

@ChrisPolewiak ChrisPolewiak added the Pattern: ALZ 🚁 Issues / PR's related to the ALZ Pattern label Dec 6, 2024
@Brunoga-MS Brunoga-MS added AMBA Core Issues / PR's related AMBA Core and removed Pattern: ALZ 🚁 Issues / PR's related to the ALZ Pattern labels Dec 6, 2024
@Brunoga-MS Brunoga-MS assigned judyer28 and unassigned Brunoga-MS and tagolovina Dec 6, 2024
@judyer28
Copy link
Contributor

judyer28 commented Dec 9, 2024

Hello @ChrisPolewiak, thanks for your interest in AMBA. Your assumption is correct. DBforMySQL/flexibleServers is not included in the ALZ pattern so there is not a parameter or initiative that will automatically add those policies. You will need to add them manually using the templates provided.

@ChrisPolewiak
Copy link
Author

Ok is there any guidance how to add it automatically? For example I want an alert triggers to many services but I do not want to click each of them manually on the portal.
I was thinking about script which download selected polices from GH, but I'm not sure it is enough... what with policy initiatives, what with remediation tasks...

@judyer28 judyer28 added the enhancement New feature or request label Dec 12, 2024
@judyer28
Copy link
Contributor

Hello Chris, we do not have any scripts today other than what you see in ALZ which can be used as an example to follow for other services. We are working on ways to make automation easier for all the other services. Some of the pieces are there with the ARM\Bicep\Policy templates for each alert. If you are not already aware, in the Github repo under each service, there is a template folder. In those folders are arm\bicep\policy folders that contain templates that can be used in scripts. For now, I am going to mark this as an enhancement for future considerations. Let us know if you have any further questions.

@ChrisPolewiak
Copy link
Author

last question is there any json file with list of all available polices? I started working with a script which allows to mark in configuration which policy we want to import and then automatically download policy from GH and implement.

Some json file with all available polices and alerts could help - currently I'm working with alerts.yaml files... :-(

@judyer28
Copy link
Contributor

Hello Chris, have you seen this json file? https://azure.github.io/azure-monitor-baseline-alerts/amba-alerts.json

This has all of the alerts. One potential method would be to find the policy file using the resource type, metric name and the guid. Or perhaps just searching all templates\policy folders in the repo for the GUID.

@ChrisPolewiak
Copy link
Author

perfect.. generate similar using tooling/export-alerts/export-alerts.py

now I'm working how to import single policy using JSON file and parameters :-/

something like this:

New-AzPolicyDefinition -Name 'AMBA-AnalysisServices-servers-memory_metric' -DisplayName 'AMBA Policy for AnalysisServices/servers memory_metric'
-Policy https://raw.githubusercontent.com/SiiPoland/azure-monitor-baseline-alerts/refs/heads/main/services/AnalysisServices/servers/templates/policy/memorymetric_0289bc11-db65-4a58-91ed-fda8637322ec.json `
-Parameter '{"MonitorDisableTagValues":{"value":["true","test"]}

but still got an error:
"The request content was invalid and could not be deserialized: 'Could not find member 'value' on object of type 'PolicyParameterDefinition'. Path 'properties.parameters.MonitorDisableTagValues.value', line 1, position
| 5118.'."

:-(

@judyer28
Copy link
Contributor

judyer28 commented Dec 16, 2024

Hello @ChrisPolewiak,
Those policy JSON files are meant to be included\combined into one deployable ARM template. As an example, see how the ALZ pattern uses this approach in patterns\alz\templates\policies-Network.bicep.

If you just wanted to deploy the memorymetric policy definition you would need to change the file to include the $schema, and content version like so:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
content of memorymetric_0289bc11-db65-4a58-91ed-fda8637322ec.json file
]
}

Then deploy using AZ CLI like so:
az deployment mg create --management-group-id 'replace with id' --location 'replace with location' --template-file memorymetric_0289bc11-db65-4a58-91ed-fda8637322ec.json

Would you find it beneficial to have the policy files generated with the $schema and content version so they could be easily deployed in this way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AMBA Core Issues / PR's related AMBA Core enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants