Skip to content
One liners to enable Application insights on azure batch
Go Python PowerShell Shell
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode Feature: Upload disk usage (#14) May 22, 2018
docs
nvml Feature: Include GPU monitoring (#24) Dec 12, 2018
pkg Fix: Build for 64bit system (#38) Apr 17, 2019
scripts Feature: Better configuration (#34) Mar 6, 2019
.azure-pipelines.yml Fix: Build for 64bit system (#38) Apr 17, 2019
.gitignore Feature: Batch insights in go (#19) Dec 6, 2018
.style.yapf Feature: Upload disk usage (#14) May 22, 2018
LICENSE Merge pull request #1 from Azure/feature/initial Nov 20, 2017
README.md Update README.md Mar 6, 2019
centos.sh Feature: Better configuration (#34) Mar 6, 2019
go.mod Feature: Better configuration (#34) Mar 6, 2019
go.sum Feature: Better configuration (#34) Mar 6, 2019
main.go Feature: Better configuration (#34) Mar 6, 2019
nodestats.py Fix: Role name and role instance not uploaded (#15) Jun 14, 2018
ubuntu.sh Feature: Better configuration (#34) Mar 6, 2019
windows.ps1 Feature: Better configuration (#34) Mar 6, 2019

README.md

Batch Insights

Build Status

Azure Batch Insights is a tool used to get system statistics for your Azure Batch account nodes.

Usage (New)

Create Application Insights account

  1. Goto the Azure portal
  2. Search for Application Insights
  3. Create or use an existing one(Application type input doesn't matter)

Configure your Azure Batch pool start task

Set 3 environment variables in your start task. Make sure this is set as a Batch environment variable rather than exporting. Without the Batch environment variable it will not show up in Batch Explorer. Then set the start task user to be Pool Admin(Task admin might work too)

  • APP_INSIGHTS_INSTRUMENTATION_KEY: This your app insight instrumentation key

On the application insight blade in the Azure Portal

  • APP_INSIGHTS_APP_ID: This is your app insight application id

On the application insight blade in the Azure Portal

  • BATCH_INSIGHTS_DOWNLOAD_URL: This is the link to the exe to run. To find this go to the releases and get the link to the release you need

For example:

Linux

Add this to your start task

# For version 1.x of batch insights
/bin/bash -c 'wget  -O - https://raw.githubusercontent.com/Azure/batch-insights/master/scripts/1.x/run-linux.sh | bash'

# For latest version of batch insights
/bin/bash -c 'wget  -O - https://raw.githubusercontent.com/Azure/batch-insights/master/scripts/run-linux.sh | bash'

Windows

Add this to your start task

# For version 1.x of batch insights
cmd /c @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/Azure/batch-insights/master/scripts/1.x/run-windows.ps1'))"

# For latest version of batch insights
cmd /c @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/Azure/batch-insights/master/scripts/run-windows.ps1'))"

Note: The script used above just downloads the executable at the BATCH_INSIGHTS_DOWNLOAD_URL URL and run it in the background. You can download it some other way and start it separately.

Python Usage (Old)

Ubuntu

Add this command in your start task commandLine:

/bin/bash -c 'wget  -O - https://raw.githubusercontent.com/Azure/batch-insights/master/ubuntu.sh | bash'

Centos

Add this command in your start task commandLine:

/bin/bash -c 'wget  -O - https://raw.githubusercontent.com/Azure/batch-insights/master/centos.sh | bash'

Windows

cmd /c @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/Azure/batch-insights/master/windows.ps1'))"

Generic

If you already have a version of python installed you just need to download nodestats.py and install dependencies You can add this to your main script:

pip install psutil python-dateutil applicationinsights==0.11.3
wget --no-cache https://raw.githubusercontent.com/Azure/batch-insights/master/nodestats.py
python --version
python nodestats.py > batch-insights.log 2>&1 &

Configuration

See available configuration options

You can set the AZ_BATCH_INSIGHTS_ARGS environemnt variable to pass parameters to the tool. e.g. AZ_BATCH_INSIGHTS_ARGS > --disable networkIO --aggregation 5

View data

Option 1: Batch Explorer

BatchLabs is a desktop app used to manage, debug and monitor your azure batch accounts. You can download it here If you followed the getting started instruction batchlabs should show you the statistics for each of your pool.

Option 2:

Use the app insights tools to build your own query on the Azure Portal

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

You can’t perform that action at this time.