Below steps are for VM provisioned through Azure Portal.
Step1 : In the Azure portal > select Linux virtual machine > oms extension > Please click on uninstall button
Step 2: To check status of the oms service
systemctl status walinuxagent
To stop the service
systemctl stop walinuxagent
Step 3 : Please remove old versions of the core packages (if they still exist). Please uninstall those packages:
To check the packages :
dpkg -l | grep omsagent
dpkg -l | grep omi
dpkg -l | grep scx
dpkg -l | grep auoms
Step 4: To remove the packages :
apt purge omsagent
apt purge omi
apt purge scx
apt purge auoms
Step 5 : Please check below locations and remove them if they exist:
rm -rf /var/lib/waagent/Microsoft.EnterpriseCloud.Monitoring.OmsAgentForLinux-1.14.9/*
rm -rf /var/opt/omi
rm -rf /var/opt/microsoft/omsagent/LAD/
rm -rf /etc/opt/microsoft/omsagent
rm -rf /etc/opt/omi
rm -rf /var/opt/microsoft/omsagent
chmod +x ./onboard_agent.sh
sudo ./onboard_agent.sh --purge
Before start the service please check if there is any process that still running :
ps -ef | grep -i omi
ps -ef | grep -i oms
To stop the service << if the service is running incase then only execute it >>
systemctl stop walinuxagent
Let me know if you have any questions.