Ad Widget

Collapse

Zabbix5.0 wmi.getall item key not supported

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jarne St
    Member
    • Sep 2019
    • 63

    #1

    Zabbix5.0 wmi.getall item key not supported

    I am currently testing with Zabbix 5.0 and the new functionality.

    According to the documentation wmi.get and wmi.getall are supported in Zabbix 5.
    The key wmi.get is perfectly working, but getall returns an error.

    If I test it with zabbix_get I get not supported:
    Code:
    zabbix_get -s 172.27.0.137 -k wmi.getall["root\cimv2","select * from Win32_Service"]
    ZBX_NOTSUPPORTED: Unsupported item key.
    zabbix_get -s 172.27.0.137 -k wmi.getall[root\cimv2,"select * from Win32_Service"]
    ZBX_NOTSUPPORTED: Unsupported item key.
    zabbix_get -s 172.27.0.137 -k wmi.getall[root\cimv2,select * from Win32_Service]
    zabbix_get [23876]: invalid parameter "OriginalSettings"
    zabbix_get [23876]: invalid parameter "from"
    zabbix_get [23876]: invalid parameter "Win32_Service]"
    Try 'zabbix_get --help' for more information.
    But with wmi.get, I get a result:
    Code:
    zabbix_get -s 172.27.0.137 -k wmi.get["root\cimv2","select * from Win32_Service"]
    False
    But If I use the same query on the local machine I get results (in power shell):
    Click image for larger version

Name:	Powershall query.png
Views:	4906
Size:	29.2 KB
ID:	403658
  • Jarne St
    Member
    • Sep 2019
    • 63

    #2
    Is it possible that the item is failing because there is a preprocessing step missing?
    Can someone share an example of when the item key wmi.getall is working?

    Comment

    • Hamardaban
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • May 2019
      • 2713

      #3
      zabbix_get -s ip_of_host -k 'wmi.getall[root\cimv2,SELECT * FROM Win32_IP4RouteTable]'

      zabbix_get -s ip_of_host -k 'wmi.getall[root\cimv2,select * from Win32_Service]'

      Comment

      • Jarne St
        Member
        • Sep 2019
        • 63

        #4
        I still don't understand it. What is the difference between this items and my item keys?

        zabbix_get -s ip_of_host -k 'wmi.getall[root\cimv2,SELECT * FROM Win32_IP4RouteTable]'

        zabbix_get -s ip_of_host -k 'wmi.getall[root\cimv2,select * from Win32_Service]'
        These still returned not supported.

        Comment

        • Hamardaban
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • May 2019
          • 2713

          #5
          The difference is in quotation marks. Check the version of the agent you are accessing.

          Comment

          • jameskirsop
            Member
            • Jul 2018
            • 32

            #6
            I have a similar problem with wmi.get and testing using `Zabbix_agent.exe -t`.

            This works:
            C:\Program Files\zabbix> .\zabbix_agentd.exe -t "wmi.get[root\mscluster,select FreeSpace from MSCluster_DiskPartition Where VolumeLabel='Volume1']"

            This does not:
            C:\Program Files\zabbix> .\zabbix_agentd.exe -t wmi.get[root\mscluster,select FreeSpace from MSCluster_DiskPartition Where VolumeLabel='Volume1']

            If I try and wrap the key in quotes in the Zabbix web interface (which should be unnecessary, but it seems from my tests to be the only way this will work) I get an "Invalid Key" error.

            I'm using this in a discovery job and getting "Cannot create item, error in formula: Invalid first parameter "wmi.get[Root\MSCluster"." for each item prototype.

            Comment

            • tim.mooney
              Senior Member
              • Dec 2012
              • 1427

              #7
              Do not wrap the (entire) key in quotes in the web interface. As you've discovered, that's an error.

              As Hamardaban has illustrated, when testing an item key at the shell level, you generally want to quote the entire thing, to protect characters that may be special characters to the command interpreter. The original question and Hamardaban's response were presumably done at the UNIX/Linux shell, but the same general idea applies to stuff run from the Windows PowerShell or command.exe . It just may be that the set of characters that are special to that command interpreter are different.

              For the web interface, it may be necessary to use quoting with some individual arguments (but again, not around the entire key). If you search these forums for 'wmi' related posts, you'll likely find several other older posts that show different quoting or back-slashing that was necessary to get a particular argument to be passed correctly to Windows.

              Comment

              • Jarne St
                Member
                • Sep 2019
                • 63

                #8
                wmi.get and wmi.getall are both supported in Zabbix 5.0

                If you receive an error it probably means that you need to upgrade the agent. (like in my case I upgraded the server, but forgot to upgrade the agent, so I was executing the wmi items keys on a zabbix-agent 4.0 and received logically these errors).
                But after an agent upgrade it works fine.

                My items in the frontend are now:
                Code:
                wmi.get[root\cimv2,"SELECT PercentProcessorTime FROM Win32_PerfRawData_PerfProc_Process WHERE Name = 'PVCCMonitor'"]
                wmi.get[root\cimv2,"SELECT PercentProcessorTime FROM Win32_PerfRawData_PerfProc_Process WHERE Name = 'PVCCPlus'"]
                wmi.get[root\cimv2,"SELECT PercentProcessorTime FROM Win32_PerfRawData_PerfProc_Process WHERE Name = 'PVCCTimerService'"]
                And:
                Code:
                wmi.getall[root\cimv2,"select * from win32_networkadapter where PhysicalAdapter=True"]
                Note that with wmi.getall you need to add a preprocessing step to get the actual value you want. Otherwise you got all the JSON in 1 item.

                Comment

                Working...