Auto populating category and subcategory in cmdb_ci

Suhail2297
Tera Contributor

Hello team,

I wanted to learn how category and subcategory is auto populating in cmdb_ci records....can someone please help me out?

When i checked in dictionary of those attributes then i found it as "Use dynamic value" was checked as "true" and under dynamic filter option this "gs.include("CMDBItem");var item = new CMDBItem(current);item.setCategory();" script was return.

can you please help out in understanding this script and what happens if i disable it?

Suhail2297_0-1740144701309.pngSuhail2297_1-1740144741349.png

 

1 ACCEPTED SOLUTION

Kieran Anson
Kilo Patron

Hi,

The script include CMDBItem based on data from the cmdb_categories table. For example, a windows server (cmdb_win_server) has a category of Hardware, and a SubCategory of Computer.

View solution in original post

4 REPLIES 4

Kieran Anson
Kilo Patron

Hi,

The script include CMDBItem based on data from the cmdb_categories table. For example, a windows server (cmdb_win_server) has a category of Hardware, and a SubCategory of Computer.

J Siva
Tera Sage

Hi @Suhail2297 

CMDBItem is a script include where it's checking for the category and subcategory linked to the ci record (ci class).

cmdb_categories is a table where you can get the relationship details between category/subcategory and ci class.

I hope this helps.

Regards, 

Siva

 

Suhail2297
Tera Contributor

Can you please explain that script include to me here

  1. setCategory is called by the dynamic filter
  2. If the item already has a category, it won't update the value
  3. The script then calls _getCategory() to get category information for CMDB Classes
  4. getCategory attempts to retrieve category information from the cache CMDB_CATEGORIES_CACHE which is in memory. This avoids needing to lookup on the cmdb_categories for each new CI which is an expensive operation
  5. The category and subcategory are determined based on the class of the CI, which is stored in sys_class_name. So for a windows server, this is cmdb_ci_win_server