ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

UIM - NAS Database Query and Email Output Script

book

Article ID: 186976

calendar_today

Updated On:

Products

NIMSOFT PROBES DX Unified Infrastructure Management (Nimsoft / UIM)

Issue/Introduction

This article provides a basic script and the steps required to run database queries and send the output in email format via the NAS probe. 

Environment

Release: UIM 9.x

Component: UIM NAS

Database: MS SQL Server

Resolution

1. Configure the emailgtw probe following the probe documentation. 

emailgtw (Email Gateway) - http://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/it-operations-management/ca-unified-infrastructure-management-probes/GA/alphabetical-probe-articles/emailgtw-email-gateway.html 

Note: No active/enabled emailgtw user profile is required for the emailgtw when using this method. 

2. Open the NAS GUI -> Auto-Operator -> Scripts -> Right-click -> New, Script -> Create a new script profile using the attached script (dbquery_and_email.txt). 

Note: The following lines will need to be modified as per your configuration and requirement (<>). 

rc = database.open ("Driver={SQL Server}; Server=<db server hostname>; Database=<CA_UIM database name>; Uid=sa; Pwd=<sa pw>;")

rs = database.query("<database query>")

action.email("<to email address>","<report name used for email subject>",emailbody)

3. Run the script, confirm the query is successful and an email has been received. 

4. If required this script can be configured to run on schedule using the nas probe. More information below. 

NAS IM Configuration, The Scheduler Tab - http://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/it-operations-management/ca-unified-infrastructure-management-probes/GA/alphabetical-probe-articles/nas-alarm-server/nas-im-configuration/the-nas-auto-operator-tab.html#concept.dita_68181394ea354dade5c0e878c25c3babd80ca6a3_TheSchedulerTab 

Note: All testing should be carried out in a pre-production environment. The database query and frequency of the script schedule, may have an impact on NAS probe performance.  

Additional Information

Cannot make a database query in a nas Pre Processing script
https://knowledge.broadcom.com/external/article?articleId=123072&_ga=2.121531469.436642033.1584357263-59981893.1580292494 

NAS IM Configuration, The Scripts Tab - http://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/it-operations-management/ca-unified-infrastructure-management-probes/GA/alphabetical-probe-articles/nas-alarm-server/nas-im-configuration/the-nas-auto-operator-tab.html#concept.dita_68181394ea354dade5c0e878c25c3babd80ca6a3_TheScriptsTab 

Attachments

1584697921313__dbquery_and_email.txt get_app