I am trying to get the following expression to work within a SQLServer rule-level variables:
pct_used = (#DBAllocUsedMB#/#DBAllocSizeMB#)*100
mb_free = #DBAllocSizeMB#-#DBAllocUsedMB#
Whenever I reference these rule variables in my alarm message, they always show up as null.
I have tried using the # syntax as well as scope.get(DBAllocSizeMB), but neither works.
The assigned variables were referencing incorrect field names for the agents table.
1) Verify the field names for the agents table in the Web Console | Administration | Tooling | Script Editor
2) Select the Query drop-down for the agents table (in this example it was SQLServer_Database_323)
3) Select List Instances (select one of your deployed agents - Note: select any one of the unique IDs presented).
4) Review the Object Properties section and scroll down to view all the tables fields & values.
5) Make proper edits in the Rule Editor.
ie.
These variables are referencing the fields in the SQLServer_Database_323 table.
The mb_free & pct_used variables are referencing DBAllocSizeMB and DBAllocUsedMB which dont exist.
They should be DataAllocSizeMB & DataAllocUsedMB.
Entries as shown in the MonitoringPolicies file:
<expression name=pct_used>return ((#DBAllocUsedMB#/#DBAllocSizeMB#)*100)]] <----DB should be Data
<expression name=mb_free>#DBAllocSizeMB#-#DBAllocUsedMB#]] <----DB should be Data
Alternately:
1) Create a support bundle
2) Open the support bundle and view the MonitoringPolicies.xml file
3) Search for your desired rule
4) Review all the conditional and action statements.
© 2025 Quest Software Inc. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center