question

VSMadhusudanCognizant-6502 avatar image
0 Votes"
VSMadhusudanCognizant-6502 asked tbgangav-MSFT rolled back

How to setup azure alert when Disk Space is 90% for a linux VM

Hi,

I'm trying to build an alert in Azure for my Linux VM. I want to understand which query to run to trigger an alert when the disk space is 90%. I refered several examples in this forum and outside. Most of them are for a Windows VM. I want to know if the same works for Linux as well.

I would also want an alert when /var or /opt directories in Linux VM have reached 90% capacity.

Please help

azure-monitor
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @VSMadhusudanCognizant-6502,

Welcome to Microsoft Q&A!
The “office-teams-linux-itpro” tag is for general questions about Teams client on Linux. Since your question is not related to Teams desktop client, I’ll remove the teams tag. Thanks for your understanding.

0 Votes 0 ·

1 Answer

AlistairRoss-msft avatar image
1 Vote"
AlistairRoss-msft answered VSMadhusudanCognizant-6502 commented

Hi @VSMadhusudanCognizant-6502

With Azure Monitor for Virtual Machines, exactly the same way as Windows, either in KQL with a query like mine in the image and text below, using Azure Monitor for Virtual Machines Guest Health

197823-diskfreespace.jpg

InsightsMetrics
| where Computer in (
"CH1-UBNTVM", //Linux
"DC10.na.contosohotels.com" // Windows
)
| where Namespace == "LogicalDisk"
| where Name == "FreeSpacePercentage"
| extend Disk=tostring(todynamic(Tags)["vm.azm.ms/mountId"])
| summarize arg_max(TimeGenerated, *) by Disk, Computer
| project TimeGenerated, Disk, Computer, Val
| where Val > 90


You can add more filters if needed and specify thresholds in Azure Monitor alerts rather than in KQL




diskfreespace.jpg (94.4 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks so much. This Helps

0 Votes 0 ·