5.7.2 Starting/Stopping the Agent on Mac OS X

Using launchd

The preferred method is to use launchd to load the Agent as a service. After selecting "Install as a service" during the installation process, you may load or unload the Agent service using the following commands.

To start (load) the Agent:

shell> sudo launchctl load /Library/LaunchDaemons/mysql.agent.plist

To stop (unload) the Agent:

shell> sudo launchctl unload /Library/LaunchDaemons/mysql.agent.plist

Using init

Alternatively, an init.d script to start the Agent on Mac OS X is located in the /Applications/mysql/enterprise/agent/etc/init.d directory. To start the Agent navigate to this directory and at the command line type:

shell> ./mysql-monitor-agent start

To stop the Agent, use the stop command:

shell> ./mysql-monitor-agent stop

If the agent cannot be stopped because the pid file that contains the agent's process ID cannot be found, you can use kill to send a TERM signal to the running process:

shell> kill -TERM PID

If you run more than one agent on a specific machine, you must also specify the path to the ini file when you stop the agent. Executing mysql-monitor-agent stop without an ini file only stops the agent associated with the default ini file.

To verify that the agent is running, use the following command:

shell> ./mysql-monitor-agent status

The resulting message indicates whether the agent is running. If the agent is not running, use the following command to view the last ten entries in the general Agent log file:

shell> tail /Applications/mysql/enterprise/agent/logs/mysql-monitor-agent.log

For further information on troubleshooting the agent, see Section 5.11, “Troubleshooting the Agent”.

Installation creates the directory /Applications/mysql/enterprise/agent, and the logs directory is located immediately below the agent directory.

To see all the command-line options available when running the monitor agent, navigate to the /Applications/mysql/enterprise/agent/etc/init.d directory and execute mysql-monitor-agent help, which displays the usage message:

Usage: ./mysql-monitor-agent {start|stop|restart|status}
Warning

To report its findings, the agent connects to the Monitor UI through the port specified during installation. The default value for this port is 18443; ensure that this port is not blocked. To troubleshoot the agent installation, see Section 5.11, “Troubleshooting the Agent”.