Tanzu

Tanzu Cloudhealth Webhooks

  • 1.  Tanzu Cloudhealth Webhooks

    Posted Sep 02, 2025 02:28 PM
    Edited by Jason McClellan Sep 03, 2025 02:09 PM

    I dont know if this is the right community, but for the life of me can't find one for cloud health itself, so went with this as Tanzu is in its name. 

    So I am setting up Cost Anomaly alerts via webhooks to MSTeams. I managed to get an adaptive card working by breaking out the data [see below], however the documentation is extremely lacking [https://techdocs.broadcom.com/us/en/vmware-tanzu/cloudhealth/tanzu-cloudhealth/saas/tnz-cloudhealth/using-and-managing-tanzu-cloudhealth-integrating-with-third-party-services.html]. My issue now is when the cost anomaly runs, it bundles everything into a garbled message if there is more than one anomaly. 

    i understand that i cant split this up to use a "for each" on the Teams side due to the limitation off the webhook interface / process on the CloudHealth side. 

    However, I would at least like to be able to add line breaks or even spaces between the values being populated?

    {
      "type": "message",
      "attachments": [
        {
          "contentType": "application/vnd.microsoft.card.adaptive",
          "contentUrl": null,
          "content": {
            "type": "AdaptiveCard",
            "body": [
              {
                "type": "TextBlock",
                "size": "Medium",
                "weight": "Bolder",
                "text": "CloudHealth Policy: {{{ policyName }}}",
                "style": "heading",
                "wrap": true
              },
              {
                "type": "TextBlock",
                "text": "Evaluated At: {{{ evaluatedAt }}}",
                "wrap": true
              },
              {
                "type": "FactSet",
                "facts": [
                  {
                    "title": "resourceType",
                    "value": "{{{ resourceType }}}"
                  },
                  {
                    "title": "resultSummary",
                    "value": "{{{ resultSummary }}}"
                  },
                  {
                    "title": "warnings",
                    "value": "{{{ warnings }}}"
                  },
                  {
                    "title": "New:",
                    "value": "{{#violations}}{{New?}}{{/violations}}"
                  },
                  {
                    "title": "AccountName",
                    "value": "{{#violations}}{{AccountName}}{{/violations}}"
                  },
                  {
                    "title": "Service:",
                    "value": "{{#violations}}{{Service}}{{/violations}}"
                  },
                  {
                    "title": "Region:",
                    "value": "{{#violations}}{{Region}}{{/violations}}"
                  },
                  {
                    "title": "CostImpact:",
                    "value": "{{#violations}}{{CostImpact}}{{/violations}}"
                  },
                  {
                    "title": "CostImpact%:",
                    "value": "{{#violations}}{{CostImpactPercentage}}{{/violations}}"
                  },
                  {
                    "title": "ActualCost:",
                    "value": "{{#violations}}{{Cost}}{{/violations}}"
                  },
                  {
                    "title": "StartDate:",
                    "value": "{{#violations}}{{StartDate}}{{/violations}}"
                  },
                  {
                    "title": "Duration:",
                    "value": "{{#violations}}{{Duration}}{{/violations}}"
                  },
                  {
                    "title": "Status:",
                    "value": "{{#violations}}{{Status}}{{/violations}}"
                  },
                  {
                    "title": "Tags:",
                    "value": "{{#violations}}{{Tags}}{{/violations}}"
                  },
                  {
                    "title": "AccountId:",
                    "value": "{{#violations}}{{AccountId}}{{/violations}}"
                  },
                ]
              }
            ],
            "actions": [
              {
                "type": "Action.OpenUrl",
                "title": "View in CloudHealth Web Interface",
                "url": "{{{ alertLink }}}",
                "role": "button"
              }
            ],
            "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
            "version": "1.6"
          }
        }
      ]
    }

     

    Here is an example when there is two entries in the anomaly, and you can see there is no space:

    CloudHealth Policy: Cost anomaly
    Evaluated At: 2025-09-02T07:30:21Z
    resourceType
    aws_anomaly
    resultSummary
    2 increasing anomalies have a cost impact greater than 100$ updated in the last day
    warnings
    []
    New:
    falsefalse
    AccountName
    account1 (0123456789)account2 (9876543210)
    Service:
    AmazonEC2AmazonS3
    Region:
    us-east-1us-east-1
    CostImpact:
    $135.07$220.90
    CostImpact%:
    23.8%5.32%
    ActualCost:
    $702.52$375.28
    StartDate:
    2025/08/302025/08/29
    Duration:
    -1 day
    Status:
    ACTIVEINACTIVE
    Tags:
    AccountId:
    01234567899876543210



    -------------------------------------------