This tool will automate the creation of Datalink connectors (Local or SFTP) based off of a maintained CSV list of files.
Installation:
- This script is written in Python and so a Python environment is required before utilizing this tool. Please see Setting up a Python Environment
- Download the .ZIP file attached to this document and Unzip the contents
- This tool requires only one Python module that does not come as part of the standard library. In order to install this module, open your command prompt and enter the following command:
Tool Contents
The ZIP file contains the following directory structure that houses the tool:
Datalink Automation Tool
| - settings
| - | - metadata.txt
| - | - templateList.csv
| - log
| - | - activityLog.csv
| - | - failureLog.csv
| - main.py
| - rest_utils.py
| - dataload.py
The main.py file is the meat of the tool. The rest_utils.py and dataload.py files house code utilized by the main.py file.
The 'log' subdirectory houses two files that contain information regarding the last run of the tool.
The 'settings' subdirectory houses two files that configure how the tool runs.
- metadata.txt contains data that will be shared across all connectors created by the script
- templateList.csv contains the list of connectors to be created or deleted
General Usage
Tool Configuration
To configure the tool, you will need to modify the two files within the 'settings' subdirectory.
metadata.txt
This file contains metadata that will be utilized across all connectors created in a single execution of the tool. The following information will be necessary for the script to run without error.
Datalink General Info
DATALINK_MANAGER - The URL to the Datalink Manager
DATALINK_AGENT - The name of the Datalink Agent
Apptio Destination
INSTANCE_APPTIO - The Apptio instance
NAME_DOMAIN - The Domain within the Apptio instance
NAME_PROJECT - The Project within the Domain
Scheduling Information
SCHEDULE_INTERVAL - Frequency of Schedule. Expected values: MANUAL, DAILY, WEEKLY
SCHEDULE_WEEKDAY - Day of execution. Necessary only for WEEKLY interval
SCHEDULE_HOUR - Hour in UTC Time Zone of execution. Values: 0-23
SCHEDULE_MINUTE - Minute in Hour of execution. Values: 0-59
Apptio Domain Credentials
USERNAME_APPTIO - Username of Apptio Project Credentials
PASSWORD_APPTIO - Password for Apptio Project Credentials
Connector Name Prefix
CONN_PREFIX - Prefix that will be applied to the front of the Connector Name
Connector Type
CONN_TYPE - Type of Connector to be created. Expected values: LOCAL, SFTP
File Source Information
DIR_FILE - Source directory location of file
DIR_ARCHIVE - Directory location to move uploaded files
SFTP Information (if using SFTP Connector)
SFTP_SERVER - SFTP Instance
SFTP_USERNAME - Username for SFTP Instance
SFTP_PKPATH - Path on SFTP Server to Private Key
SFTP_PASSPHRASE - Passphrase to Private Key stored on SFTP Server
templateList.csv
This file contains a list of the connectors to be managed by the script. There are 3 columns of data that need to be provided:
Filename - The filename pattern to be utilized for the connector. Date information is expected within the pattern. For more information please refer to Datalink Filename Patterns
Table Name - The target table within the designated Apptio project
Delete Flag - Binary flag to instruct the tool to delete an existing connector. Values: 0 = False; 1 = True
Connector Creation
- Configure the metadata.txt and templateList.csv files under the 'settings' sub-directory
- Open Command Prompt and navigate to the directory where the "Datalink Automation Tool" directory where the tool was extracted
- Run the following command:
The script will display the current step along with a time stamp showing how long the script has been running.