Ad Widget

Collapse

user variable mysql syntax error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fallwor
    Junior Member
    • Mar 2013
    • 19

    #1

    user variable mysql syntax error

    Hello,

    On one of my servers I am running a MySQLd. System info:
    - Centos 6.5
    - mysql 5.1.73
    - zabbix agent 2.2.5.1

    I have the same setup on several other servers.
    In order to use a specific application on this server I had to upgrade the mysql to 5.5 with webstatic repos.
    After some time I downgraded it back to 5.1 due to incompatibility issues with other services.

    I enables unsafe user parameters in the zabbix_agent.conf.
    I added username and password to the userparameter_mysql.conf:

    I get the following logs:
    Code:
     13413:20140729:091736.924 cannot add user parameter "mysql.status[*] -uzobba -p------------,echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'": syntax error
    The original mysql password contained question- and exclamation marks. I removed them due to issues with those in the command line.

    The zabbix agent immediately stops after starting.

    Any advice?
  • jvalenzani
    Member
    Zabbix Certified Specialist
    • Sep 2010
    • 53

    #2
    MySql user and password (zobba / ----) must be set on the .my.cnf file (in your case: /var/lib/zabbix).
    Also, your UP is malformed. Correct format is UserParameter=key,command.
    So "-uzobba -p------------" are in the wrong side of the expression.

    The correct format is:
    Code:
    mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -uzobba -p------------ -N | awk '{print $$2}'
    But, as i said, use my.cnf file for credentials.

    Comment

    • fallwor
      Junior Member
      • Mar 2013
      • 19

      #3
      Hello,

      Thank you so much for your reply.
      I would like to use the .my.cnf file for the credentials, but I am a bit at a loss about the syntax I need to use. I could not find any examples.
      Something like this? $dbhandle = mysql_connect($hostname, $username, $password)

      Is it possible to post an example?

      Thanks a bunch!

      Comment

      • fallwor
        Junior Member
        • Mar 2013
        • 19

        #4
        I looked again and I found the following:
        # vim /var/lib/zabbix/.my.cnf
        [client]
        user=zobba
        password=---------------
        I created it and gave rights to the file to zabbix and restarted the agent:
        # service zabbix-agent restart
        Shutting down Zabbix agent: [FAILED]
        Starting Zabbix agent: [ OK ]
        # service zabbix-agent status
        zabbix_agentd is stopped
        The log still shows:
        23838:20140730:100629.000 cannot add user parameter "mysql.status[*] ,echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'": syntax error
        What else could be wrong? This is the default mysql file of the agent isnstallation.

        Comment

        • jvalenzani
          Member
          Zabbix Certified Specialist
          • Sep 2010
          • 53

          #5
          Please, verify that the config file has exactly this line:

          Code:
          UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'

          Comment

          • fallwor
            Junior Member
            • Mar 2013
            • 19

            #6
            Hey,

            I commented out the original command and placed yours. It certainly looks the same and I keep on getting the same errors.
            Could there be a fault in the mysql configuration?

            Comment

            • jvalenzani
              Member
              Zabbix Certified Specialist
              • Sep 2010
              • 53

              #7
              I don't think so. If Zabbix Agent stops is because it founds some error on the configuration file.
              Anyway, try executing the command from the shell prompt and see if works fine.

              Comment

              • tchjts1
                Senior Member
                • May 2008
                • 1605

                #8
                Originally posted by fallwor
                Hey,

                I commented out the original command and placed yours. It certainly looks the same and I keep on getting the same errors.
                Could there be a fault in the mysql configuration?
                Did you restart the agent process after you made changes?

                Comment

                • fallwor
                  Junior Member
                  • Mar 2013
                  • 19

                  #9
                  Originally posted by tchjts1
                  Did you restart the agent process after you made changes?
                  Yes. Every time I restart the zabbix-agent it starts OK but shuts down immediately.

                  I have 2 servers suffering from this. 3 other servers I monitor run fine with the same settings.

                  Would reinstalling zabbix-agent help?

                  Comment

                  Working...