Ad Widget

Collapse

Problems with Azure Cost Management Monthly

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dalfieri
    Junior Member
    • Feb 2024
    • 2

    #1

    Problems with Azure Cost Management Monthly

    Hi Everyone,

    I'm having problems with Azure Cost Management by HTTP template:

    All monthly cost items only show the cost of the first day of the month and not of the total month.

    I tried both with Zabbix 6.4 and 7.0

    Has anyone had the same problem?

    Thanks
  • Luis Humelino
    Junior Member
    • Aug 2024
    • 1

    #2
    I may have found the problem.

    The monthly items that are erroneously showing the first day's of the month data have two pre-processing steps.

    The second one must have the function sum instead of first.

    Example:

    Click image for larger version

Name:	image.png
Views:	376
Size:	16.3 KB
ID:	489129

    Comment

    • leascherf
      Junior Member
      • Jul 2024
      • 5

      #3
      I fixed it this way.
      In the second json route preprocessing, I just kept PreTaxCost at the end.

      Add a new javascript preprocessing:

      Code:
      var NewValue = value.replace(/[\[\]"]/g, '').split(',');
      var sum = 0;
      for (var i = 0; i < NewValue.length; i++) {
      if (NewValue[i] && !isNaN(NewValue[i])) {
      sum += parseFloat(NewValue[i]);
      }
      }
      return(sum);


      Comment

      • leascherf
        Junior Member
        • Jul 2024
        • 5

        #4


        I added the image in a new comment because I cant edit the another comment.

        Comment

        • rafael.roquete
          Junior Member
          • Mar 2024
          • 6

          #5
          Hello.

          I'm having the same problem and I was unsure about how pre-processing was configured on the item.

          leascherf, is it possible to send a print?

          I'm using Zabbix version 6.0.8.

          Comment

          • rafael.roquete
            Junior Member
            • Mar 2024
            • 6

            #6
            I solved the problem by changing the value "first" to "sum" at the end of the JSONPath.

            $.monthCost.data.[?(@.BillingMonth == "{#AZURE.BILLING.MONTH}")].PreTaxCost.sum()

            Comment

            Working...