Ad Widget

Collapse

More mysql woes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • emathis
    Junior Member
    • Jun 2012
    • 2

    #1

    More mysql woes

    Hello,

    I've been trying to tackle this problem for a few days and I cant seem to get
    anywhere. Basically it seems calling the Userparam is ignoring the $HOME/.my.cnf
    file which contains the password for zabbix account.

    Zabbix 1.8.11, Archlinux

    Here is the cmd I'm running.
    Code:
    UserParameter=mysql.replicate.slave.secbehind,HOME=/home/zabbix echo 'show slave status\G'| mysql | grep Seconds_Behind_Master | cut -d : -f2 | sed s/NULL/10000000/ |tr -d " "
    If I run that by hand it works fine. If I run the
    'zabbix_agentd -t mysql.replicate.slave.secbehind' AS the zabbix user (su zabbix -) locally it works fine.

    If I run 'zabbix_get -s hostname.net -k mysql.replicate.slave.secbehind' from
    the zabbix server I get the ZBX_NOTSUPPORTED with the error logged as
    Code:
    ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: NO)
    I don't want to put the password on the CLI for the obvious reasons.

    Code:
    mysql --print-defaults
    mysql would have been started with the following arguments:
    --port=3306 --socket=/var/run/mysqld/mysqld.sock --default-character-set=utf8 --ssl --ssl-ca=/etc/mysql/ssl/ca-cert.pem --ssl-capath=/etc/mysql/ssl --ssl-cert=/etc/mysql/ssl/client-cert.pem --ssl-key=/etc/mysql/ssl/client-key.pem --no-auto-rehash --default-character-set=utf8 --user=zabbix --password=xxxxx
    The above proves its working as the zabbix user.

    Any light you can shed on this would be most welcomed

    Thanks much!
    -Erik-
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #2
    you are exporting HOME for echo, but it is needed by mysql. move it so it becomes :

    HOME=/home/zabbix mysql
    Zabbix 3.0 Network Monitoring book

    Comment

    • emathis
      Junior Member
      • Jun 2012
      • 2

      #3
      Thanks much as that works perfectly. seems I just needed a second set of eyes to catch my obvious miskate.

      I still don't understand why thats even needed as the agentd is already running the zabbix user account and thus the commands ran from it should inherit that same environment.

      Anyway Thanks again!

      Comment

      Working...