microsoft / OMS-Agent-for-Linux

http://www.microsoft.com/oms
Other
411 stars 309 forks source link

Enable failed with exit code 33 sed: can't read /etc/opt/microsoft/omsagent/conf/omsadmin.conf: #1099

Closed manumorac closed 2 months ago

manumorac commented 5 years ago

After run : a. az vm extension delete --name OMSAgentForLinux --resource-group yourRG --vm-name yourVM b. az vm extension set --name OMSAgentForLinux --publisher Microsoft.EnterpriseCloud.Monitoring --version 1.11.15 --protected-settings '{"workspaceKey":"myWorkspaceKey"}' --settings '{"workspaceId":"myWorkspaceId"}' --resource-group yourRG --vm-name yourVM --no-auto-upgrade

I am receiving:

Enable failed with exit code 33 sed: can't read /etc/opt/microsoft/omsagent/conf/omsadmin.conf: No such file or directory Azure Resource ID updated. Workspace beef8b2f-f0c3-4ef3-8417-9ee87c2c75fe already onboarded and agent is running. Symbolic links have not been created; re-onboarding to create them info Generating certificate ... info Agent GUID is 3a70263b-5a5d-4215-8e1d-404106727c62 info Onboarding success Configure syslog... Configuring rsyslog for OMS logging Restarting service: rsyslog Configure heartbeat monitoring agent... Configure log rotate for workspace beef8b2f-f0c3-4ef3-8417-9ee87c2c75fe... INFO: Configuring OMS agent service beef8b2f-f0c3-4ef3-8417-9ee87c2c75fe ... su: warning: cannot change directory to /var/opt/microsoft/omsagent/run: Permission denied -bash: /var/opt/microsoft/omsagent/run/.bash_profile: Permission denied error Error configuring omsconfig. Error: 1

andrzej-jedrzejewski commented 4 years ago

restart your waaglinux agent

elongstreet88 commented 4 years ago

I'm also receiving this on Redhat 7.8 on fresh deploys. Re-installing/restarting seem to get it going, but initial deploys keep failing and are interfering with deployment pipelines.

balintbako commented 4 years ago

Very similar issue on fresh deploy of CentOS 7.7 (OpenLogic image)

"VM has reported a failure when processing extension 'OMSExtension'. Error message: "Enable failed with exit code 33 sed: can't read /etc/opt/microsoft/omsagent/conf/omsadmin.conf: No such file or directory Azure Resource ID updated. Workspace xxx already onboarded and agent is running. Symbolic links have not been created; re-onboarding to create them info Generating certificate ... info Agent GUID is xxx info Onboarding success Configure syslog... Configuring rsyslog for OMS logging Restarting service: rsyslog Configure heartbeat monitoring agent... Configure log rotate for workspace xxx.. INFO: Configuring OMS agent service xxxx... info Retrying configuring omsconfig by calling '/opt/microsoft/omsconfig/Scripts/OMS_MetaConfigHelper.py' with 'sudo' error Error configuring omsconfig. Error: 1\"

More information on troubleshooting is available at https://aka.ms/VMExtensionOMSAgentLinuxTroubleshoot "

shuttlek commented 4 years ago

Getting same on fresh deployments of RHEL 7.4. Breaking builds.

Akash00726 commented 4 years ago

is it resolved?

ghost commented 4 years ago

Seeing the same issue with "can't read /etc/opt/microsoft/omsagent/conf/omsadmin.conf: No such file or directory"

Looking through the paths, this folder is indeed not there - but there is a folder in "/var/opt/microsoft/omsagent/" instead

How can the agent be changed to look in the correct folder location?

vanditthakkar commented 3 years ago

I faced same issue and the solved it with following.

Root cause:

finding that "can't read /etc/opt/microsoft/omsagent/conf/omsadmin.conf" occurs when extension installation of LAD (linux diagnostics extension) starts when OMS installation is not complete. though the issue is seen specifically happening with Redhat and CentOS 7 machines

Solution:

The following sequence need to be followed for extension installations. OMS => LAD

If you are installing extensions in VM manually,

In case of ARM templates,

Make sure you add OMS extension resource name in dependsOn section of LinuxDiagnostic (LAD) along with VM as one dependency.

                {
                    "apiVersion": "2018-06-01",
                    "type": "extensions",
                    "name": "OMSExtension",
                    "location": "[resourceGroup().location]",
                    "dependsOn": [
                        "[concat('Microsoft.Compute/virtualMachines/', variables('virtualMachineName'), copyIndex())]"
                    ],
                    "properties": {
                    ...
                    }
                },
                {
                    "apiVersion": "2017-12-01",
                    "type": "extensions",
                    "name": "LinuxDiagnostic",
                    "location": "[resourceGroup().location]",
                    "dependsOn": [
                        "[concat('Microsoft.Compute/virtualMachines/', variables('virtualMachineName'), copyIndex())]",
                        "[concat('Microsoft.Compute/virtualMachines/', variables('virtualMachineName'), copyIndex(), '/extensions/OMSExtension')]"
                    ],          
                    "properties": {
                        ...
                    }
                }
mleziva commented 3 years ago

@vanditthakkar THANK YOU! I have been getting this error for months doing manual work arounds and all I had to do was change my extension installation order to install OMS before Diagnostics.

I guess until this issue is fixed (which might be a while) we should get a PR open to update the docs with a note. https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/oms-linux

hestolz commented 2 months ago

Thank you for your submission. As previously announced, the Log Analytics agent has been deprecated and has no support as of August 31, 2024. If you use the Log Analytics agent to ingest data to Azure Monitor, migrate now to the new Azure Monitor agent. As part of repo archival, open issues and pull requests will be closed.