disk managment

%3CLINGO-SUB%20id%3D%22lingo-sub-2724614%22%20slang%3D%22en-US%22%3Edisk%20managment%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2724614%22%20slang%3D%22en-US%22%3E%3CP%3Ehi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20looking%20for%20way%20using%20KQL%20query%20or%20powerShell%20commands%20on%20how%20to%20automate%20capacity%20free%20space%20%25%20free%20like%20we%20get%20from%20disk%20managment%20in%20windows%20server.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EScreenshot%20for%20example%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SurbhiGupta_0-1630930712172.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F308315i6C98E8AB72D87D86%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SurbhiGupta_0-1630930712172.png%22%20alt%3D%22SurbhiGupta_0-1630930712172.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2726915%22%20slang%3D%22en-US%22%3ERe%3A%20disk%20managment%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2726915%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F720786%22%20target%3D%22_blank%22%3E%40DennesTorres%3C%2FA%3E%26nbsp%3Bthanks%20for%20looking%20into%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ei%20am%20not%20looking%20into%20any%20alert%20setup%20there%20is%20already%20powershell%20script%20giving%20CPU%2C%20memory%20info%26nbsp%3B%20in%20which%20i%20have%20to%20amend%20and%20include%20disk%20managment%20data%20also.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20extracting%20that%20i%20need%20KQL%20query%20which%20can%20give%20data%20like%20total%20disk%20capacity%20of%20drive%20in%20GB%2C%20free%20space%20etc.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20you%20are%20able%20to%20understand%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

hi,

 

I am looking for way using KQL query or powerShell commands on how to automate capacity free space % free like we get from disk managment in windows server.

 

Screenshot for example 

 

SurbhiGupta_0-1630930712172.png

 

6 Replies

@SurbhiGupta 

 

Hi,

 

I'm not sure if I completely understand what you want. What I understand you would like to create an alert based on free disk space using KQL.

 

1) You need a log analytics workspace where you will store all captured data
2) You may need to install log analytics agents on the virtual machines to collect performance counters and configure the agents to collect the disk counter

DennesTorres_0-1630975189345.png

 

3) You can create alerts based on KQL querys

 

DennesTorres_1-1630975332646.png

 

Kind Regards,

 

Dennes

@DennesTorres thanks for looking into it.

 

i am not looking into any alert setup there is already powershell script giving CPU, memory info  in which i have to amend and include disk managment data also. 

 

For extracting that i need KQL query which can give data like total disk capacity of drive in GB, free space etc.

 

Hope you are able to understand it.

Hi,

Your environment is unusual, at least, so it becomes difficult to help without a more complete explanation about your environment.

KQL means Kusto Query Language. It's being used in log analytics and/or Azure Data Explorer to handle big amounts of data, especially logs from azure services.

However, KQL will not provide any information by itself. The queries relies on log collection made by log analytics and/or data ingestion in azure data explorer.

Powershel, on the other hand, has many different uses, and it's able to collect performance counters from the machine where it's running.

You could be collecting the performance counters using powershell, no KQL. Or you could build log analytics workbooks with dashboards exposing the collected information using KQL, no powershell.

Use powershell to run KQL queries over log analytics is strange. Power BI would be easier. My guess is that you need to investigate your log analytics workspace and the agents configuration. However, it may be easier if who created this solution could explain it to you.

Kind Regards,

Dennes
@DennesTorres Everything is set up in azure environment from monitoring agents to performance counters.
i just need KQL query which can give me data like one i have attached in a screenshot.

As if now my client is logging to individual machine and going to disk management to extract drive info like capacity , free space ,%free . All he wants that from azure portal can he extract that all using KQL minimizing his effort.
i know we can use perf parameter in log analytics workspace to get data but i am not able to frame correct KQL which can give all 3 parameters that my client is looking for

at present i am using below query.

Perf
| where TimeGenerated > startofday(datetime($From)) and TimeGenerated < endofday(datetime($To))
| where CounterName == '% Free Space' or CounterName == '% Used Space'
| where InstanceName!='/mnt' and InstanceName!='/mnt/resource'
| extend Free_Disk = iff(CounterName == '% Free Space',CounterValue, 100 - CounterValue )
| summarize AvgPercentFreeSpace = avg(Free_Disk) by CounterPath, Computer, bin(TimeGenerated, $Freq), CounterName, CounterValue, InstanceName, _ResourceId
| project ResourceID = split(_ResourceId, '/')[2], TimeGenerated=format_datetime(TimeGenerated, 'dd-MM-yyyy hh:mm:ss tt'), Computer, InstanceName, AvgPercentFreeSpace"

But it is not giving total capacity of individual drives just %free is giving

i want all three parameters like in attached screenshot from perf query. Is it possible or not

Regards,
Surbhi







Hi,

1) Check the agent configuration. You can't query if the information is not there and you don't know how the agent is configured.

2) Use log analytics workspace to check the existing tables and test your query.

Kind Regards,

Dennes