Ad Widget

Collapse

MySQL User Parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Villain
    Member
    • Aug 2006
    • 84

    #1

    MySQL User Parameters

    I am working with the MySQL Parameters, and unfortunately they are not working. We tried enabling the MySQL Queries Per Second, Slow Queries, and Threads UserParameters that were already defined in our zabbix_agentd.conf file, however they are reporting that the agent does not support these tasks.

    [user@monitor zabbix]$ mysqladmin -uroot status|cut -f9 -d":"
    66.898

    This is what I get sent back when I do one of the commands, so I know that there is data being returned. However, what is strange is the space before the 66.898 and the line break that is given afterwards.

    In our custom scripts that we use to gather other data for user params, we don't have the space or the line break, causing it to return something like:

    [user@monitor zabbix]$ mysqladmin -uroot status|cut -f9 -d":"
    66.898[user@monitor zabbix]$

    We're running 1.1.6 on this server and will up it to 1.1.7 if necessary (we're still debating on the 1.3 series).

    Thanks for any help that you can offer.
  • JonB
    Member
    • Oct 2006
    • 63

    #2
    You will find that the user zabbix (which the zabbix_agentd runs as) does not have permission to run mysqladmin or mysql.

    You will need to use sudo.

    Code:
    UserParameter=mysql.threads,sudo /usr/bin/mysqladmin -uroot status|cut -f3 -d":"|cut -f1 -d"Q"
    and add the following to the sudoers file using visudo

    Code:
    zabbix ALL=NOPASSWD: /usr/bin/mysqladmin, /usr/bin/mysql
    Jon

    Comment

    • glut0r
      Member
      • Mar 2007
      • 38

      #3
      Originally posted by JonB
      You will find that the user zabbix (which the zabbix_agentd runs as) does not have permission to run mysqladmin or mysql.

      You will need to use sudo.

      Code:
      UserParameter=mysql.threads,sudo /usr/bin/mysqladmin -uroot status|cut -f3 -d":"|cut -f1 -d"Q"
      and add the following to the sudoers file using visudo

      Code:
      zabbix ALL=NOPASSWD: /usr/bin/mysqladmin, /usr/bin/mysql
      Jon
      why using sudo if there's a better way.

      create user e.g. r00t with no password, and no grants nor permissions. Havent't checked it much, but I think any mysql user is able to read status.
      Even it he has no other rights. You will then be able to invoke mysqladmin status without using any password. This is much better and secure.

      Comment

      Working...