Need help with trying to mod a alert rule using Groovy using perl

Hello, the stock rule just alerts on high tbl space and sends email to support. But it does it for all tbl spaces. Need to exclude from the alerting all table spaces that end in TEMP and all that begin with UNDO. The below syntax is bad according to the checker. I was hoping to use Perl's pattern-binding operator. This is my first attempt at modifying a rule so didnt expect it to work right off. but I don't want to have to itemize each tablespace in a list and then spin through the list in a if statement. Is there a way to get the below code to work? I put my mods to the stock rule in red below.   DBO - Tablespace Used Percentage  (cartridge   DB_ORACLE_UI)

//Custom Rule to exclude tablespaces that don't need to be alerted on
// 072919  sjb  New
condition = (#DBO_allocated_space_used_pct_for_rules# >= registry("DBO_TablespaceStorage-AllocatedUsedPct_High")) && @tablespaceName !~ /TEMP$/ && @tablespaceName !~ /^UNDO/ ;
return DBWC_RacAndSingleInstanceRuleFilter(scope, "DBO - Tablespace Used Percentage", "4", condition);

  • Hello,

    please change the scope of the rule to exclude tablespaces, do not change the condition.

    See screen shot below. Click on the tab "Rule Definition" and in the bottom you see the rule scope which should DBO_Tablespace. Here you can exclude tables spaces. For example:

    DBO_Tablespace where name != 'TEMP'

    When clicking on the green check mark button you will get a list of all objects in the scope. Here you can check if you where clause is matching properly

    You can use wild cards like %, but then you cannot work with the equal sign "=". The please use "like" or "!like". For example:

    DBO_Tablespace where name !like' TE%'

    Does that help?

    Regards

    Nicola

  • Thanks for your solution. I didnt know it was possible to put logic in the Rule Definition. I need to review the manuals to find documentation on how to modify rules. For our DBAs to accept the product they need to eliminate the false positives. They are getting alarm fatigue. 

  • There is another option but that will exclude tablespaces from the monitoring. The above solution will exclude it from the alarm, but metrics are collected and you can see them in the dashboard.

    If you want to exclude a tablespace from the monitoring in general, follow these steps:

    1. On the DB Overview dashboard select the agent(s) you want to change

    2. Click on Settings | Administration

    3. Now select "Collection Settings" from the tree and then the tab "Tablespace Filtering"

    4. Here you can add tablespaces to the exclude list

    5. Finally, do not forget to save the changes (right bottom corner of the dashboard is the save button)

    This will exclude the tablespace from monitoring, no metrics will be collected.

    Here a screenshot:

    Regards

    Nicola

  • Nicola, I'm guessing its not by chance that the UNDO and Temp databases appear by default in the exclude list : }

    This is a great option I was unaware of. If I just ck the box for UNDO and turn it true, do I have to add tablespaces to the exclude list or will foglight know to exclude all UNDO tablespaces for the selected database?   I see where I can do a regex to exclude ^UNDO,

    I wish foglight had context sensitive help ? screen where I can rt mouse of hover over and get an example and more detail on syntax. also a test button where I could put in the values of the test and see if my logic works before going live with it. It may have all these features but I don't know where to find them.

  • I have set up my copy of the rule. I made two copies, how do I get rid of one of the copies?  there is no delete rule option that I can find. also setting up email action on the copy of a rule isn't the same as setting it up on the out of the box rule. It doesn't have a place to put To:  I went into ACTION and selected EmailAction but there doesn't seem to be a way to configure the email.  I added email to the out of the box rule DBO - Tablespace Used Percentage from Databases | Administration  then selecting it under Alarms.  My custom rule doesn't show up in that dashboard. Is it possible that my copy inherits the email ability from what it was copied from?

    all this has nothing to do with the original question but is just the next stumbling block along the long path to getting this one rule working that way we want.

    Below is from Dashboard | Administration | Rules | Edit Rule Page  for my copied rule (non-cartridge). It shows the Action EmailAction. But no way to add a  recipient. I don't know where that would be configured.

  • Hello sbenn.

    You can just disable the old rule since there is no delete.

    For the recipient if you click on the value Default on the line mail.recipient you can input the recipient you want either directly or by using a variable, either registry or rule/system one.

  • Thanks for your help. I just found a delete rule button on my copied rule.  Edit the Non-Cartridge rule, Enter Rule Editor, at the very bottom of screen is 4 options, Choose "Delete This Rule".   When you return back to the list of rules  under Rules  Non-Cartridge  its still there. but you can no longer edit it. I navigated to Databases dashboard and returned to Rules and its now gone from the list. Seems like a bug, on deletion the list should be refreshed immediately.