Xymon Mailing List Archive search

mysql password file on centos 5, xymon client

list Jeremy Laidman
Mon, 3 Dec 2012 17:07:13 +1100
Message-Id: <CAAnki7CNT9WtxvNqHEkbdTVDDyD=D4xTA1Q0L76RH0L=user-d7702461e974@xymon.invalid>

Try running this as the xymon user, to find out where it's looking for the
file:

HOME=~xymon sudo -u xymon xymoncmd strace -f mysql 2>&1 | grep ^stat

On my system:

stat("/etc/my.cnf", 0x7fff9cbc1830)     = -1 ENOENT (No such file or
directory)
stat("/usr/lib/xymon/.my.cnf", 0x7fff9cbc1830) = -1 ENOENT (No such file or
directory)
stat("/etc/my.cnf", 0x7fff9cbc1830)     = -1 ENOENT (No such file or
directory)


On 30 November 2012 00:43, Leon Volfson <user-19f90d15bbfd@xymon.invalid> wrote:
Hi Mike,
thanks for answering,
I did run the "whereis xymon-client" and I do know about this directory.
unfortunately, putting the file there doesn't do anything.


Lenny


On Thu, Nov 29, 2012 at 2:50 PM, Mike Burger <
user-c26873f0522a@xymon.invalid> wrote:
Oops…client…if you installed it from RPM, the home dir is likely
/usr/share/xymon-client.****

** **

*From:* xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] *On
Behalf Of *Mike Burger
*Sent:* Thursday, November 29, 2012 7:49 AM
*To:* Leon Volfson; xymon at xymon.com
*Subject:* Re: [Xymon] mysql password file on centos 5, xymon client****

** **

Leon,****

** **

If you installed Xymon from RPM on your CentOS 5 system, and you run
either “finger xymon” or “grep xymon /etc/passwd”, you’ll likely note that
the xymon user’s home directory is /usr/lib/xymon. Try creating/moving the
.my.cnf there.****

** **

*From:* xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com<xymon-bounces at xymon.com>]
*On Behalf Of *Leon Volfson
*Sent:* Wednesday, November 28, 2012 7:21 AM
*To:* xymon at xymon.com
*Subject:* [Xymon] mysql password file on centos 5, xymon client****

** **

Hi,

I have a question.
Recently I've added a script to monitor the mysql replication.
I got it off the internet:

#!/bin/bash


############################################################################################
test -e /usr/local/mysql/bin/mysql && PROG=/usr/local/mysql/bin/mysql
test -e /usr/bin/mysql && PROG=/usr/bin/mysql
MAXDRIFT=5

############################################################################################

MYSQLCOLOR=""
MYSQLLINE=""
HOSTIP=127.0.0.1
IPADDR=127.0.0.1
MACHINE=`uname -n`

MAXSEC=60

MYSQLUSER=root
MYSQLPORT=3306
LINE=`echo "show slave status \G" | ${PROG} -h ${HOSTIP} -u ${MYSQLUSER}
-P ${MYSQLPORT} 2>&1`
MASTERPOS=`echo $LINE | grep Read_Master_Log_Pos | awk -F
'Read_Master_Log_Pos: ' '{print $2}' | awk '{print $1}'`
SLAVEPOS=`echo $LINE | grep -i Exec_Master_Log_Pos | awk -F
'Exec_Master_Log_Pos: ' '{print $2}' | awk '{print $1}'`
SLAVEUP=`echo $LINE | grep Running | wc -l`
SLAVE_SECOND_BEHIND_MASTER=`echo $LINE | grep 'Seconds_Behind_Master:'  |
awk -F 'Seconds_Behind_Master: ' '{print $2}'  | awk '{print $1}'`
test $SLAVEUP -eq "1"  &&  DRIFT=$((${MASTERPOS} - ${SLAVEPOS}))
echo "${LINE}" | ${GREP} "Running: No" >/dev/null
if test "$?" -eq "0"
then
    MYSQLCOLOR="red"
    MYSQLLINE="`${DATE}` MYSQL Slave in error
${LINE}"
elif test ${SLAVEUP} -ne "1"
then
    MYSQLCOLOR="green"
    MYSQLLINE="`${DATE}` MYSQL Slave is Stopped
${LINE}"
elif test ${SLAVE_SECOND_BEHIND_MASTER} -ge ${MAXSEC}
then
    MYSQLCOLOR="yellow"
    MYSQLLINE="`${DATE}` MYSQL Slave is ${DRIFT} statements behind!
${LINE}"
else
    MYSQLCOLOR="green"
    MYSQLLINE="`${DATE}` MYSQL Slave is ${DRIFT} statements behind!
${LINE}"
fi

#echo "${BB} ${BBDISP} status ${MACHINE}.mysqlslave ${MYSQLCOLOR}
${MYSQLLINE}"
${BB} ${BBDISP} "status ${MACHINE}.mysqlslave ${MYSQLCOLOR} ${MYSQLLINE}"


To make it working, you need to create the file : ~hobbit/.my.cnf

[mysql]
password=XXXXXXXX
[mysqlclient]
password= XXXXXXXX
[mysqladmin]
password= XXXXXXXX
[mysqlshow]
password= XXXXXXXX
[mysqldump]
password= XXXXXXXX
chown hobbit: ~hobbit/.my.cnf
chmod 600 ~hobbit/.my.cnf


Add the section in clientlaunch.cfg

[mysqlslave]
        ENVFILE $HOBBITCLIENTHOME/etc/hobbitclient.cfg
        CMD $HOBBITCLIENTHOME/ext/mysqlslave.sh
        LOGFILE $HOBBITCLIENTHOME/logs/mysqlslave.log
        INTERVAL 5m


Restart hobbit-client.


as you can see, the author instructs to put the .my.cnf file with all the
passwords in the ~hobbit/.my.cnf directory.
While that went fine on the Ubuntu 12.04 server, it doesn't work on the
CentOS 5 server.
I got the xymon client.rpm from some website and it just doesn't
recognize this file no matter where I put it.
The version is 4.3.10.
the client is installed in these directories:
/etc/xymon-client
/usr/libexec/xymon-client
/usr/share/xymon-client

I also noticed that there's no /var/lib/xymon-client directory.
The Ubuntu version was installed via apt-get and still has "hobbit"
naming.
On CentOS client I renamed all the "hobbit" into "xymon".
If I put the pass into the script itself - it works. But I really don't
want to do that.

Any ideas?

Thanks,
Lenny****

** **

** **

CONFIDENTIALITY NOTICE: This e-mail message, including all attachments, is for****

the sole use of the intended recipient(s) and may contain confidential****

information. Any unauthorized review, use, disclosure, alteration or****

distribution is strictly prohibited and may violate state or federal law. If you****

are not the intended recipient, please contact the sender by reply e-mail,****

delete this email and destroy all copies of the message.****

CONFIDENTIALITY NOTICE: This e-mail message, including all attachments, is for
the sole use of the intended recipient(s) and may contain confidential
information. Any unauthorized review, use, disclosure, alteration or
distribution is strictly prohibited and may violate state or federal law. If you
are not the intended recipient, please contact the sender by reply e-mail,
delete this email and destroy all copies of the message.