Azure/AzureDatabricksBestPractices

Change init script to text

scotty-tarvan opened this issue · 0 comments

I revisited this issue a few times as I went through many steps to try and get log analytics working.

To cut a long story short you can find the correct init script by going to log analytics -> advanced settings -> connected sources -> linux servers, see at bottom there will be a link to DOWNLOAD AND ONBOARD AGENT FOR LINUX, use that link to create an init script that looks like this:

script = """
sed -i "s/^exit 101$/exit 0/" /usr/sbin/policy-rc.d 
wget https://raw.githubusercontent.com/Microsoft/OMS-Agent-for-Linux/master/installer/scripts/onboard_agent.sh && sh onboard_agent.sh -w <YOUR-ID> -s <YOUR-KEY> -d opinsights.azure.com
"""

#save script to databricks file system so it can be loaded by VMs
dbutils.fs.put("/databricks/log_init_scripts/configure-omsagent.sh", script, True)

The other parts of the init script shown in the document are not required i.e. you do not need to do a restart as in:

sudo su omsagent -c 'python /opt/microsoft/omsconfig/Scripts/PerformRequiredConfigurationChecks.py' 
/opt/microsoft/omsagent/bin/service_control restart <YOUR-ID>