如何通过csv文件将azure vm的cpu使用量提供给本地机器 可能吗..? 示例:-i希望获得当前CPU使用率为50%。
我可以使用单一任务 示例:task1 = 0.20 TASK2 = 6.98 但我正在寻找完整的东西 任何人都可以帮助我
我能够在基本机器中获得CPU使用率 " wmic cpu get loadpercentage" 像我一样尝试azure vm
先谢谢 吉瑞
答案 0 :(得分:0)
我们可以使用此命令来获取CPU使用率:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div style="text-align:center;">
<button href="scan" id="realScanButton" type="button">Scan Network</button>
</div>
此外,如果您想远程运行此脚本,我们可以使用Winrm运行它并将其复制到本地PC:
data.forEach(function(datum) {
let countryList = $('[data-countryname='+datum.countryname+']');
if(countryList.length === 0) {
let newLabel = document.createElement('label');
let newList = document.createElement('ul');
$(newLabel).html(datum.countryname);
$(newList).attr('data-countryname',datum.countryname);
$('body').append(newLabel);
$('body').append(newList);
countryList = newList;
}
let newListItem = document.createElement('li');
$(newListItem).html(datum.cityname);
countryList.append(newListItem);
})
顺便说一下,这是$cpu = gwmi win32_Processor
$Havecpu = "{0:0.0} %" -f $cpu.LoadPercentage
$Havecpu
脚本:
$username = 'user'
$pass = ConvertTo-SecureString -string 'password' -AsPlainText -Force
$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $pass
$s = New-PSSession -ConnectionUri 'http://xx.xx.xx.xx:5985' -Credential $cred -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck)
Invoke-Command -Session $s -ScriptBlock {powershell c:\test.ps1 > c:\jason2.csv}
Copy-Item -Path C:\jason2.csv -Destination D:\test\test12.csv -fromSession $s