Hiding classes in the CMDB

saxon
Kilo Explorer

Hi folks,

I'd like to hide a lot of classes from the CMDB as it is listed in my Incident, Change, and Problem pick lists.   I tried creating a Reference Qualifier, but the query that specified all of the classes I wanted to hide was way, (way!) too long for the allowable field length.  

It seems like I should be able to create a query or an index of the CMDB which is called instead of "all items" for these pick list.   But I'm unaware of how to do this.

I'd like any newly discovered CI in any of these classes to be functionally invisible, but any CI from any other class to be visible.   Of course, there are some in this list that will be important for other functions (cmdb_ci_windows_service is a prime example).  


I can't imagine I'm the only one who's trying to deal with this.   Also, if anyone has session or speaker recommendations for Knowledge15 that might apply to this problem, please feel free to suggest those here.

Below is a preliminary list of the classes I want to hide.  

cmdb_ci_network_adapter

cmdb_ci_ip_address

cmdb_ci_windows_service

cmdb_ci_db_mssql_catalog

cmdb_ci_disk

cmdb_ci_memory_module

cmdb_ci_print_queue

cmdb_ci_spkg

cmdb_ci_win_cluster_resource

dscy_route_next_hop

dscy_switchport

dscy_route_interface

dscy_swtch_fwd_rule

cmdb_ci_dns_name

cmdb_ci_pdu_outlet

cmdb_ci_ups_input

cmdb_ci_ups_alarm

cmdb_ci_ups_output

dscy_router_interface

cmdb_ci_hyper_v_rpool_comp

cmdb_ci_desktop_software

cmdb_ci_cluster_vip

11 REPLIES 11

Yes the function must return query only .. But the restriction of query size doesn't apply here... From your table, form the query to filter out the unwanted classes. Right click and do a copy query.. Return that query from the filter.


Kalaiarasan P



From all of the posts, I've found/updated this script that filters the defined classes, but how would you flip it to filter OUT the defined classes like Stephen is looking for?



function FilterCIs(){


var ciClassListProperty = 'cmdb_ci_network_adapter;cmdb_ci_ip_address;cmdb_ci_windows_service';


var ciArr = ciClassListProperty.split(';');


var str = '';


for (i=0; i<ciArr.length;i++) {


if (str == ''){


    str += 'sys_class_name='+ciArr[i];


    } else {


    str += '^ORsys_class_name='+ciArr[i];


    }


}


return str;


}



Thanks,


-Jon


Not sure if I understand this the right way but whatever class you want to be available, you can specify those in the string 'ciClassListProperty'.



Suppose you want to exclude certain classes, you can still play around the above script and get it done.



function FilterCIs(){


var ciClassListProperty = 'cmdb_ci_network_adapter;cmdb_ci_ip_address;cmdb_ci_windows_service';


var ciArr = ciClassListProperty.split(';');


var str = '';


for (i=0; i<ciArr.length;i++) {


if (str == ''){


  str += 'sys_class_name!='+ciArr[i];


    } else {


    str += '^sys_class_name!='+ciArr[i];


    }


}


return str;


}



Note the part in bold to exclude classes..


That was it... thanks Kalaiarasan P! The "!" and the "OR".


Kuldeep Kumavat
Mega Guru

Hi Stephen,



We also had a big list of Classes to be hidden from the users.


We created a new field on the cmdb_ci table and set the value of this field to true - for the classes which need to be visible and false - for the classes which needed to be hidden.


We wrote a before query BR on the cmdb_ci table which would hide all the CIs which are having this field value as false.



You will need to set the value of this field for all your CIs in CMDB for the first time manually.


In addidtion you need to write a BR to set the values for the CIs accordingly for the classes to be hidden/displayed to incorporate new CIs getting added to your CMDB.



Once, you are done with the setup it is very very easy to maintain - if you want to include/exclude any Class or even if you want to display only few specific CIs in a particular class.



Regards,


Kuldeep