---
title: "Mysql Monitor Agent setup"
author: "bzhang"
date: "2009-02-10T13:37:30Z"
tags: ["Linux", "MySQL", "Socket", "Tomcat", "Unix"]
slug: "mysql-monitor-agent-setup"
draft: false
lastmod: "2009-02-10T13:37:30Z"
id: 326146
url: "https://bzhang.iteye.com/blog/326146"
---

### 2.4.4. Installing the Monitor Agent on Unix

As a prerequisite for installing the MySQL Enterprise Monitor Agent on Linux systems you must have the Linux Standards Base (LSB) initialization functions installed.

To install the agent navigate to the directory that contains the file, `mysqlmonitoragent- version -installer.bin` (where *`version`* indicates the three-part version number, the OS, and the architecture). Ensure that this file is executable by typing:

```
shell>  chmod +x mysqlmonitoragent- version

-installer.bin


```

To install to the default directory (`/opt/mysql/enterprise/agent` ) you need to be logged in as `root` . Installing as an unprivileged user installs to the `/home/ user_name /mysql/enterprise/agent` directory.

### Note

If you install the agent as an unprivileged user, it will not automatically start up on rebooting.

What follows describes installation from the command line. You may install the Monitor Agent graphically by running the installer from within a windows manager. In both cases the steps are identical. You may also install the Monitor Agent in `unattended` mode. This is especially useful if you are doing multiple installations. For more information on this topic see [Section 2.7, “Unattended Installation”](http://dev.mysql.com/doc/mysql-monitor/2.0/en/mem-unattended-installation.html "2.7.&nbsp;Unattended Installation") .

Begin installation from the command line by typing:

```
shell>  ./mysqlmonitoragent- version

-installer.bin --mode text


```

The various options are shown in what follows. Default values are indicated by square brackets; to select them press Enter . Otherwise enter a value of your choosing.

1. First, you must select the Language you want to use during the installation process:
   
   ```
   Language Selection
   
   Please select the installation language
   [1] English
   [2] Japanese
   Please choose an option [1] : 
   ```
2. Next, specify the directory where you want the agent installed:
   
   ```
   ----------------------------------------------------------------------------
   Welcome to the MySQL Enterprise Monitor Agent Setup Wizard.
   
   ----------------------------------------------------------------------------
   Please specify the directory where MySQL Enterprise Monitor Agent will be installed
   
   Installation directory [/opt/mysql/enterprise/agent]:   
   ```
3. Specify the MySQL server that you want to monitor. First, you must specify whether you want to use a TCP/IP or socket-based connection to communicate with the MySQL Server:
   
   ```
   How will the agent connect to the database it is monitoring?
   
   
   [1] TCP/IP
   [2] Socket
   Please choose an option [1] :
   ```
   
   If you select TCP/IP, then you will be asked to enter the TCP/IP address and port number:
   
   ```
   ----------------------------------------------------------------------------
   Monitored Database Information
   
   IMPORTANT: The agent user account specified below requires special MySQL privileges.
   
   Visit the following URL for more information:
   https://enterprise.mysql.com/docs/monitor/2.0/en/mem-install.html#mem-agent-rights
   
   MySQL hostname or IP address [127.0.0.1]: 
   
   
   
   Validate MySQL hostname or IP address [Y/n]: 
   
   
   MySQL Port [3306]: 
   
   ```
   
   If you select Socket, then you will be asked to provide the path name to the MySQL socket. Typical values are `/tmp/mysql.sock` , `/var/lib/mysql.sock` , or `/var/run/mysql.sock` .
   
   ```
   ----------------------------------------------------------------------------
   Monitored Database Information
   
   IMPORTANT: The agent user account specified below requires special MySQL privileges.
   
   Visit the following URL for more information:
   https://enterprise.mysql.com/docs/monitor/2.0/en/mem-install.html#mem-agent-rights
   
   MySQL Socket []: 
   ```
   
   ### Note
   
   The service agent always associates “localhost ” with the TCP/IP address 127.0.0.1, not the MySQL socket. This is in contrast to the MySQL Command Line Tool, which connects via the MySQL socket by default on Unix, if the hostname “localhost ” is specified.
   
   If the MySQL server you wish to monitor has been started with the `--skip-networking` command option then you will not be able to connect to it via TCP/IP, as the server will not listen for TCP/IP connections. In this case the service agent will need to be configured to use the MySQL socket. This can be done during installation by selecting “socket ” rather than “TCP/IP ” and then specifying the MySQL socket name. This can also be configured after installation by editing the `agent-instance.ini` configuration file, for further information on this refer to [Section 2.6.2, “MySQL Server (`agent-instance.ini` ) Configuration”](http://dev.mysql.com/doc/mysql-monitor/2.0/en/mem-cfg-agent-ini.html "2.6.2.&nbsp;MySQL Server (agent-instance.ini) Configuration") .
   
   If the MySQL server to be monitored has been started using the command option `--bind-address` then the server will only listen for connections on the IP address specified, that is, the IP address of the MySQL server. If the service agent has been started using TCP/IP networking and the default address of 127.0.0.1 it will not be able to connect to the server to be monitored. Also, if “localhost ” is specified as the host name during agent configuration, a connection will not be established, as the server will be listening for connections on the address specified with the `--bind-address` option, not 127.0.0.1.
4. Specify the user credentials for the MySQL server that you want to monitor:
   
   ```
   MySQL Username []:  service_agent
   
    
   
   MySQL Password :
   
   Re-enter :
   ```
5. Select whether you want to enable Query Analyzer. If you disable the Query Analyzer during installation, you will need to manually edit the configuration file to re-enable the Query Analyzer functionality. If you enable Query Analysis (Proxy), you must specify the port on which the agent will listen for queries.
   
   ```
   ----------------------------------------------------------------------------
   Query Analyzer Configuration
   
   MySQL Proxy enables query monitoring and analysis by listening on a specified port for client connections that are then passed through to a backend MySQL database server. It is not needed for basic monitoring functionality.
   
   Click here for more information.
    [Y/n]: 
   
   Enable Proxy (recommended) [Y/n]: 
   
   
   Proxy Port [4040]: 
   
   Backend Host: 127.0.0.1   (cannot be changed)
   
   Backend Port: 3306   (cannot be changed)
   ```
   
   For more information on enabling Query Analyzer if you disabled it during installation, see [Chapter 9, *The Query Analyzer Page*](http://dev.mysql.com/doc/mysql-monitor/2.0/en/mem-query-analysis.html "Chapter&nbsp;9.&nbsp;The Query Analyzer Page") .
6. Enter the details of the MySQL Enterprise Service Manager that you want to use with this agent. The configuration information required is available within the installation report generated when you installed MySQL Enterprise Service Manager
   
   ```
       
   ----------------------------------------------------------------------------
   
   MySQL Enterprise Monitor Options
   
   
   Hostname or IP address []:  192.168.0.197
   
    
   
   Tomcat Server Port [18080]: 
   
   Tomcat SSL Port [18443]:
   ```
   
   The agent and MySQL Enterprise Service Manager support using SSL for communication. If you want to enable SSL communication between the agent and the MySQL Enterprise Service Manager, you must reply **Y** to the following question.
   
   ```
   Use SSL? [y/N]: 
   
   Agent Username [agent]:  
   
   Agent Password :
   
   Re-enter : 
   
   ----------------------------------------------------------------------------
       
   ```
7. Before installation starts, you will be provided with a summary of the installation settings that you have specified:
   
   ```
   Here are the settings you specified: 
   
   Installation directory: /opt/mysql/enterprise/agent 
   
   Monitored MySQL Database:  
   -------------------------
   Hostname or IP address: 127.0.0.1
   Port: 3306
   MySQL username:  mysql_user
   
   
   MySQL password:  password
   
   
   
   Query Analyzer Configuration
   -------------------------
   Proxy Enabled: yes
   Proxy Port: 4040
   
   MySQL Enterprise Manager: 
   ------------------------------
   
   Hostname or IP address:  192.168.0.197
   
   
   
   Tomcat Server Port: 18080
   Tomcat SSL Port: 18443
   Use SSL: 0
   Agent username:  agent
   
   
   
   Press [Enter] to continue : 
   
   
   ----------------------------------------------------------------------------
     
   Setup is now ready to begin installing MySQL Enterprise Monitor Agent on your computer.
   
   Do you want to continue? [Y/n]: y
       
   ```
8. The installer will copy the necessary files and create the configuration file required to run the agent:
   
   ```
   ----------------------------------------------------------------------------
   Please wait while Setup installs MySQL Enterprise Monitor Agent on your computer.
   
    Installing
    0% ______________ 50% ______________ 100%
    #########################################
   
   ----------------------------------------------------------------------------
   Info to start MySQL Agent
   
   The MySQL agent was successfully installed. To start the MySQL Agent please 
   invoke:
   /opt/mysql/enterprise/agent/etc/init.d/mysql-monitor-agent start
   Press [Enter] to continue : 
   
   ----------------------------------------------------------------------------
   Setup has finished installing MySQL Enterprise Monitor Agent on your computer.
   ```
9. Finally, you can read the supplied `README` file when prompted. The file is provided within the `share/doc/README_en.txt` file within the agent installation directory if you would like to read this file separately.

For information on starting the agent, see [Section 2.5.3, “Starting/Stopping the Agent on Unix”](http://dev.mysql.com/doc/mysql-monitor/2.0/en/mem-starting-agent-unix.html "2.5.3.&nbsp;Starting/Stopping the Agent on Unix") .