Bug #40695 Agent shuts down when it detects a clone of an existing database
Submitted: 13 Nov 2008 11:04 Modified: 9 Jan 2015 10:04
Reporter: Simon Mudd (OCA) Email Updates:
Status: Closed Impact on me:
Category:MySQL Enterprise Monitor: Agent Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: windmill

[13 Nov 2008 11:04] Simon Mudd
We've just cloned an existing db server to a new box.

The agent install is automatic and we see the following error message

2008-11-13 10:50:41: (critical) agent_mysqld.c:524: [mysql] the hostid from mysql.inventory doesn't match our agent's host-id (ssh:{eb:a7:0a:cb:f5:7d:98:5c:6a:cc:6b:57:
2d:1d:0c:c9} != ssh:{98:8c:16:28:e5:ee:f4:fc:a6:54:45:5a:1d:10:b8:be})
We assume that this is a cloned host and shutdown now.
Please TRUNCATE TABLE mysql.inventory on this mysql-instance and restart the agent.

Please make life for the administrators of multiple db servers as simple as possible.
The agent's task is to report data to the merlin2 instance. merlin2's task is to worry about clones but it shouldn't get in the way of recording data which in the end is what it's there for.

How to repeat:
Clone an existing db server monitored by a 2.0 agent to another server.
Install a new agent and start it.

Suggested fix:
I don't like this behaviour of stopping the agent and requiring manual changes on the db server.

I'd prefer the agent to continue logging to merlin (as a separate instance).
I'd like the web ui to indicate that this is a clone and:
- provide the option to treat it as a new instance.
- provide the option of merging the data from this clone into the original instance
- provide the option to be able to indicate to the agent to shutdown (due to misconfiguration)

The best thing is that the data comes in so that nothing is lost (if it is needed)

Also provide an alert/notification to the web ui and by email that an action needs to be taken, or that a new clone has been detected.

Note: in our case we had deliberately copied the db instance to a new server and installed a NEW agent instance. This clone was intentional.
Note2: This only happens if you copy a db instance where the agent2 has created this special table in the mysql database.
[29 Apr 2009 18:16] Jenni Snyder
I agree that this is an issue, especially since the table is InnoDB, and isn't easily stripped from a backup.  

All of our new databases are restored using an innobackup.pl-based script, and this is especially a problem for our test servers, which we break down and restore/redeploy regularly.
[27 May 2009 12:30] Oli Sennhauser
Possibly duplicate of 42360.
[13 Mar 2014 13:28] Omer Barnir
Setting bug back to 'Verified'.