turbot/servicenow
steampipe plugin install servicenow

Table: servicenow_cmdb_ci - Query ServiceNow Configuration Items using SQL

ServiceNow Configuration Items (CI) are service assets tracked in the Configuration Management Database (CMDB). They include tangible assets like hardware and software, as well as intangible assets like policies, agreements, and services. CIs provide information about the assets' configurations and the relationships between them.

Table Usage Guide

The servicenow_cmdb_ci table provides insights into the Configuration Items (CI) within ServiceNow's Configuration Management Database (CMDB). As a DevOps engineer, you can explore CI-specific details through this table, including CI classes, states, and associated metadata. Utilize it to uncover information about CIs, such as those related to specific services, the relationships between CIs, and the verification of CI states.

Examples

List CMDB Configuration Item name, asset tag, serial number

Explore the inventory of Configuration Items (CIs) to keep track of their names, asset tags, and serial numbers. This query is particularly useful for auditing and asset management purposes.

select
ci.name,
ci.asset_tag,
ci.serial_number
from
servicenow_cmdb_ci ci
limit
100;
select
ci.name,
ci.asset_tag,
ci.serial_number
from
servicenow_cmdb_ci ci
limit
100;

Retrieve a list of all CIs that are currently down or experiencing issues

Explore which Configuration Items (CIs) are currently not functioning optimally or facing issues. This can aid in quickly identifying problematic areas and taking necessary corrective actions.

select
sys_id,
name,
sys_class_name,
short_description
from
servicenow_cmdb_ci
where
operational_status != '1';
select
sys_id,
name,
sys_class_name,
short_description
from
servicenow_cmdb_ci
where
operational_status != '1';

Identify all CIs that have been recently modified or updated

Explore which Configuration Items (CIs) have undergone changes in the past week. This is useful in understanding recent system changes and potentially identifying any unexpected or unauthorized modifications.

select
sys_id,
name,
sys_class_name,
short_description
from
servicenow_cmdb_ci
where
sys_updated_on > now() - interval '7 days';
select
sys_id,
name,
sys_class_name,
short_description
from
servicenow_cmdb_ci
where
sys_updated_on > datetime('now', '-7 days');

Get a list of all CIs that have been retired or decommissioned

Explore which Configuration Items (CIs) have been decommissioned or retired. This can be useful in assessing the lifecycle of your resources and planning for replacement or upgrades.

select
sys_id,
name,
sys_class_name,
short_description
from
servicenow_cmdb_ci
where
install_status = '7';
select
sys_id,
name,
sys_class_name,
short_description
from
servicenow_cmdb_ci
where
install_status = '7';

Find all CIs that are currently undergoing maintenance or repair

Explore which Configuration Items (CIs) are currently under maintenance or repair. This is useful in managing system downtime and planning resource allocation.

select
sys_id,
name,
sys_class_name,
short_description
from
servicenow_cmdb_ci
where
sys_id in (
select
cmdb_ci
from
servicenow_task
where
state in (3, 4)
and short_description like '%maintenance%'
);
select
sys_id,
name,
sys_class_name,
short_description
from
servicenow_cmdb_ci
where
sys_id in (
select
cmdb_ci
from
servicenow_task
where
state in (3, 4)
and short_description like '%maintenance%'
);

Retrieve all CIs with a specific serial number

Explore which Configuration Items (CIs) share a common serial number. This can be useful in tracking and managing assets within your IT environment.

select
sys_id,
name,
sys_class_name,
short_description
from
servicenow_cmdb_ci
where
serial_number = '123456789';
select
sys_id,
name,
sys_class_name,
short_description
from
servicenow_cmdb_ci
where
serial_number = '123456789';

