Create Dynamic Groups Using SQL Functions
Applies to:
- Cenergy
Issue:
It is often helpful to create dynamic groups of clients based on date criteria. For example:
- All systems that are currently online
- All systems that have NOT connected within the last month
Resolution:
Utilize SQL date functions.
Here's an example of an SQL syntax that will give you a dynamic group that only shows you machines that are currently online.
This string can be entered as is into a group properties box.
DATEDIFF (mi, LastConnected, getdate()) < 30
The machines in this group are those that are online and that have connected within the last 30 minutes. If your agent polling interval is greater than 30 minutes, say 60 minutes, change the value to 60.
This string has been tested against an SQL database.
datediff
performs the calculationmi
refers specifically to 'minutes'getdate
retrieves the current date/time- Adjusting the last value and operand allows you to create groups based on a wide range of date criteria such as: "All systems that have NOT connected in the last month."
For more information on the Date Functions, see your SQL documentation.
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.