Please install the script from Git https://github.com/aimsinnovation/aims-custom-rules


There are cases where you would want to apply the same custom thresholds to a larger number of components of the same type. For instance multiple databases, stored procedures, BizTalk ports, server memory and so on.


The AIMS UI is perfect for setting individual custom thresholds, but setting multiple rules on multiple components is more efficient by scripting.


  1. First you need to find your environment id. This can be done by going to "settings -> agents" and scroll down to the bottom where you will find an URL (environment API address) that contains your environment id
  2. Second, you will need to find the stattype (parameter) you want to set custom thresholds for. Navigate to "settings -> custom agents" and expand the agent that contains the metric in question. Select "summary" and then "stattypes". Now find the parameter in question and copy the name (for instance "aims.bts.message-count")
  3. Third, it is time to find the IDs of all the nodes where you want to apply the custom rules. To find the ID of a node (for instance a server, database or BizTalk port), navigate in the Topology to the component and click it. Check the URL in the browser, the last number in the URL will be the node id. Repeat this until you have noted down all nodes you want to set the custom thresholds for.


Now it is time to configure the JSON config file for setting the custom thresholds.


{
  "masterApiUrl": "https://api.aimsinnovation.com/api/",
  "credentials": {
    "email": "your_user_email",
    "password": "your_password"
  },
  "data": [
    {
      "environmentId": "{environment_id}",
      "rules": [
        {
          "statType":"aims.bts.message-count",
          "period":"day",
          "min":0,
          "max":2,
          "startTimeSeconds":36000,
          "endTimeSeconds":39600
        },
                {
          "statType":"aims.bts.message-count",
          "period":"day",
          "min":0,
          "max":2,
          "startTimeSeconds":39600,
          "endTimeSeconds":43200
        }

      ],
      "nodeIds": [nodeId, nodeId]
    }
  ]
}


  • If period = "day" (you set repeating rules for specific time ranges every day of the week) then "startTimeSeconds" and "endTimeSeconds" are set in seconds from 12am. So in the example above the start time is 10am and end time is 11am. So the calculation will be:
    • ((Hours*60) + minutes )*60)
  • if period = "week" (you set rules for a specific day and time range of the week) then the calculation for "startTimeSeconds" and "endTimeSeconds" is as follows: 
    • ((Hours*60) + minutes )*60) + (DayOfTheWeek * 86400). Monday is day 1, Tuesday is day 2 and so on.