anwather / amba-export

6 stars 5 forks source link

attempting to assign the parameter(s) 'MonitorDisableTagValues,MonitorDisableTagName' which are not defined in the policy definition #48

Closed riosengineer closed 1 month ago

riosengineer commented 1 month ago

Hey,

Thanks for this repo, it's appreciated and helpful for AMBA x EPAC.

I'm struggling to deploy, is anyone able to help, or at least check this is my error and not a bug or something? I keep getting:

Definition error 400 -- Deploy Azure Monitor Baseline Alerts for Web --{ "error": { "code": "UndefinedPolicyParameter", "message": "The policy set definition 'Alerting-Web' is | attempting to assign the parameter(s) 'MonitorDisableTagValues,MonitorDisableTagName' which are not defined in the policy definition 'Deploy_WSF_CPUPercentage_Alert'." } }

I've copied the Definitions folder over and it looks like:

image

It looks like the definition deploy_wsf_cpupercentage_alert in policyDefinitions does not have those parameters. But, when checking the original AMBA repo, I can see them: https://github.com/Azure/azure-monitor-baseline-alerts/blob/main/patterns/alz/policyDefinitions/policies-Web.json

Is this some bug in the latest pull?

Thanks

riosengineer commented 1 month ago

Edit: It looks like the pending auto-PR from the bot, has the fix? https://github.com/anwather/amba-export/pull/47/files#diff-99cdef8dc2f5f43565b54184796b8f89892c722e42cd0222b09e7e674a1640cb @anwather

haflidif commented 1 month ago

@riosengineer I got the same issue here, it looks like there are 27 Policy Definitions that have this malfunctioned Parameter

"MonitorDisable": {
        "metadata": {
          "description": "Tag name to disable monitoring resource. Set to true if monitoring should be disabled",
          "displayName": "Effect"
        },
        "defaultValue": "MonitorDisable",
        "type": "String"
      }

You can do find&replace with this code

"MonitorDisableTagName": {
        "type": "String",
        "metadata": {
          "displayName": "ALZ Monitoring disabled tag name",
          "description": "Tag name to disable monitoring. Set to true if monitoring should be disabled"
        },
        "defaultValue": "MonitorDisable"
      },
      "MonitorDisableTagValues": {
        "type": "Array",
        "metadata": {
          "displayName": "ALZ Monitoring disabled tag values(s)",
          "description": "Tag value(s) used to disable monitoring at the resource level. Set to true if monitoring should be disabled."
        },
        "defaultValue": [
          "true",
          "Test",
          "Dev",
          "Sandbox"
        ]
      }

As well you need to do the same for the policyRule

            "field": "[concat('tags[', parameters('MonitorDisable'), ']')]",
            "notEquals": "true"

With

            "field": "[concat('tags[', parameters('MonitorDisableTagName'), ']')]",
            "notIn": "[parameters('MonitorDisableTagValues')]"

That fixed the issue that I had with the deployment at my side after updating all the definition files.

You can use this Search Query to find all the files: repo:anwather/amba-export "MonitorDisable":

riosengineer commented 1 month ago

@riosengineer I got the same issue here, it looks like there are 27 Policy Definitions that have this malfunctioned Parameter

"MonitorDisable": {
        "metadata": {
          "description": "Tag name to disable monitoring resource. Set to true if monitoring should be disabled",
          "displayName": "Effect"
        },
        "defaultValue": "MonitorDisable",
        "type": "String"
      }

You can do find&replace with this code

"MonitorDisableTagName": {
        "type": "String",
        "metadata": {
          "displayName": "ALZ Monitoring disabled tag name",
          "description": "Tag name to disable monitoring. Set to true if monitoring should be disabled"
        },
        "defaultValue": "MonitorDisable"
      },
      "MonitorDisableTagValues": {
        "type": "Array",
        "metadata": {
          "displayName": "ALZ Monitoring disabled tag values(s)",
          "description": "Tag value(s) used to disable monitoring at the resource level. Set to true if monitoring should be disabled."
        },
        "defaultValue": [
          "true",
          "Test",
          "Dev",
          "Sandbox"
        ]
      }

As well you need to do the same for the policyRule

            "field": "[concat('tags[', parameters('MonitorDisable'), ']')]",
            "notEquals": "true"

With

            "field": "[concat('tags[', parameters('MonitorDisableTagName'), ']')]",
            "notIn": "[parameters('MonitorDisableTagValues')]"

That fixed the issue that I had with the deployment at my side after updating all the definition files.

You can use this Search Query to find all the files: repo:anwather/amba-export "MonitorDisable":

Thanks for this @haflidif. I had to drop the project for a while but will try this when I pick it back up if it's not been resolved before then. I hope AMBA and EPAC can work on native integration soon

riosengineer commented 1 month ago

@haflidif worked a treat, thanks :)

anwather commented 1 month ago

I've just approved the PR (my bad for taking so long) - please re-open if this doesn't fix the issue.

anwather commented 1 month ago

@riosengineer - it is on my roadmap to integrate AMBA - similar to how we do ALZ, just need to find some time to write the script to sync this repo locally like I do for ALZ

riosengineer commented 1 month ago

@riosengineer - it is on my roadmap to integrate AMBA - similar to how we do ALZ, just need to find some time to write the script to sync this repo locally like I do for ALZ

Legend. Thanks for all your efforts. Will keep an eye out in the near future 💪