-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Compute][Feature]az vm create: Support default data source settings for vm workspace #11704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mmyyrroonn
merged 8 commits into
Azure:dev
from
mmyyrroonn:fix-data-source-settings-for-vm-workspace
Dec 31, 2019
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -915,8 +915,10 @@ def build_av_set_resource(cmd, name, location, tags, platform_update_domain_coun | |
| return av_set | ||
|
|
||
|
|
||
| # used for log analytics workspace | ||
| def build_vm_mmaExtension_resource(_, vm_name, location): | ||
| def build_vm_linux_log_analytics_workspace_agent(_, vm_name, location): | ||
| ''' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Triple double-quoted strings should be used for docstrings. |
||
| This is used for log analytics workspace | ||
| ''' | ||
| mmaExtension_resource = { | ||
| 'type': 'Microsoft.Compute/virtualMachines/extensions', | ||
| 'apiVersion': '2018-10-01', | ||
|
|
@@ -941,8 +943,10 @@ def build_vm_mmaExtension_resource(_, vm_name, location): | |
| return mmaExtension_resource | ||
|
|
||
|
|
||
| # used for log analytics workspace | ||
| def build_vm_daExtensionName_resource(_, vm_name, location): | ||
| def build_vm_daExtension_resource(_, vm_name, location): | ||
| ''' | ||
| This is used for log analytics workspace | ||
| ''' | ||
| daExtensionName_resource = { | ||
| 'type': 'Microsoft.Compute/virtualMachines/extensions', | ||
| 'apiVersion': '2018-10-01', | ||
|
|
@@ -958,3 +962,31 @@ def build_vm_daExtensionName_resource(_, vm_name, location): | |
| daExtensionName_resource['location'] = location | ||
| daExtensionName_resource['dependsOn'] = ['Microsoft.Compute/virtualMachines/{0}/extensions/OMSExtension'.format(vm_name)] # pylint: disable=line-too-long | ||
| return daExtensionName_resource | ||
|
|
||
|
|
||
| def build_vm_windows_log_analytics_workspace_agent(_, vm_name, location): | ||
| ''' | ||
| This function is used for log analytics workspace. | ||
| ''' | ||
| mmaExtension_resource = { | ||
| 'type': 'Microsoft.Compute/virtualMachines/extensions', | ||
| 'apiVersion': '2018-10-01', | ||
| 'properties': { | ||
| 'publisher': 'Microsoft.EnterpriseCloud.Monitoring', | ||
| 'type': 'MicrosoftMonitoringAgent', | ||
| 'typeHandlerVersion': '1.0', | ||
| 'autoUpgradeMinorVersion': 'true', | ||
| 'settings': { | ||
| 'workspaceId': "[reference(parameters('workspaceId'), '2015-11-01-preview').customerId]", | ||
| 'stopOnMultipleConnections': 'true' | ||
| }, | ||
| 'protectedSettings': { | ||
| 'workspaceKey': "[listKeys(parameters('workspaceId'), '2015-11-01-preview').primarySharedKey]" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| mmaExtension_resource['name'] = vm_name + '/MicrosoftMonitoringAgent' | ||
| mmaExtension_resource['location'] = location | ||
| mmaExtension_resource['dependsOn'] = ['Microsoft.Compute/virtualMachines/' + vm_name] | ||
| return mmaExtension_resource | ||
238 changes: 238 additions & 0 deletions
238
src/azure-cli/azure/cli/command_modules/vm/_workspace_data_source_settings.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,238 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| from collections import OrderedDict | ||
|
|
||
| linux_performance_collection_properties = [ | ||
| { | ||
| 'state': 'Enabled' | ||
| } | ||
| ] | ||
|
|
||
| linux_performance_object_properties = [ | ||
| { | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "Memory", | ||
| "performanceCounters": [ | ||
| { | ||
| "counterName": "Available MBytes Memory" | ||
| }, | ||
| { | ||
| "counterName": "% Used Memory" | ||
| }, | ||
| { | ||
| "counterName": "% Used Swap Space" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "Processor", | ||
| "performanceCounters": [ | ||
| { | ||
| "counterName": "% Processor Time" | ||
| }, | ||
| { | ||
| "counterName": "% Privileged Time" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "Logical Disk", | ||
| "performanceCounters": [ | ||
| { | ||
| "counterName": "% Used Inodes" | ||
| }, | ||
| { | ||
| "counterName": "Free Megabytes" | ||
| }, | ||
| { | ||
| "counterName": "% Used Space" | ||
| }, | ||
| { | ||
| "counterName": "Disk Transfers/sec" | ||
| }, | ||
| { | ||
| "counterName": "Disk Reads/sec" | ||
| }, | ||
| { | ||
| "counterName": "Disk Writes/sec" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "Network", | ||
| "performanceCounters": [ | ||
| { | ||
| "counterName": "Total Bytes Transmitted" | ||
| }, | ||
| { | ||
| "counterName": "Total Bytes Received" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
|
|
||
| linux_syslog_collection_properties = [ | ||
| { | ||
| 'state': 'Enabled' | ||
| } | ||
| ] | ||
|
|
||
| linux_syslog_properties = [ | ||
| { | ||
| "syslogName": "syslog", | ||
| "syslogSeverities": [ | ||
| { | ||
| "severity": "notice" | ||
| }, | ||
| { | ||
| "severity": "info" | ||
| }, | ||
| { | ||
| "severity": "debug" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
|
|
||
| windows_event_properties = [ | ||
| { | ||
| "eventLogName": "System", | ||
| "eventTypes": [ | ||
| { | ||
| "eventType": "Error" | ||
| }, | ||
| { | ||
| "eventType": "Warning" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
|
|
||
| windows_performance_counter_properties = [ | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "Disk Transfers/sec", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "LogicalDisk" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "Disk Reads/sec", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "LogicalDisk" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "Bytes Total/sec", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "Network Interface" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "Available MBytes", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "Memory" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "% Free Space", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "LogicalDisk" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "Avg. Disk sec/Write", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "LogicalDisk" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "Bytes Received/sec", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "Network Adapter" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "Current Disk Queue Length", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "LogicalDisk" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "% Processor Time", | ||
| "instanceName": "_Total", | ||
| "intervalSeconds": 10, | ||
| "objectName": "Processor" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "Free Megabytes", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "LogicalDisk" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "Avg. Disk sec/Read", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "LogicalDisk" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "Bytes Sent/sec", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "Network Adapter" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "% Committed Bytes In Use", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "Memory" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "Disk Writes/sec", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "LogicalDisk" | ||
| }, | ||
| { | ||
| "collectorType": "Default", | ||
| "counterName": "Processor Queue Length", | ||
| "instanceName": "*", | ||
| "intervalSeconds": 10, | ||
| "objectName": "System" | ||
| } | ||
| ] | ||
|
|
||
| default_linux_data_sources = OrderedDict() | ||
|
|
||
| default_linux_data_sources['LinuxPerformanceCollection'] = linux_performance_collection_properties | ||
| default_linux_data_sources['LinuxPerformanceObject'] = linux_performance_object_properties | ||
| default_linux_data_sources['LinuxSyslogCollection'] = linux_syslog_collection_properties | ||
| default_linux_data_sources['LinuxSyslog'] = linux_syslog_properties | ||
|
|
||
| default_windows_data_sources = OrderedDict() | ||
|
|
||
| default_windows_data_sources['WindowsEvent'] = windows_event_properties | ||
| default_windows_data_sources['WindowsPerformanceCounter'] = windows_performance_counter_properties |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.