Commit 97862831 by Szabolcs Gelencser

Remove install diagnostics task.

parent f2688b1f
<WadCfg>
<DiagnosticMonitorConfiguration overallQuotaInMB="4096">
<DiagnosticInfrastructureLogs scheduledTransferLogLevelFilter="Warning" scheduledTransferPeriod="PT1M"/>
<PerformanceCounters scheduledTransferPeriod="PT1M">
<PerformanceCounterConfiguration counterSpecifier="\Memory\PercentUsedMemory" sampleRate="PT15S" unit="Percent">
<annotation displayName="Memory percentage" locale="en-us"/>
</PerformanceCounterConfiguration>
<PerformanceCounterConfiguration counterSpecifier="\Processor\PercentProcessorTime" sampleRate="PT15S" unit="Percent">
<annotation displayName="CPU percentage guest OS" locale="en-us"/>
</PerformanceCounterConfiguration>
<PerformanceCounterConfiguration counterSpecifier="\NetworkInterface\BytesTransmitted" sampleRate="PT15S" unit="Bytes">
<annotation displayName="Network out guest OS" locale="en-us"/>
</PerformanceCounterConfiguration>
<PerformanceCounterConfiguration counterSpecifier="\NetworkInterface\BytesReceived" sampleRate="PT15S" unit="Bytes">
<annotation displayName="Network in guest OS" locale="en-us"/>
</PerformanceCounterConfiguration>
<PerformanceCounterConfiguration counterSpecifier="\NetworkInterface\PacketsTransmitted" sampleRate="PT15S" unit="Count">
<annotation displayName="Packets sent" locale="en-us"/>
</PerformanceCounterConfiguration>
<PerformanceCounterConfiguration counterSpecifier="\NetworkInterface\PacketsReceived" sampleRate="PT15S" unit="Count">
<annotation displayName="Packets received" locale="en-us"/>
</PerformanceCounterConfiguration>
</PerformanceCounters>
<Metrics resourceId="/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$GROUP_NAME/providers/Microsoft.Compute/virtualMachines/$VM_NAME">
<MetricAggregation scheduledTransferPeriod="PT1H"/>
<MetricAggregation scheduledTransferPeriod="PT1M"/>
</Metrics>
</DiagnosticMonitorConfiguration>
</WadCfg>
...@@ -7,7 +7,6 @@ import socket ...@@ -7,7 +7,6 @@ import socket
import json import json
from decorator import decorator from decorator import decorator
import lxml.etree as ET import lxml.etree as ET
import base64
from psutil import NUM_CPUS, virtual_memory, cpu_percent from psutil import NUM_CPUS, virtual_memory, cpu_percent
...@@ -309,71 +308,6 @@ def resume(vm_name): ...@@ -309,71 +308,6 @@ def resume(vm_name):
return None return None
@celery.task @celery.task
def install_diagnostics_extension(vm_name):
"""
Install diagnostics extension on already running vm
"""
with open("miscellaneous/linux_diagnostics.xml", "rt") as linuxdf:
XmlCfg = linuxdf.read()
b64encodedXmlCfg = base64.b64encode(
XmlCfg.replace(
"$SUBSCRIPTION_ID",
SUBSCRIPTION_ID,
).replace(
"$GROUP_NAME",
GROUP_NAME,
).replace(
"$VM_NAME",
vm_name,
)
)
storage_client = azure.mgmt.storage.StorageManagementClient(
credentials,
SUBSCRIPTION_ID,
)
key_result = storage_client.storage_accounts.list_keys(
GROUP_NAME,
STORAGE_NAME,
)
settings = {
'StorageAccount': STORAGE_NAME,
'xmlCfg': b64encodedXmlCfg,
}
protected_settings = {
'storageAccountName': STORAGE_NAME,
'storageAccountKey': key_result.keys[0].value,
'storageAccountEndPoint': 'https://core.windows.net',
}
poller = compute_client.virtual_machine_extensions.create_or_update(
GROUP_NAME,
vm_name,
"LinuxDiagnostic",
azure.mgmt.compute.models.VirtualMachineExtension(
location=REGION,
publisher="Microsoft.OSTCExtensions",
virtual_machine_extension_type="LinuxDiagnostic",
type_handler_version="2.3",
auto_upgrade_minor_version=True,
protected_settings=protected_settings,
settings=settings,
),
)
try:
poller.wait()
logging.info("installed diagnostics on: '%s'" % vm_name)
except Exception, e:
logging.error("cloud not install diagnostics on '%s'" % vm_name)
raise e
@celery.task
def start(params): def start(params):
pass pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment