Configure Automatic Restart of a Cloud Agent
Cloud agents are deployed to collect log and metric data from entities. For seamless collection of data, the cloud agent must not stop or fail. To keep the cloud agent running, you must configure it to automatically restart the agent service after a hardware or software failure or whenever your cloud agent host machine restarts.
Ensure that only the root user and agent installation user have write permission on the Agent_Base_Directory
. The root user and agent installation user must be the owner of the directory and it’s parent directory.
Note:
You may need to edit the examples based on your own directory structure.Linux
-
Login as the root user.
-
Create a shell script under theFor example, if the agent is installed under the
/etc/init.d
directory using any standard text editor with the following:-
#!/bin/sh
-
su — <Agent_Install_User> —c <Agent_Base_Directory>/agent_inst/bin/omcli start agent
/agent/base/cloudagent
directory and agent installation owner is emga, then the content of the shell script should be as follows:#!/bin/sh
su - “emga” -c “/agent/base/cloudagent/agent_inst/bin/omcli start agent”
-
-
Save the script file.
-
Change the permission of the file to
755
. Ensure that the owner of the script file and all the other files in the/etc/init.d
directory is root. -
Create symbolic links under
/etc/rc.d/rc2.d
,/etc/rc.d/rc3.d
,/etc/rc.d/rc5.d
, and/etc/rc.d/rc6.d
directories. Prefix the symbolic link with S and the priority level.-
To create the above symbolic link, run the following command:
ln -s /etc/init.d/S81startomcagent.sh /etc/rc2.d/S81startomcagent.sh
For example, if the file startomcagent is created under
/etc/init.d
with priority level81
, then the symbolic link will be as follows:lrwxrwxrwx 1 root root 30 Apr 2 04:39 /etc/rc.d/rc2.d/S81startomcagent.sh -> /etc/init.d/startomcagent.sh
-
-
Restart the host machine.
Solaris
-
Login as the root user.
-
Create a shell script under theFor example, if the agent is installed under the
/etc/init.d
directory using any standard text editor and paste the following into the file.-
#!/bin/sh
-
su — <Agent_Install_User> —c <Agent_Base_Directory>/agent_inst/bin/omcli start agent
/agent/base/cloudagent
directory and agent installation owner is emga, then the content of the shell script should be as follows:#!/bin/sh
su - “emga” -c “/agent/base/cloudagent/agent_inst/bin/omcli start agent”
-
-
Save the script file.
-
Change the permission of the file to
755
. Ensure that the owner of the script file and all the other files in the/etc/init.d
directory is root. -
Create symbolic links under
/etc/rc2.d
and/etc/rc3.d
directories. Prefix the symbolic link with S and the priority level.-
To create the above symbolic link, execute the following command:
ln -s /etc/init.d/S81startomcagent.sh /etc/rc.d/rc2.d/S81startomcagent.sh
For example, if the file startomcagent is created under
/etc/init.d
with priority level81
, then the symbolic link will be as follows:lrwxrwxrwx 1 root root 30 Apr 2 04:39 /etc/rc2.d/S81startomcagent -> /etc/init.d/startomcagent.sh
-
-
Restart the host machine.
AIX
-
Login as the root user.
-
Create a shell script under theFor example, if the agent is installed under the
/etc/rc.d/init.d
directory using any standard text editor and paste the following into the file.-
#!/bin/sh
-
su — <Agent_Install_User> —c <Agent_Base_Directory>/agent_inst/bin/omcli start agent
/agent/base/cloudagent
directory and agent installation owner is emga, then the content of the shell script should be as follows:#!/bin/sh
su - “emga” -c “/agent/base/cloudagent/agent_inst/bin/omcli start agent”
-
-
Save the script file.
-
Change the permission of the file to
755
. Ensure that the owner of the script file and all the other files in the/etc/rc.d/init.d
directory is root. -
Create symbolic links under
/etc/rc.d/rc2.d
,/etc/rc.d/rc3.d
, and/etc/rc.d/rc5.d
directories. Prefix the symbolic link with S and the priority level.-
To create the above symbolic link, execute the following command:
ln -s /etc/rc.d/init.d/S81startomcagent.sh /etc/rc.d/rc2.d/S81startomcagent.sh
For example, if the file startomcagent is created under
/etc/rc.d/init.d
with priority level81
, then the symbolic link will be as follows:lrwxrwxrwx 1 root root 30 Apr 2 04:39 /etc/rc.d/rc2.d/S81startomcagent -> /etc/rc.d/init.d/startomcagent.sh
-
-
Restart the host machine.