Ad Widget

Collapse

Problem with MSSQL by zabbix-agent2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mfortes
    Senior Member
    • Oct 2019
    • 416

    #1

    Problem with MSSQL by zabbix-agent2

    I'm trying to configure my Zabbix agent 2 to monitor the MSSQL database that has several instances on this machine...
    The installed agent is type 2, 7.0 and the plugins (mssql) are also in the same version.

    According to all the documentation, it SHOULD be working, but I keep receiving unknown metrics from MSSQL items, which shows that the plugin is not working correctly...

    According to the documentation, the only thing that keeps failing when I add it to the mssql .conf is Plugins.MSSQL.System.Path... in some documentation they tell me to point to the mssql binary, others to the mssql binary plugin...
    Has anyone been through this and knows how to configure it correctly?


    Michael R. Fortes

    Linkedin: Mike Fortes
    Medium: mromeiro-f
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4811

    #2
    Docs say: plugin executable..

    Plugins.MSSQL.System.Path

    Path to the MSSQL plugin executable.

    Example usage:
    Plugins.MSSQL.System.Path=/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-mssql

    Comment

    • mfortes
      Senior Member
      • Oct 2019
      • 416

      #3
      i tried this... my plugin is on C:\Program Files\Zabbix Agent 2\conf\zabbix_agent2.d\plugins.d and the executable on C:\Program Files\Zabbix Agent 2\
      already tried
      Plugins.MSSQL.System.Path="C:\Program Files\Zabbix Agent 2\zabbix-agent2-plugin-mssql.exe"
      Plugins.MSSQL.System.Path="C:\Program Files\Zabbix Agent 2\zabbix-agent2-plugin-mssql"
      Plugins.MSSQL.System.Path=C:\Program Files\Zabbix Agent 2\zabbix-agent2-plugin-mssql.exe
      Plugins.MSSQL.System.Path=C:\Program Files\Zabbix Agent 2\zabbix-agent2-plugin-mssql
      Plugins.MSSQL.System.Path='C:\Program Files\Zabbix Agent 2\zabbix-agent2-plugin-mssql.exe'
      Plugins.MSSQL.System.Path='C:\Program Files\Zabbix Agent 2\zabbix-agent2-plugin-mssql'

      i hate windows HAHA


      Michael R. Fortes

      Linkedin: Mike Fortes
      Medium: mromeiro-f

      Comment

      • markfree
        Senior Member
        • Apr 2019
        • 868

        #4
        Did you try to "escape" the backslashes ( \ )?

        Comment

        • mfortes
          Senior Member
          • Oct 2019
          • 416

          #5
          yeah, something like 'C:\\Program Files\\Zabbix Agent 2\\zabbix-agent2-plugin-mssql'


          Michael R. Fortes

          Linkedin: Mike Fortes
          Medium: mromeiro-f

          Comment

          • mfortes
            Senior Member
            • Oct 2019
            • 416

            #6
            Originally posted by mfortes
            yeah, something like 'C:\\Program Files\\Zabbix Agent 2\\zabbix-agent2-plugin-mssql'
            but isn't work


            Michael R. Fortes

            Linkedin: Mike Fortes
            Medium: mromeiro-f

            Comment

            • cyber
              Senior Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • Dec 2006
              • 4811

              #7
              my plugin is on C:\Program Files\Zabbix Agent 2\conf\zabbix_agent2.d\plugins.d and the executable on C:\Program Files\Zabbix Agent 2\
              so where is it then.. in /plugins.d or directly in agents directory? Or is it plugin config in /plugins.d? Assuming your plugin executable is directly in agents directory and there is no separate "plugins" directory (plugin install zip file contains /plugin and /conf in some reason, probably just need to extract to your desired places...)
              Code:
              Plugins.MSSQL.System.Path=C:\Program Files\Zabbix Agent 2\zabbix-agent2-plugin-mssql.exe
              Based on all examples I can find locally about paths in windows agent config... this should work, without any additional ""-s or ''-s or double backslashes... If this does not work, please provide any evidence, that this is the faulty line.. THere must be something in logs...

              Comment

              • mfortes
                Senior Member
                • Oct 2019
                • 416

                #8
                Even increasing the log level, they just say "Unknown metric mssql.availability.group.get" or any other key when try to use mssql plugin.
                Already tried without ' and " , already tried change the path, especified the .exe or not... NOTHING works, everytime i add this line, my zabbix agent2 service doesnt start... i installed this with .msi available on the rep... i'lll try to compile the binaries and try this way


                Michael R. Fortes

                Linkedin: Mike Fortes
                Medium: mromeiro-f

                Comment

                • cyber
                  Senior Member
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Dec 2006
                  • 4811

                  #9
                  "Unknown metric mssql.availability.group.get" this says to me, that agent does not recognize the item key. This may happen, if it has not included the plugin config in some reason... Is the mssql.conf file included? That Include= parameter in config? Pointing correctly? Restarted agent after including it ? IT seems silly question, but I have seen too many times, when "restart resolved my problem".. and it turns out, people just edited config, but never reloaded it..
                  Locally zabbix_agent2 -p from command line should show you all recognized keys... if mssql related keys are not showing up, you have issue with including that plugin...

                  Comment

                  • Brambo
                    Senior Member
                    • Jul 2023
                    • 245

                    #10
                    Check your agent log first if "using plugin 'MSSQL' (C:\Program Files\Zabbix Agent 2\plugins\zabbix-agent2-plugin-mssql.exe) providing following interfaces: exporter, runner, configurator" is shown. Then you know if the conf file path is set correct.
                    Simple restart the agent to see if this line is shown.
                    In a seperate conf file (which I include from the agent.conf) I have the line: "Plugins.MSSQL.System.Path=C:\Program Files\Zabbix Agent 2\plugins\zabbix-agent2-plugin-mssql.exe" (without the quotes) and
                    Plugins.MSSQL.CustomQueriesDir=C:\Program Files\Zabbix Agent 2\mydir\customSQL

                    Comment

                    • bleckmeister1g
                      Junior Member
                      • Dec 2024
                      • 1

                      #11
                      In case someone still searches this you need a few thing for this to work

                      1) zabbix agent 2 and zabbix agent 2 plugins --> https://cdn.zabbix.com/zabbix/binari...ble/7.0/7.0.6/
                      2) create a user on your db and give it the appropriate rights. I have personally gave the user a sysadmin role , but understand that this is not recommended. Personally id suggest an AD User and the password to be vaulted
                      3) edit your .conf file and add Include=.\zabbix_agent2.d\plugins.d\*.conf (if it is not there)
                      4) edit the mssql.conf file in the plugins.d directory and add at the end of the file these 4
                      Plugins.MSSQL.System.Path=C:\Program Files\Zabbix Agent 2\zabbix-agent2-plugin-mssql.exe
                      Plugins.MSSQL.KeepAlive=300
                      Plugins.MSSQL.Default.Uri=sqlserver://<serverip>:<port> write them without the <> like sqlserver://192.168.1.1:1433
                      Plugins.MSSQL.Default.User=user (the database user you created)
                      Plugins.MSSQL.Default.Password=password (the db user password)


                      things to watch out
                      If you already have zabbix agent 1 and you install the agent 2 then you should use another port for the agent2. My suggestion is to delete agent 1 completely (with sc.exe delete Zabbix Agent) and install agent 2 and use 1 port that makes your life easier. Do not forget to unlink Windows template by zabbix agent and add windows template by zabbix agent 2. Also everything that you already had running will continue running as there is an overlap of the items between template 1 and 2.

                      Comment

                      • markfree
                        Senior Member
                        • Apr 2019
                        • 868

                        #12
                        I could not find the plugin on Zabbix's Git.
                        The doc suggests downloading the plugin from Zabbix Git, but it is not available.

                        Also, the agent package does not provide the plugin executable.

                        Where did you guys get the "zabbix-agent2-plugin-mssql.exe" file?

                        Comment

                        • Brambo
                          Senior Member
                          • Jul 2023
                          • 245

                          #13
                          As you write .exe I assume windows platform.
                          The stable binaries can be found here: https://cdn.zabbix.com/zabbix/binaries/stable/
                          If you are looking for latest 7.2 version: https://cdn.zabbix.com/zabbix/binari...le/7.2/latest/ download the zabbix_agent2_plugins-7.2-latest-windows-amd64 with the .zip or .msi extenstion

                          Comment

                          • markfree
                            Senior Member
                            • Apr 2019
                            • 868

                            #14
                            Thanks Brambo.

                            It puzzles me that I cannot find a link in the documentation that actually takes us to the file download.

                            Comment


                            • Brambo
                              Brambo commented
                              Editing a comment
                              Been there as well, and it also was a blackhole puzzle for me to find it the first time.
                          • markfree
                            Senior Member
                            • Apr 2019
                            • 868

                            #15
                            I just opened issue ZBX-26430 for this, hoping to improve the documentation.
                            Voting on this issue may help prioritize it.

                            Comment

                            Working...