OCP-Agent script

2023-08-22 02:51:01  Updated

This topic describes how to use the ocp_agent_ctl.py script.

Environment

After you install the software packages of OCP-Agent and OCP-Server, you can find the ocp_agent_ctl.py script in the following directories:

  • OCP-Server: /home/admin/ocp-server/lib

  • OCP-Agent: /home/admin/ocp_agent

    To run the ocp_agent_ctl.py script, you must have Python V2.7.5 and thepos.py script. The pos.py script is used to perform host operations. It is included in the software packages of OCP-Agent and OCP-Server. Therefore, you can run ocp_agent_ctl.py directly in /home/admin/ocp-server/lib or /home/admin/ocp_agent.

    Note

    • If you need to copy ocp_agent_ctl.py to another directory for running, you must copy /home/admin/ocp-server/lib/pos.py or /home/admin/ocp_agent/agent/pos.py to the same directory.
    • The script execution logs will be recorded in the ocp_agent_ctl.log file of the same directory.
    • This script can be used for the O&M of OCP-Agent on the local host. At present, it does not support remote O&M.

Command line format

python ocp_agent_ctl.py [COMMAND] [OBJECT] [OPTIONS]
  • COMMAND specifies an operation command, for example, start or stop.

  • OBJECT specifies an object to be operated on, for example, ocp_agent.

  • OPTIONS specifies additional options, including:

    • -help: This option can be simplified as "-h" and is used to query the usage help of a script.

    • -debug: This option prints debugging logs during script running.

Examples

Query the usage help

  • Run the following command to query the usage help of the script.

    python ocp_agent_ctl.py -h
    

    The usage of this script and supported operation commands are returned.

  • Run the following command to query the usage help of a specific command.

    python ocp_agent_ctl.py start -h
    

    The usage of the start command and applicable objects are returned.

Install OCP-Agent

  • Run the following command to install the OCP-Agent software package.

    python ocp_agent_ctl.py install /home/admin/t-oceanbase-ocp-agent-2.4.3-1234567.alios7.x86_64.rpm
    
  • Run the following command to query the installation information.

    python ocp_agent_ctl.py info
    

    The name, version, architecture, and description of the OCP-Agent are returned.

    Note

    The output on Debian or Ubuntu is different from that on other operating systems.

Start OCP-Agent

  • Run the following command to start the ocp_agent process.

    python ocp_agent_ctl.py start ocp_agent
    

    After you start OCP-Agent, pos_proxy, node_exporter, and ocp_exporter are also started.

  • Run the following command to start all service samples of OCP-Agent.

    python ocp_agent_ctl.py start ocp_agent ob_monitor obproxy_monitor --ocp_site_url http://localhost:8080 --cluster_name cluster1
    

Stop OCP-Agent

  • Run the following command to stop the ocp_agent process.

    python ocp_agent_ctl.py stop ocp_agent
    

    After you stop the ocp_agent process, pos_proxy, node_exporter, and ocp_exporter are also stopped. The host status is changed to offline and some OCP monitoring metrics will be missing.

  • Run the following command to stop the ob_monitor process.

    python ocp_agent_ctl.py stop ob_monitor
    

    After you stop the ob_monitor process, obstat2, ob_logtailer, and ob_cleaner are also stopped. Top SQL, plan cache monitoring, and OceanBase log alerts will be unavailable.

Uninstall OCP-Agent

The following command is used to uninstall the OCP-Agent application and does not stop the ocp_agent process. To completely uninstall OCP-Agent, you need to manually stop the ocp_agent process.

python ocp_agent_ctl.py uninstall

Contact Us