UIM - NAS Database Query and Email Output Script
search cancel

UIM - NAS Database Query and Email Output Script

book

Article ID: 186976

calendar_today

Updated On:

Products

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) - Email Gateway (broadcom.com)

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 - The nas Auto-Operator Tab (broadcom.com)

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
 

NAS IM Configuration, The Scripts Tab - The nas Auto-Operator Tab (broadcom.com)

Attachments

1584697921313__dbquery_and_email.txt get_app