CMDB Whisperer
Mega Sage

Yes and no.  The cmdb_ci table itself is the base table for all CI tables in the CMDB.  And the way that ServiceNow works, a record stored in a table is also stored in its parent table, and that table's parent table, and so on.  

 

So, given that Hardware (cmdb_ci_hardware) extends Configuration Item (cmdb_ci), and that Computer (cmdb_ci_computer) extends Hardware, if you ask does the Configuration Item table contain all of the Computers?  Yes, it does.  Every Computer record can be found in the Configuration Item table.  However, it doesn't contain all of the data.  Some of the data is only found in the Hardware table, and some of the data is only found in the Computer table.  Why?  Because every class (i.e. table) actually inherits all of the attributes of its parent table and can add additional attributes.  So to get Hardware-specific attributes like Hardware Status, which are not found on the base Configuration Item table, you would have to query either the Hardware or Computer table.  And to get Computer-specific attributes, like CPU Type, you would have to query the Computer table itself.

 

So, does the cmdb_ci table contain all of the company managed devices?  Yes (assuming by "managed" you mean that they are actually recorded in the CMDB.)  Doe the cmdb_ci table contain all of the company managed devices data?  Well, no, not all of the data.  If you show a list of Configuration Items, you won't be able to see the CPU Type, for example.  And therefore you won't be able to filter it either.  But if you open a record displayed in that list, it will actually take you to the appropriate table where all of the data can be found.  Below is an image showing the table structure as described.

 

CMDBWhisperer_0-1694018955439.png

 

 

That might have been a more literal answer than the question you intended to asked, but I thought it was worth explaining.


The opinions expressed here are the opinions of the author.

@CMDB Whisperer Thanks for the detailed answer.

Also, as per ServiceNow documentation, "The Configuration Management Database (CMDB) schema model is a series of connected tables that contain all the assets and business services controlled by a company and its configurations",

 

As per our requirement, we need to fetch only assets data. Is it possible to apply any filter or query to fetch only assets data from cmdb_ci table and not the business services data?


In ServiceNow the asset data is on the Asset record.  Asset records should be created automatically for new CIs.  So if you strictly want the Asset data, you need only to query the Assets themselves.  On the other hand, by definition, a Configuration Item defines how that Asset is configured and used to provide services.  And thus, any Service Management process you are using, including Incidents, Problems, Changes, etc. will always reference the Configuration Item.  The Configuration Item contains some of the Asset data as some fields are synchronized between the two tables automatically, so depending on your needs and how you are viewing the data you can certainly select what data fields to view, and you can even "dot-walk" to the Asset record and see additional fields from the Asset, even when you are viewing the CI. 

So the short answer is yes.


The opinions expressed here are the opinions of the author.

@CMDB Whisperer  are you referring to the alm_asset table?  We had referred this table before, but it does not contain few of the fields which we need like mac address or ip address. Is there a way we can get assets data along with this fields? Or can we use cmdb_ci table with any filter for assets?

That's because MAC Address and IP Address are configuration data.  They are not inherent to an asset (well arguably MAC Address may be, but it is still considered configuration data.)  Configuration data is how the device is configured.  And yes you can always dot-walk from one to the other at will.  For example, I can view a list of Configuration Items and their Asset fields (if those asset fields are not already on the CI as well, which many of them are).  If I am looking at cmdb_ci_computer records I can just dot walk via the asset attribute to see  any asset field I want to see, such as cmdb_ci.computer.asset.warranty_expiration for example. 

 

Just be careful going in the other direction because not all CI classes have the same fields, so you won't necessarily know which fields on a CI when you are coming from the asset class, so some of the fields will be empty if the class of that CI doesn't have that attribute.


The opinions expressed here are the opinions of the author.