Ad Widget

Collapse

Monitoring MySQL on windows host ('mysqladmin' is not recognized as a command)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Maxburn
    Member
    • Sep 2019
    • 48

    #1

    Monitoring MySQL on windows host ('mysqladmin' is not recognized as a command)

    I have a bunch of servers running MySQL 8.0.31 and I know our config listens for MySQL on localhost only. I don't think that's a problem because the agent is on that server? I also have working zabbix active checks looking at log files on these servers that is working.

    I'm looking at these instructions, and they reference template_db_mysql.conf which I found here.

    That conf file mentions putting a my.cnf with DB user/password in the root of C but references these instructions talking about where MySQL looks for config files. Skipping those defaults I know that our service is calling this CLI to start MySQL;

    Code:
    "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld" --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" "MySQL 8.0"
    So I stuck a my.cnf file in C:\ProgramData\MySQL\MySQL Server 8.0 with these contents;

    Code:
    [client]
    user='user'
    password='password'
    I restarted both the Zabbix agent and MySQL and added Template DB MySQL to that host in Zabbix.

    Now Monitoring, Hosts, Latest data shows this;

    Code:
    Availability: MySQL status 9m 22s Down (0)​
    Info: MySQL version; no data and error;
    Preprocessing failed for: 'mysqladmin' is not recognized as an internal or external command,..operable program or batch file.
    1. Failed: cannot perform regular expression "(Server version)\s+(.+)" match for value of type "string": pattern does not match
    This file does exist; C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqladmin.exe

    Most instructions I see are of linux, but somebody out there must have this working on a windows host? Help?

    Zabbix agent log contains nothing useful;
    Code:
    4348:20221103:094849.954 Starting Zabbix Agent [WC-I44 Harris Offices]. Zabbix 5.0.21 (revision 47104dd574).
    4348:20221103:094849.956 **** Enabled features ****
    4348:20221103:094849.961 IPv6 support: YES
    4348:20221103:094849.964 TLS support: YES
    4348:20221103:094849.968 **************************
    4348:20221103:094849.971 using configuration file: C:\Program Files\Zabbix Agent\zabbix_agentd.conf
    4348:20221103:094851.713 agent #0 started [main process]
    7084:20221103:094851.721 agent #3 started[listener #2]
    5184:20221103:094851.722 agent #4 started[listener #3]
    7484:20221103:094851.724 agent [NODE="2"]Forum[/NODE] started[listener #1]
    968:20221103:094851.726 agent [NODE="1"]Home[/NODE] started [collector]
    5004:20221103:094851.727 agent #5 started [active checks #1]​​


    Zabbix server 6.0.9, agent is 5.0.21
  • Maxburn
    Member
    • Sep 2019
    • 48

    #2
    After twenty minutes or so this showed up in Zabbix in Monitoring, Hosts, Latest data;
    Info: Size of database 'mysql' is not recognized as an internal or external command,
    with info;
    Special characters "\, ', ", `, *, ?, [, ], {, }, ~, $, !, &, ;, (, ), <, >, |, #, @, 0x0a" are not allowed in the parameters

    Comment

    • Maxburn
      Member
      • Sep 2019
      • 48

      #3
      OK, first step is a little obvious. Our custom installer didn't add the environment path for MySQL bin. I added that manually and the error messages changed to this;


      Info: MySQL version​
      Preprocessing failed for:
      1. Failed: cannot perform regular expression "(Server version)\s+(.+)" match for value of type "string": pattern does not match
      ​Info: Size of database 'mysql' is not recognized as an internal or external command,
      Special characters "\, ', ", `, *, ?, [, ], {, }, ~, $, !, &, ;, (, ), <, >, |, #, @, 0x0a" are not allowed in the parameters.​

      Comment

      • Maxburn
        Member
        • Sep 2019
        • 48

        #4
        Deeper

        The script in zabbix agent uses;
        UserParameter=mysql.version[*], mysqladmin -s -h"$1" -P"$2" version



        In DOS that would translate to this after removing the silent option;
        mysqladmin -h"127.0.0.1" -P"3306" version



        That gets this error;
        C:\Users\scottjalbert.HISDC>mysqladmin -h"127.0.0.1" -P"3306" version
        mysqladmin: connect to server at '127.0.0.1' failed
        error: 'Access denied for user 'ODBC'@'localhost' (using password: NO)'​


        I'm not figuring out how that is supposed to work, unless the script supplies the user/pass somehow outside of that command.
        Last edited by Maxburn; 03-11-2022, 19:50.

        Comment

        • Maxburn
          Member
          • Sep 2019
          • 48

          #5
          Reference manual regarding option file location​

          Fixing that got this working.

          Comment

          Working...