Bug #53288 agent upgrade does not copy all instances in multi-instance case
Submitted: 29 Apr 2010 15:18 Modified: 9 Jan 2015 14:43
Reporter: Marcos Palacios Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Enterprise Monitor: Installing Severity:S3 (Non-critical)
Version:2.2.0.1705 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[29 Apr 2010 15:18] Marcos Palacios
Description:
When doing an agent upgrade for a multi-instance agent, it will (at best) copy one of the instance folders in 'etc/instances'. Two cases are observed:

 1) if there is a 'mysql' folder under the etc/instances folder (among the several folders), that one will be copied to the upgraded installation, but the others will not.

 2) if there is no 'mysql' folder under the etc/instances folder (e.g., folders called 'm3306', 'm13306', etc), the upgraded installation has a new 'mysql' folder with an agent-instance.ini file that has no user or password, and a hostname and port that are the default 127.0.0.1 and 3306, as shown below. This causes the agent login (when started) to attempt using the session's username, which most likely fails.

user     = 
password = 
hostname = 127.0.0.1
port     = 3306

Workaround: ONLY if user chose to backup the previous installation: get the instance folders from the 'patchbackup' folder, replacing the bogus 'mysql' folder.

How to repeat:
- install an agent and have it monitor multiple instances
- see the two cases in the 'Description' above (re: instance folder naming)
- upgrade this agent
- observe the results
[15 Sep 2010 16:02] MySQL Verification Team
There is another case where if you upgrade from 2.1 > 2.2+ and have different mysql-monitor-agent.ini for each instance, you will get:

2010-09-09 10:21:15: (critical) MySQL Monitor Agent 2.2.3.1755 started.
2010-09-09 10:21:15: (critical) agent-items-xml.c:29: luaL_loadfile(): cannot open /usr/local/mysqlnet/agent/share/mysql-proxy/items/quan.lua: No such file or directory
2010-09-09 10:21:15: (critical) agent.c:581: reading item-file no. 0 (name: '/usr/local/mysqlnet/agent/share/mysql-proxy/items/quan.lua') failed

The mysql-proxy diretory is no longer used, which is why it's not finding it. The upgrade installer doesn't take these additional agent .ini's into account. This file is now: share/mysql-monitor-agent/items/items-mysql-monitor.xml

Changing the path to the above in those ini's solves the problem.

We should either take these into account, or at least check for other instances/* folders or /etc ini files and warn in the agent upgrade script.
[15 Sep 2010 16:07] MySQL Verification Team
Also should add, if you don't select the backup option those files will be unavailable. Though there is mention of this in the documentation:

---
The installation and configuration of MySQL Enterprise Agent must be standard before you start the installation. The update installer will not upgrade agents where you have changed or modified the filenames or directory layout of the installed agent, configuration files, or the startup files.
---

---
If you chose to back up your current installation, a directory named backup will be created in the current installation directory. This directory will contain copies of the directory or directories that were replaced during the update. In cases where only specific files are replaced, the backup directory may contain only these files. If you are unhappy with the update simply overwrite the new files or directories with the originals found in the backup directory. Be sure to stop both the MySQL Enterprise Service Manager and MySQL Enterprise Agent before restoring the original files. You can delete or archive this directory when you are satisfied that the update was successful.

If you choose to back up your current installation, the installer checks that there is adequate disk space for your repository backup. If there is not enough space, you are given the option of choosing another location; you may also choose not to back up the repository.
----

Handling a little better would be good.