Back to Geneos FAQ

How to use a path variable to enable or disable various rules

Solution Copied

This is an alternative to linking an active time to a rule or disabling or enabling a rule in the Gateway Setup Editor.

This solution entails creating a custom dataview with a dataview name and rule status columns, and having a new or existing rule reference the rule status value using a path alias and path variable. Once referenced, you can adjust the logic in the rule to trigger based on the dataview’s rule status value.

The following is an example FKM rule where we set the FKM status cell to critical if the status contains a string like NOT_FOUND or FAIL. Notice this rule targets the status columns on both the Beta FKM and Generic_FKM_Testing_Sampler dataviews.

FKM status rule

Let’s say we want this rule to be active but want the ability to disable some or all parts of the rule during downtime or maintenance on the fly without using active times or disabling the rule. You can create a custom dataview like the one below that lists Dataview Name and its Rule Status.

You can then modify your rule to trigger based on the dataview’s Rule Status value. The following steps set this up.

Dataview Status Toolkit View

Create a Path Variable that will grab the rule target’s dataview name Copied

  1. Go to the Rule’s Advanced tab and click Add new in the Path variables section.
  2. Set the path variable name to rowname.
  3. Under the Value section, remove the value true and right-click on the white space of the Value section and select Target names > dataviewName.

dataviewName target value for rowname

Add Path Variable to Path Alias referencing Rule Status in the Dataview Status Toolkit View Copied

This is how we match the rule target’s dataview name and the rowname in the Dataview Status Toolkit View to grab the corresponding Rule Status value.

  1. Go to the Rule’s Advanced tab and click Add new in the Path alias section.
  2. Name the path alias rule\_status.
  3. Drag and drop the Rule Status cell from any row in the Dataview Status Toolkit View to the xpath field.
  4. Click the EDIT… button next to the Xpath.

Edit path alias

  1. Hover over the Row element and click EDIT.
  2. In the Element Properties window, set the name to $rowname.
  3. Close the Element Properties window.
  4. Click the OK button in the Edit Path window.

Element Properties

Add logic in the rule block to determine if the rule is active depending on the path alias value Copied

Now that we have the rule_status path alias set in the Advanced tab, we can now reference it in the rule block.

In the example rule block, we are setting a variable called $(rulestat) that references the rule_status path alias.

set $(rulestat) path "rule_status" value

In this rule, we are looking to set the cell to critical if the status contains a string like \*NOT\_FOUND\* or \*FAIL\* and the Rule Status cell for the corresponding dataview is set to Active. The elseif block is adjusted as follows:

elseif $(rulestat) = "Active" and value like "*NOT_FOUND*" or value like "*FAIL*" then

Below is the adjusted rule block:

FKM status rule block

Notice each dataview now sets the status to critical based on the Rule Status value as well.

FKM Testing Sampler output

Beta FKM output

To check the Rule XML, see FKM_Status_Rule.xml

["Geneos"] ["Geneos > Gateway"] ["FAQ"]

Was this topic helpful?