nas: alarm_enrichment rule

Document ID : KB000015199
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

We want an alarm_enrichment rule to lookup the device details in our CMDB based on the short name / hostname and not the FQDN.  The trouble is the source alarm contains the FQDN and the CMDB contains the short name / hostname.

 

Question:

In the "nas" Raw Configure, there is a parameter: "lookup_by_regexp".

Using a regex like "(^.*(?=(\.)))" to pull the hostname did not work.

 

Reference:

https://docops.ca.com/ca-unified-infrastructure-management-probes/ga/en/alphabetical-probe-articles/nas-alarm-server/alarm_enrichment-raw-configuration

 

How can we achieve this by other means?

Environment:
- UIM 8.5.1- MS SQL Server DBMS
Answer:

The "lookup_by_regexp" is a filter and not a substitution parameter for the CMDB database query. 

Another option would be to create a function on the cmdb database to manipulate the search parameter. 

For example: 
SET ANSI_NULLS ON 
GO 
SET QUOTED_IDENTIFIER ON 
GO 
USE [cmdb] 
GO 
SET ANSI_NULLS ON 
GO 
SET QUOTED_IDENTIFIER ON 
GO 
CREATE FUNCTION [dbo].getHostName(@string varchar(8000)) 
RETURNS varchar(8000) AS 
BEGIN 
RETURN SUBSTRING(@string, 1, CHARINDEX('.', @string) - 1) 
END 
GO 

So, a query like this: 
select name,sla_level,description,ip,os_type,origin from cm_computer_system where name = dbo.getHostName('servername.company.com') 

would return rows where name = 'servername'. 

The next step would be to modify the cmdb query in the "nas" Raw Configure. 
For example: 
select name,sla_level,description,ip,os_type,origin from cm_computer_system where name = dbo.getHostName(?) 

So, the '?' gets replaced by the search parameter.