Define Obsolescence rules
Prerequisite: You must be familiar with the Syntax used in Tutorials and have already created an extension.
- learning:
- Define which objects are under obsolescence, thus filtered
- level:
- Intermediate
- domains:
- XML, Constrain
- min version:
- 2.4.0
Get familiar with Obsolescence before using it.
How is it defined
-
Obsolescence is defined on a class per class basis.
-
A
obsolescence condition
is an OQL expression, using any field of the class, including those of type AttributeExternalField -
Obsolescence condition are inherited from parent classes, but can be redefined on a child class.
-
If no obsolescence condition is defined on a class and none of its parent, then objects of that class are never considered as obsolete.
- itop_design / classes / class@Organization
-
<properties> <obsolescence _delta="redefine"> <condition><![CDATA[status='inactive']]></condition> </obsolescence> </properties>
An object with its status
undefined
(= no value = ISNULL), is not
considered as obsolete by default. If you want to have
undefined
status considered as obsolete then use this
condition:- itop_design / classes / class@Organization / properties
-
<obsolescence _delta="redefine"> <condition><![CDATA[status='inactive' OR ISNULL(status)=1]]></condition> </obsolescence>
Examples
Based on object status combined with status of a parent if parent exists :
- itop_design / classes / class@Hypervisor / properties / obsolescence
-
<condition> <![CDATA[status = 'obsolete' OR (server_id != 0 AND server_id_obsolescence_flag)]]> </condition>
Adding a
sophisticated obsolescence condition may lead to exceed
the 61 tables limitation of MySQL. In such a case, the symptom is:
MySQL can only use 61 tables in a join, mysql_errno =
1116. An example of sophisticated condition is to
base the obsolescence of a Virtual Machine on the obsolescence of
its Hypervisor.
Combination of status and delay:
- itop_design / classes / class@Ticket / properties / obsolescence
-
<condition> <![CDATA[ operational_status='closed' AND ( close_date < DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 15 MONTH),'%Y-%m-%d 00:00:00') OR ( ISNULL(close_date) AND last_update < DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 15 MONTH),'%Y-%m-%d 00:00:00') ) )]]> </condition>
The above obsolescence rule
has a negative impact on query performance as query cache is
ignored because NOW() returns a date-time which is changing every
second. With MySQL 8, query cache is no more used.
2_7_0/customization/obsolescence.txt ยท Last modified:
2020/04/15 15:23 (external edit)