Ever wondered how to get the memory utilization metrics on Google Cloud VM?
While working with the cloud providers, I have seen sometimes Memory metrics not available in the monitoring dashboard. I always wanted to know & find the easiest way to get real-time data metrics of Linux VM.
This is how the default GCM VM observability will look like. Do you see there is no data under “Memory Utilization” section?
After looking around & checking on the internet, I came across two possible ways to get the memory metrics.
1. Using Ops Agent
Formerly known as Stackdriver, you can install Ops Agent on the VM which starts pushing memory, disk, logs and many other metrics.
curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh
sudo bash add-google-cloud-ops-agent-repo.sh --also-install
- If using Windows, you can run the below command in PowerShell
(New-Object Net.WebClient).DownloadFile("https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.ps1", "$add-google-cloud-ops-agent-repo.ps1")
Invoke-Expression "$add-google-cloud-ops-agent-repo.ps1 -AlsoInstall"
Note: It is also possible to install an agent through Google Cloud Console by clicking the INSTALL button next to “Requires Ops Agent” shown under “Memory Utilization” section.
- Once an agent is installed & running, metrics will be available in the observability tab of VM.
2. Using Netdata
If you need more than monitoring metrics, you can use lightweight software monitoring software such as Netdata.
Netdata is an open-source real-time monitoring tool that collects the metrics from the system & application. It is agent-based, which means you need to install it on your server. It supports all major UNIX distro such as Ubuntu, CentOS, Debian, and container platforms like Docker, Kubernetes.
- To install Netdata on Linux VMs, we can use this kickstart command.
wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --disable-telemetry
- Once the service is installed, you can check the Netdata dashboard which listens on port 19999
I hope this gives you a quick idea about monitoring the memory of Google Cloud VM. Next, you can also check out the best cloud-based server monitoring solutions.