Schema for servicenow_cmdb_ci

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
assetjsonbThe asset associated with the configuration item.
asset_tagtextUnique identifier for the asset.
assignedtimestamp with time zoneFlag indicating if the configuration item is assigned.
assigned_tojsonbPerson or group assigned to the configuration item.
assignment_groupjsonbGroup assigned to the configuration item.
attestation_scorebigintScore representing the attestation status of the configuration item.
attestation_statustextStatus of attestation for the configuration item.
attestedbooleanFlag indicating if the configuration item is attested.
attested_byjsonbPerson who attested the configuration item.
attested_datetimestamp with time zoneDate when the configuration item was attested.
attributestextAdditional attributes associated with the configuration item.
business_unitjsonbBusiness unit associated with the configuration item.
can_printbooleanFlag indicating if the configuration item can be printed.
categorytextCategory of the configuration item.
change_controljsonbChange control information for the configuration item.
checked_intimestamp with time zoneFlag indicating if the configuration item is checked in.
checked_outtimestamp with time zoneFlag indicating if the configuration item is checked out.
commentstextComments or notes related to the configuration item.
companyjsonbCompany associated with the configuration item.
correlation_idtextID used to correlate related configuration items.
costdouble precisionCost of the configuration item.
cost_cctextCost center associated with the configuration item.
cost_centerjsonbCost center associated with the configuration item.
delivery_datetimestamp with time zoneDate of delivery for the configuration item.
departmentjsonbDepartment associated with the configuration item.
discovery_sourcetextSource of discovery for the configuration item.
dns_domaintextDNS domain associated with the configuration item.
duetimestamp with time zoneDue date for the configuration item.
due_intextTime remaining for the configuration item.
duplicate_ofjsonbWhich CI is this a duplicate of.
environmenttextEnvironment associated with the configuration item.
fault_countbigintNumber of faults associated with the configuration item.
first_discoveredtimestamp with time zoneDate when the configuration item was first discovered.
fqdntextFully Qualified Domain Name (FQDN) of the configuration item.
gl_accounttextGeneral ledger account associated with the configuration item.
install_datetimestamp with time zoneDate when the configuration item was installed.
install_statusbigintInstallation status of the configuration item.
invoice_numbertextInvoice number associated with the configuration item.
ip_addresstextIP address of the configuration item.
justificationtextJustification for the configuration item.
last_discoveredtimestamp with time zoneMost recent discovery.
lease_idtextID of the lease associated with the configuration item.
life_cycle_stagejsonbLife cycle stage of the configuration item.
life_cycle_stage_statusjsonbThe specific status of a CI within its life cycle phase.
locationjsonbLocation of the configuration item.
mac_addresstextMAC address of the configuration item.
maintenance_schedulejsonbMaintenance schedule associated with the configuration item.
managed_byjsonbPerson responsible for managing the configuration item.
managed_by_groupjsonbGroup responsible for managing the configuration item.
manufacturerjsonbManufacturer of the configuration item.
model_idjsonbID of the model associated with the configuration item.
model_numbertextModel number of the configuration item.
monitorbooleanFlag indicating if the configuration item is monitored.
nametextName of the configuration item.
operational_statusbigintOperational status of the configuration item.
order_datetimestamp with time zoneDate when the configuration item was ordered.
owned_byjsonbPerson or group that owns the configuration item.
po_numbertextPurchase order number associated with the configuration item.
purchase_datetextDate when the configuration item was purchased.
schedulejsonbSchedule associated with the configuration item.
serial_numbertextSerial number of the configuration item.
short_descriptiontextShort description of the configuration item.
skip_syncbooleanFlag indicating if synchronization should be skipped for the configuration item.
start_datetimestamp with time zoneStart date associated with the configuration item.
subcategorytextSubcategory of the configuration item.
support_groupjsonbSupport group responsible for the configuration item.
supported_byjsonbPerson or group responsible for supporting the configuration item.
sys_class_nametextName of the configuration item's class.
sys_class_pathtextPath of the configuration item's class.
sys_created_bytextUser who created the configuration item.
sys_created_ontimestamp with time zoneDate and time when the configuration item was created.
sys_domainjsonbDomain associated with the configuration item.
sys_domain_pathtextPath of the configuration item's domain.
sys_idtextUnique identifier (Sys ID) of the configuration item.
sys_mod_countbigintNumber of times the configuration item has been modified.
sys_updated_bytextUser who last updated the configuration item.
sys_updated_ontimestamp with time zoneDate and time when the configuration item was last updated.
unverifiedbooleanFlag indicating if the configuration item is unverified.
vendorjsonbVendor associated with the configuration item.
warranty_expirationtextExpiration date of the warranty for the configuration item.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- servicenow

You can pass the configuration to the command with the --config argument:

steampipe_export_servicenow --config '<your_config>' servicenow_cmdb_ci