Bug #40583 Agent startup doesn't produce a log file.
Submitted: 7 Nov 2008 17:34 Modified: 28 Jan 2009 16:47
Reporter: Simon Mudd
Status: Closed
Category:Monitoring: Config Severity:S3 (Non-critical)
Version:2.0.0.7088 OS:Linux (CentOS 4 x86_64)
Assigned to: MC Brown Target Version:

[7 Nov 2008 17:34] Simon Mudd
Description:
The configured startup does not seem to work and there is no log file.
Original configuration used https and port 443, but due to firewall issues I've changed
this by hand to http and port 80. Nevertheless the startup fails and I see no log file.

How to repeat:
# 
# Version: 2.0.0.7088

[mysql-proxy]

keepalive = true
plugins=proxy,agent
# not using port 443 as firewall access doesn't allow it.
agent-mgmt-hostname = http://agent_user:agent_pass@merlin-server:80/heartbeat
mysqld-instance-dir= etc/instances
agent-item-files =
share/mysql-proxy/items/quan.lua,share/mysql-proxy/items/items-mysql-monitor.xml
proxy-address=:4040
proxy-backend-addresses = 127.0.0.1:3306
proxy-lua-script        = share/mysql-proxy/quan.lua

agent-uuid = dfa87cfe-1a46-4f27-8e14-199a483ad78b
log-file = mysql-monitor-agent.log
pid-file=/opt/mysql/enterprise/agent3/mysql-monitor-agent.pid

[root@HOSTNAME etc]# pwd
/opt/mysql/enterprise/agent3/etc
[root@HOSTNAME etc]# cd ..
[root@HOSTNAME agent3]# ps auwx | grep agent3
root     23800  0.0  0.0  3788  676 pts/6    R+   17:28   0:00 grep agent3
[root@HOSTNAME agent3]# find . | grep log
./bin/mysql-binlog-dump
[root@HOSTNAME agent3]# /opt/mysql/enterprise/agent3/etc/init.d/mysql-monitor-agent
start
Starting MySQL Enterprise agent
service....................[FAILED]...............................................................................................
[root@HOSTNAME agent3]# /opt/mysql/enterprise/agent3/etc/init.d/mysql-monitor-agent
status
MySQL Enterprise agent does not appear to be running
[root@HOSTNAME agent3]# find . | grep log
./bin/mysql-binlog-dump
[root@HOSTNAME agent3]# 

Suggested fix:
Please a log file with the problem or make debugging easier with some sort of verbose
flag.
[14 Nov 2008 21:10] Mark Matthews
Simon,

Does the log file get produced if you fully-qualify the pathname, as you do with the pid
file?
[17 Nov 2008 13:21] Simon Mudd
Feedback provided but kept private due to internal information being shown.
Summary: no difference noted when using a FQDN.
A similar server does not exhibit this problem so I'm going to try and determine what
differences there are between the 2 boxes.
[17 Nov 2008 16:32] Debs Wade
When the full pathname is given to the binary then the agent operates normally.
So starting the agent like this:
sh -x /opt/mysql/enterprise/agent3/bin/mysql-monitor-agent
--defaults-file=/opt/mysql/enterprise/agent3/etc/mysql-monitor-agent.ini --daemon
--pid-file=/opt/mysql/enterprise/agent3/mysql-monitor-agent.pid

is a workaround and so is changing the init.d file to use the full path works

[snipped from modified init.d file]
   ## if the PID-file exists and the PID is used, don't start
    if test -f $MERLIN_AGENT_PID; then
      ## pid-file exists, check if the process is still up
      if kill -0 `cat $MERLIN_AGENT_PID` 2> /dev/null; then
        ## process is running, ok, out of here
        echo -n "(already running)"
        log_success_msg
        exit 0
      else
        # it it's, start it
        cd $MERLIN_AGENT_ROOTDIR
        $MERLIN_AGENT_BIN $MERLIN_AGENT_OPTIONS >/dev/null 2>&1 &
        wait_for_pid create

        # Make lock for RedHat / SuSE
        if test -w "/var/lock/subsys" ; then
          touch "/var/lock/subsys/$MERLIN_AGENT_SERVICE"
        fi
      fi
    else
      # no PID file, no process. It's time to start one
      cd $MERLIN_AGENT_ROOTDIR
      $MERLIN_AGENT_BIN $MERLIN_AGENT_OPTIONS >/dev/null 2>&1 &
      wait_for_pid create

[end -snip]
[22 Jan 2009 14:20] Diego Medina
Verified *not* fixed yet on 2.0.2.7131

The mysql-monitor-agent script does not show the changes from the patch.
[22 Jan 2009 19:41] Keith Russell
The 'init.d/mysql-monitor-agent' script has previously been picked up by the installer
build from the installer repository.  Therefore the mod by Kay was not picked up. The
following changes have been made.

Change made in versions => 2.0.4.7139. (except 2.1.0.1003) 
- The 'init.d/mysql-monitor-agent' script has been moved from the installer repository to
the agent development repository.    
- The installer build has been modified accordingly for future builds.
- The modified script was forwarded to Bitrock for review.
[27 Jan 2009 20:38] Diego Medina
Verified fixed on 2.0.4.7140
[28 Jan 2009 16:47] Tony Bedford
An entry has been added to the 2.0.4 changelog:

The Service Agent startup configuration did not seem to work and did not generate a log
file.