Introduction
With the introduction of the Incorta Cloud, the customer administrator no longer has access to the backend Incorta servers. This means that certain scripting features that are delivered with the product and are accessible in on-premises installations are not accessible in cloud installations. However, this does NOT mean that scripting for Cloud installations is not possible. This document will explain how to implement running Incorta Scripting from a remote machine.
What you need to know before reading this article
- Familiarity with the scripts typically found in the <Incorta Install Path>/IncortaNode/bin directory
- Access to a Linux server within your organization with access to the Internet. This can actually also be the Data Agent machine which has likely already been installed in your environment
- Python 2, or preferably, Python 3 must be installed on the machine from where the scripts will be run. This is often not an issue on Linux given most Linux distributions automatically install Python upon installation.
- While understanding Python coding is not a requirement for running Incorta scripts, it should be understood that the programs running as part of the Incorta Scripts are executing Python programs, so knowledge of Python can often help if you are debugging a potential issue.
- Understanding Linux BASH scripting and related concepts such piping output for logging, or creating cron jobs to schedule scripts will be helpful for you to implement an effective scripting environment.
Let's Go
As mentioned in the Introduction, Incorta installations contain prewritten scripts for performing many tasks such as:
- Importing or Exporting Incorta Objects
- Synchronizing User & Group information
- Listing Objects in a Tenant
- Loading Schemas
- Synchronizing Aliases
In the cloud, the Incorta Customer Administrator no longer has access to the backend server directory that contains these scripts.
First it is important, as referenced above, that these programs (as Python scripts) are not part of the Incorta "services" running your Analytics or Loader. Instead the Python code (incorta.py) makes certain functions available for scripting using Incorta's internal API for these functions. Therefore, a Linux server with access to the internet, with the required directories copied to that machine can become a machine capable of running these scripts against the Incorta Cluster in the Cloud.
The ZIP files for the code that needs to be installed on the remote machine is attached and can be downloaded from this article.
File |
Description |
dirExport.zip |
This contains objects that are necessary for the /bin scripts to run. No scripts reside in this zip file. |
incorta_bin.zip |
This contains all of the delivered python and scripts delivered with a typical incorta install in the <Incorta Install Path>/IncortaNode/bin directory. |
Installation Instructions
- Download the two zip files to the server where you intend to run the scripts. I would recommend this to be in the /home directory of whichever user account you expect to run the scripts.
- For the user's home directory, run mkdir incorta_bin. Copy the 2 zip files to this directory.
- Unzip each of the two files
- After unzipping the files you should have a structure that looks like the following
- /home/user/incorta_bin/bin
- /home/user/incorta_bin/dirExport
- It is a requirement that the /bin and /dirExport directories reside in the same folder at the same level.
That's it! You are now capable of accessing all of the <file-name>.sh scripts delivered by Incorta in a typical install. Good Luck and happy scripting.
A Couple Helper Items
- Almost ALL of the scripts will have a line that looks something like session=`$incorta_cmd login <incorta-url> <tenant-name> <admin-id> <admin-password>`. You must enter your Incorta URL, tenant name, admin user id and password as this line will actually login to your Incorta environment.
- Then there will typically be a statement a few rows down something like: $incorta_cmd list_data_agent_logs $session <Enter Data Agent Name from Incorta UI>. In this example the $incorta_cmd is being called using the $session defined above to execute the API function defined as "list_data_agent_logs" and passing in the parameter of the Data Agent Name defined in the Incorta UI. This script would list all of the Log Files existing on the Data Agent machine.
- Some of the scripts work with a companion .properties file. LDAP synchronization is one of these scripts for example. Look to the Incorta documentation or contact support for how to configure these properties files.
- A typical crontab entry might look something like below for a process set to run every hour, sending appended screen output to a log file, and running as a background task.
0**** <username> cd /home/<username>/incorta_bin/bin && ./<script-name>.sh >> <log-name>.log 2>&1
-
- This will run the script as <username>
- Change directory to the path of the scripts
- Execute the script
- Append Std-In and Std-Out terminal messages to a log file
- Finally, if you find after unzipping and trying to execute one of the .sh scripts, you get an unable to execute error, you may have to add the "execute permissions" the the script. This can be accomplished by running the command: chmod +x <script-name>.sh.
Related Material