Batch Insights
Azure Batch Insights is a tool used to get system statistics for your Azure Batch account nodes.
Usage (New)
Create Application Insights account
- Goto the Azure portal
- Search for Application Insights
- Create or use an existing one(Application type input doesn't matter)
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
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.