Bug #25683 Port numbers reported incorrectly when using socket connections
Submitted: 17 Jan 2007 16:07 Modified: 21 Feb 2007 18:52
Reporter: Mark Leith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Monitor Severity:S3 (Non-critical)
Version:1.0.0 OS:Any (All)
Assigned to: Jan Kneschke CPU Architecture:Any
Tags: mer 1.1.0, port, socket

[17 Jan 2007 16:07] Mark Leith
Description:
When using socket (or named pipe / shared memory) connections to the MySQL server from the agent, and the port that the MySQL server is something other than the default of 3306, the port numbers within the dashboard are reported incorrectly - as the default 3306. 

How to repeat:
o Set MySQL to listen on port 3050
o Set up an agent and set the [mysqld] section without a port variable, but with a socket connection instead
o Start and connect it to the dashboard
o Observe that the dashboard still reports the port as 3306

Suggested fix:
Grab the "port" system variable from SHOW [GLOBAL] VARIABLES to use at all times, instead of relying on the port being set correctly within the mysql-service-agent.ini file, or falling back to the default when it is not set.
[16 Feb 2007 20:24] Jan Kneschke
SHOW VARIABLES LIKE 'port' only reports the config-file value which is bogus in case of skip-networking. Instead we always report port = 0 now if we connected to the server via socket.

committed as r4794
[21 Feb 2007 15:25] Mark Leith
Not fixed, issue shuffled - the service manager is still reporting 3306 for the port, even though it is monitoring the service manager via the socket (/opt/mysql/network/monitoring/mysql/tmp/mysql.sock). The service manager's MySQL installation is running on the default 13306, not 3306. 

See net-sup1 for confirmation of this.

Reassigning to Oldag.
[21 Feb 2007 15:32] Mark Leith
Further note - if MySQL is running with --skip-networking, we should not report a port for it at all. --skip-networking sets the port to 0. 

The Service Manager should:

o Get the value reported by the agent, if 0 then:
  o Get the value from SHOW GLOBAL VARIABLES, if 0 then:
    o Not make any mention of a port in the server names at all
[21 Feb 2007 16:08] Darren Oldag
i tried with the latest agent, and i get port=0 back if using a socket connection and no port specified in the ini file.  i am not running with skip-networking, and i am listening on a port, so either the agent needs to send my correct port... or it is doing the right thing by sending zero.

in the zero case, what do we do when multiple server instances have no ports (all zero), and the same name?  it would look funny in the UI to see them without some unique trait...
[21 Feb 2007 16:28] Mark Leith
Looks like it is agent side:

[root@net-sup1 log]# grep --colour port mysql-service-agent.log 
<task><taskId>1</taskId><command>list_inventory</command><utc>2007-02-21T15:40:17.602Z</utc><server><hostname>net-sup1-merlin</hostname><port>3306</port><version>5.0.28-enterprise-log</version><serverId>1</serverId>

ini settings:

[mysqld]
user     = service_manager
password = mysql
hostname = 127.0.0.1
port =
socket = /opt/mysql/network/monitoring/mysql/tmp/mysql.sock
[21 Feb 2007 18:52] Mark Leith
Now reporting correctly (as 0) within 1.1.0.4810, closing