Can discovery populate listener_name in MSSQL discovery

Neel10
Tera Guru

I am looking to populate listener_name field in the MS SQL instance table. Is it to possible configure discovery to populate this field while discovering sql servers?

Thanks

Neel

1 ACCEPTED SOLUTION

SiD2
ServiceNow Employee
ServiceNow Employee

Hi Neel,

I guess OOB MSSQL pattern doesn't populate this field, but you can add an extension section to the pattern and populate it.

Let me know if you need assistance with this.

 

Please mark the appropriate responses as Correct/Helpful so that this thread gets closed and helps others with the same question in the future.

Please mark Helpful / Accept Solution so that it helps others with similar questions.

View solution in original post

13 REPLIES 13

Jaya5
Tera Contributor

Hi Neel, did you developed these changes, if yes, can you please share the screens shots with steps. The same will help all to achieve the same.

Hi Jaya, Sorry this was a long time ago and I do not have screenshots to share, nor do I remember the command. 

 

But if it helps, create an extension section, 

1. Create a step to run the command.

2. Capture the output in a variable.

3. Parse the variable and store onto the target field.

Jaya5
Tera Contributor

At least please help me to know that the command  you have taken from the SQL end or Windows. 

njtwite
Tera Contributor

Look at MSSQL db on windows pattern -> Collect MSSQL Cluster Info - MSSQL Cluster' extension section.

step 16 and 17 contain the commands that will get you ag listener and listener ip.

16 Get availability group info from SQL
2025-04-15 09:18:55: Executing WMI command on host: x.x.x.69, command: sqlcmd -Stcp:x.x.x.69,1433 -Kreadonly -h-1 -E -Q"select avg.name, agl.dns_name, agi.ip_address, agi.state from sys.availability_group_listener_ip_addresses agi inner join sys.availability_group_listeners agl on agi.listener_id = agl.listener_id inner join sys.availability_groups avg on avg.group_id = agl.group_id where agi.state=1"