How to use a path variable to snooze/unsnooze a managed entity via rules
Create a custom toolkit dataview listing the managed entity name and snooze status. Next, set up an action for the /SNOOZE:manual and /SNOOZE:unsnooze internal commands. Then, create a rule that uses a path variable in the path alias to reference the snooze status listed in the toolkit dataview. Set up the rule block to trigger the snooze action based on the referenced path alias value.
Create a custom toolkit dataview listing the managed entity name and snooze status Copied
In this example, a toolkit dataview called Managed Entity Status lists the managed entity name and snooze status. Notice the state tree shows the managed entities by the same name. Currently, the DashboardTraining\_ME managed entity is snoozed while the localhost and My Geneos Application managed entities are in critical state.
Set up an action for the /SNOOZE:manual and /SNOOZE:unsnooze internal commands Copied
For the rule to snooze and unsnooze based on the snooze status listed in the Managed Entity Status dataview, an action needs to be set up to call these snooze commands.
An action called to snooze ME uses the /SNOOZE:manual internal command to do a manual snooze. Notice this internal command has target argument 1 set with a static value that says snoozing via rule. This argument is used to set a comment when snoozing the data item.
An action called to unsnooze ME uses the /SNOOZE:unsnooze internal command to unsnooze a data item.
Create a rule that uses a path variable in the path alias to reference the snooze status listed in the toolkit dataview Copied
In this example, a rule called snoozing\_unsnoozing\_ME with the target xpath is set to /geneos/gateway/directory/probe/managedEntity so it targets every managed entity in the Gateway.
To create a path variable that will grab the rule target’s managed entity name, do the following steps:
- Go to the Advanced tab in Rules and click Add new in the Path variables section. This path variable can be called
rowName. - Under the Value section, remove the value
trueand right-click on the white space of the Value section. - Select Target names > managedEntityName.
To add the above path variable to the path alias for the “Snooze Status” column in the “Managed Entity Status” dataview, follow these steps:
Note this is how we match our rule target’s managed entity name with the corresponding “Managed Entity” row to grab its “Snooze Status” value.
- Go to the Advanced tab in Rules and click Add new in the Path alias section.
- Name the path alias
snoozed\_ME. - Drag and drop the
Snooze Statuscell from any row in theManaged Entity Statusdataview to the xpath field. - Click the EDIT button next to the xpath.
- Hover over the Row element and click EDIT.
- In the Element Properties window, set the name to
$rowName. - Click the OK button in the Edit Path window.
Note
This is how we match our rule target’s managed entity name with the corresponding managed entity row to grab itsSnooze Statusvalue.
Set up the rule block to trigger the snooze action based on the referenced path alias value Copied
The following rule will run the to snooze ME action if the path alias value referencing the Snooze Status column of the managed entity has a value like Snooze. The elseif statement runs the to unsnooze ME action if the path alias referencing the Snooze Status column of the managed entity has a value like Unsnooze.
This configuration results in the DashboardTraining\_ME managed entity becoming unsnoozed, while the localhost and My Geneos Application managed entities are in a snoozed state.
For more information about constructing and configuring paths, see Path editor and Geneos XPaths.