How to reinstall Operations Management Suite (OMS) Agent for Linux

This article describes the steps that you can take to remove the Operations Management Suite (OMS) Agent for Linux and then reinstall it.

Original product version:   Azure Automation
Original KB number:   4131455


Before you reinstall the OMS Agent, make sure that you have the following items:

  • A login account to the Linux-computer that has the ability to use sudo.
  • The workspace identifier and primary key of your OMS workspace. To get this, open the Azure portal, navigate to Log Analytics, select your workspace, and then select Advanced settings. The blade that open includes a property that's named Workspace Id and another that's named Primary Key.

Reinstall OMS Agent for Linux

To remove the existing agent and then install the new agent, follow these steps:

  1. Connect to the Linux computer, and then open a terminal session.

  2. To download the desired script, run the following command:

  3. Run sudo sh --purge. This downloads the most recent version of the installation script and runs the uninstallation operation that will remove all existing agent components.

  4. Remove the /etc/opt/microsoft/omsagent and /var/opt/microsoft/omsagent folders.

  5. Run the following command:

    sudo sh -w <workspaceid> -s <primarykey>
    • In this command, replace <workspaceid> and <primarykey> with the appropriate values from the actual Azure workspace ID and primary key, respectively.

    • If you're using a cloud service other than Azure public cloud, you must add the -d parameter that identifies the domain that's to be used. For example, if you use the Azure US Government cloud, run the following command:

      sudo sh -w workspaceid -s primarykey -d

Verify the agent reinstallation

To verify that the installation finished successfully, you can run a script that initiates a check of the agent. To initiate the check, follow these steps:

  1. Connect to the Linux computer, and then open a terminal session.

  2. Run the following command

    sudo -u omsagent /opt/microsoft/omsconfig/Scripts/

If the script runs successfully, you should get output that resembles the following:

instance of PerformRequiredConfigurationChecks