Ad Widget

Collapse

Extension to Zabbix discovery [zbxlld]

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • skarllot
    Junior Member
    • Oct 2011
    • 21

    #1

    Extension to Zabbix discovery [zbxlld]

    I'm happy to announce that I've created a project to extenting the Zabbix discovery called zbxlld.

    History
    • 2014-02-07: v0.6.1
      - Fixed exception when tries to read PerfMon duplicated keys (Thanks to aib).

    • 2013-05-29: v0.6
      - New feature offers macro suffix to allow duplicated discovery.

    • 2013-05-02: v0.5.1
      - Fixed compatibility to Windows XP.

    • 2013-05-02: v0.5
      - Added {#FSPERFMON} macro that returns Performance Monitor instance name.
      - Modified {#FSCAPTION} to return 6 characters from GUID instead of 4.

    • 2013-04-28: v0.4
      - Tidied "drive.discovery" filters to meaningful names.
      - Now fixed volumes are divided into three categories: folder mounted, letter mounted and unmounted.
      - Fixed {#FSNAME} to return full original name, no replaces or trims.
      - Added {#FSCAPTION} macro that returns friendly display name.
      - Fixed JSON output to not print comma after last item.
      - Fixed JSON output to escape all backslashes and double quotation marks.
      - Fixed exception to print null volume label.

    • 2013-04-26: v0.3
      The highlights are:
      - Option "drive.discovery.fixed" now returns volumes without letters too (folder mounted volumes).
      - New option to return folder mounted volumes.
      - New option to return volumes with assigned letter.
      - New option to return volumes with page file.
      - New option to return volumes without page file.

    • 2013-01-04: v0.2
      The highlights are:
      - New service discovery feature.

    • 2012-12-21: v0.1
      The highlights are:
      - Allow multiple discovery to the same key.
      - Discovery keys returns only useful data.
      - Discovery returns drive label.
      - Discovery returns network interface friendly name.
      - I'ts GPL 3.


    Links
    - How-to install and manual: https://github.com/skarllot/zbxlld/wiki
    - Development page: https://github.com/skarllot/zbxlld

    Any feedback is welcome.
    Last edited by skarllot; 07-02-2014, 17:01. Reason: Version 0.6.1 released
  • skarllot
    Junior Member
    • Oct 2011
    • 21

    #2
    Reserved.

    Any feedback is welcome.
    Last edited by skarllot; 26-04-2013, 17:03.

    Comment

    • qix
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Oct 2006
      • 423

      #3
      Great work!

      I see you've also put in a component for service discovery.
      You might be interested to vote on https://support.zabbix.com/browse/ZBXNEXT-1368 if you would like this integrated into the agent.
      With kind regards,

      Raymond

      Comment

      • skarllot
        Junior Member
        • Oct 2011
        • 21

        #4
        The version 0.3 was released, please check main post for details.

        Comment

        • nick0909
          Member
          • Apr 2013
          • 73

          #5
          This looks awesome! I especially like the idea of knowing about folder mounted drives for HyperV hosts using CSV. Is there any way to get this contributed back to the project and included in the agent? I am not sure I will get approval to run the utility on our servers unless it is part of the normal distribution.

          Comment

          • skarllot
            Junior Member
            • Oct 2011
            • 21

            #6
            Originally posted by nick0909
            This looks awesome! I especially like the idea of knowing about folder mounted drives for HyperV hosts using CSV. Is there any way to get this contributed back to the project and included in the agent? I am not sure I will get approval to run the utility on our servers unless it is part of the normal distribution.
            I'll look for it. Need some code porting first.
            You can't get approval even compiling by yourself?

            Comment

            • skarllot
              Junior Member
              • Oct 2011
              • 21

              #7
              I've fixed the download link for v0.3. The link was pointing to v0.2 instead.
              Sorry everyone.

              Comment

              • skarllot
                Junior Member
                • Oct 2011
                • 21

                #8
                Extension to Zabbix discovery - zbxlld v0.5

                The version 0.5 was released, please check main post for details.

                Comment

                • marcello
                  Junior Member
                  • May 2013
                  • 2

                  #9
                  using volume label macro into disk discovery with zbxlld

                  Hi skarllot,

                  really great job! I was looking for LLD using volume label as a macro and i've found you zbxlld!

                  I'm quite new on zabbix , and I would like to distinguish the disk/volume based on Label.
                  This mainly to separate disks used by applications (IE: DB disks, with DB services and DB items) to disks used for Paging or System.
                  My idea is to have triggers different for different "kind" of disk (IE: Paging disks no alert, DB Disk alert on 5% of free space, System drive alert at 100MB of free space).

                  I was thinking to use the Volume Label to distinguish kind of disks.

                  This is what I've done.


                  New template (just to test it) with a Discovery Rule called "Discovery Volume Swap"
                  Type: Zabbix Agent
                  Key: zbxlld[drive.discovery.swap]
                  Update interval: 30 sec (just to test)
                  Filter: no filter (just to test)

                  Inside I've created an item prototype (name is just to see macro values returned :-) )
                  Name: Free disk space (Swap) on {#FSNAME}, label "{#FSLABEL}", type ({#FSFORMAT})
                  Type: Zabbix agent
                  Key: vfs.fs.size[{#FSNAME},free]
                  Type: numeric (unsigned)
                  Data type: decimal
                  Units: B
                  Update intervals: 30

                  This stuff works well! :-)

                  Now came the problems, when I try to add the same items BUT for NON Swap disk

                  This is what I've done:
                  Another Discovery Rule called "Discovery Volume NoSwap"
                  Type: Zabbix Agent
                  Key: zbxlld[drive.discovery.noswap]
                  Update interval: 30 sec (just to test)
                  Filter: no filter (just to test)

                  Inside I've created an item prototype
                  Name: Free disk space (noSwap) on {#FSNAME}, label "{#FSLABEL}", type ({#FSFORMAT})
                  Type: Zabbix agent
                  Key: vfs.fs.size[{#FSNAME},free]
                  Type: numeric (unsigned)
                  Data type: decimal
                  Units: B
                  Update intervals: 30

                  When I save it I receive this error: " Item with key "vfs.fs.size[{#FSNAME},free]" already exists on "Test_New_Discovery_Template"."
                  Is there a way to achive the result I need? The key is the same, I know, but the disks are differents (swap disks vs no swap disks).
                  The original idea was to build a discovery of all mounted disks (drive.discovery.mounted) and use filter with {#FSLABEL} macro to distinguish "kind" of disks

                  I'm doing something wrong ?
                  Any suggestions are welcome :-)

                  Best regards
                  Marcello

                  Comment

                  • skarllot
                    Junior Member
                    • Oct 2011
                    • 21

                    #10
                    Originally posted by marcello
                    Hi skarllot,

                    really great job! I was looking for LLD using volume label as a macro and i've found you zbxlld!

                    I'm quite new on zabbix , and I would like to distinguish the disk/volume based on Label.
                    This mainly to separate disks used by applications (IE: DB disks, with DB services and DB items) to disks used for Paging or System.
                    My idea is to have triggers different for different "kind" of disk (IE: Paging disks no alert, DB Disk alert on 5% of free space, System drive alert at 100MB of free space).

                    I was thinking to use the Volume Label to distinguish kind of disks.

                    This is what I've done.


                    New template (just to test it) with a Discovery Rule called "Discovery Volume Swap"
                    Type: Zabbix Agent
                    Key: zbxlld[drive.discovery.swap]
                    Update interval: 30 sec (just to test)
                    Filter: no filter (just to test)

                    Inside I've created an item prototype (name is just to see macro values returned :-) )
                    Name: Free disk space (Swap) on {#FSNAME}, label "{#FSLABEL}", type ({#FSFORMAT})
                    Type: Zabbix agent
                    Key: vfs.fs.size[{#FSNAME},free]
                    Type: numeric (unsigned)
                    Data type: decimal
                    Units: B
                    Update intervals: 30

                    This stuff works well! :-)

                    Now came the problems, when I try to add the same items BUT for NON Swap disk

                    This is what I've done:
                    Another Discovery Rule called "Discovery Volume NoSwap"
                    Type: Zabbix Agent
                    Key: zbxlld[drive.discovery.noswap]
                    Update interval: 30 sec (just to test)
                    Filter: no filter (just to test)

                    Inside I've created an item prototype
                    Name: Free disk space (noSwap) on {#FSNAME}, label "{#FSLABEL}", type ({#FSFORMAT})
                    Type: Zabbix agent
                    Key: vfs.fs.size[{#FSNAME},free]
                    Type: numeric (unsigned)
                    Data type: decimal
                    Units: B
                    Update intervals: 30

                    When I save it I receive this error: " Item with key "vfs.fs.size[{#FSNAME},free]" already exists on "Test_New_Discovery_Template"."
                    Is there a way to achive the result I need? The key is the same, I know, but the disks are differents (swap disks vs no swap disks).
                    The original idea was to build a discovery of all mounted disks (drive.discovery.mounted) and use filter with {#FSLABEL} macro to distinguish "kind" of disks

                    I'm doing something wrong ?
                    Any suggestions are welcome :-)

                    Best regards
                    Marcello
                    You done everything right, but the key duplicate checking from Zabbix Web interface is buggy(?).
                    To work around that I modified zbxlld to accept macro suffix as parameter. Please download v0.6.

                    You can create the discovery rules as follow:
                    - First discovery
                    Discovery key: zbxlld[drive.discovery.swap,_SWAP]
                    Item prototype key: vfs.fs.size[{#FSNAME_SWAP},free]
                    Item prototype name: Free disk space (Swap) on {#FSNAME_SWAP}, label "{#FSLABEL_SWAP}", type ({#FSFORMAT_SWAP})


                    - Second discovery
                    Discovery key: zbxlld[drive.discovery.noswap,NULL]
                    Item prototype key: vfs.fs.size[{#FSNAME},free]
                    Item prototype name: Free disk space (noSwap) on {#FSNAME}, label "{#FSLABEL}", type ({#FSFORMAT})


                    Ok?

                    Comment

                    • marcello
                      Junior Member
                      • May 2013
                      • 2

                      #11
                      Originally posted by skarllot
                      You done everything right, but the key duplicate checking from Zabbix Web interface is buggy(?).
                      To work around that I modified zbxlld to accept macro suffix as parameter. Please download v0.6.

                      You can create the discovery rules as follow:
                      - First discovery
                      Discovery key: zbxlld[drive.discovery.swap,_SWAP]
                      Item prototype key: vfs.fs.size[{#FSNAME_SWAP},free]
                      Item prototype name: Free disk space (Swap) on {#FSNAME_SWAP}, label "{#FSLABEL_SWAP}", type ({#FSFORMAT_SWAP})


                      - Second discovery
                      Discovery key: zbxlld[drive.discovery.noswap,NULL]
                      Item prototype key: vfs.fs.size[{#FSNAME},free]
                      Item prototype name: Free disk space (noSwap) on {#FSNAME}, label "{#FSLABEL}", type ({#FSFORMAT})


                      Ok?


                      hi skarllot,

                      WOW!!
                      thank you so much!

                      you are great!!

                      i download the update and test it right now.

                      best regards
                      marcello

                      Comment

                      • alfsolli
                        Junior Member
                        Zabbix Certified Trainer
                        Zabbix Certified Specialist
                        • Aug 2010
                        • 19

                        #12
                        Incorrect JSON returned?

                        Anyone else failing when trying to use this with Zabbix 2.2 ?

                        Seems that the returned value of zbxlld[service.discovery.auto] is not valid JSON.

                        The problem, as far as I've been able to verify, is a trailing , on the last parameter in each service.


                        Example;

                        {
                        "{#SVCNAME}":"wuauserv",
                        "{#SVCDESC}":"Automatic Updates",
                        "{#SVCSTATUS}":"Running",
                        "{#SVCSTARTTYPE}":"Auto", <- that guy.
                        },

                        Zabbix 2.2 now does proper JSON validation, so this worked before. :\

                        Quick fix, or do I need to learn C# ?

                        - Alf -

                        Comment

                        • skarllot
                          Junior Member
                          • Oct 2011
                          • 21

                          #13
                          I'll provide a quick fix today.

                          Comment

                          • skarllot
                            Junior Member
                            • Oct 2011
                            • 21

                            #14
                            Originally posted by skarllot
                            I'll provide a quick fix today.
                            As noted this issue was resolved at version 0.4.

                            Comment

                            • aib
                              Senior Member
                              • Jan 2014
                              • 1615

                              #15
                              Hello!

                              I just downloaded version 0.6 and try to use it.
                              1) file zbxlld-win.exe copied into c:\zabbix_agent
                              2) UserParameters added to zabbix_agentd.win.conf
                              UserParameter=zbxlld[*],C:\Zabbix_Agent\zbxlld-win.exe $1 $2 $3
                              3) I try to test it from command line

                              Code:
                              [root@zabbix zabbix]# zabbix_get -s 10.1.10.137 -k zbxlld[drive.discovery.mounted]
                              {"data": [
                                      {
                                              "{#FSNAME}":"C:\\",
                                              "{#FSPERFMON}":"C:",
                                              "{#FSLABEL}":"",
                                              "{#FSFORMAT}":"NTFS",
                                              "{#FSCAPTION}":"C:"
                                      }
                              ] }
                              [root@zabbix zabbix]# zabbix_get -s 10.1.10.137 -k zbxlld[drive.discovery.removable]
                              {"data": [
                              
                              ] }
                              [root@zabbix zabbix]# zabbix_get -s 10.1.10.137 -k zbxlld[drive.discovery.swap]
                              {"data": [
                                      {
                                              "{#FSNAME}":"C:\\",
                                              "{#FSPERFMON}":"C:",
                                              "{#FSLABEL}":"",
                                              "{#FSFORMAT}":"NTFS",
                                              "{#FSCAPTION}":"C:"
                                      }
                              ] }
                              [root@zabbix zabbix]# zabbix_get -s 10.1.10.137 -k zbxlld[drive.discovery.        mountfolder]
                              {"data": [
                              
                              ] }
                              but...
                              Code:
                              [root@zabbix zabbix]# zabbix_get -s 10.1.10.137 -k zbxlld[drive.discovery.fixed]
                              
                              Unhandled Exception: System.TypeInitializationException: 
                              The type initializer for 'zbxlld.Windows.Supplement.PerfMon.LogicalDisk' threw an exception. 
                              ---> System.TypeInitializationException: The type initializer for 'zbxlld.Windows.Supplement.PerfMon.Localization' threw an exception. 
                              ---> System.ArgumentException: An item with the same key has already been added.
                              ...............
                              
                              [root@zabbix zabbix]# zabbix_get -s 10.1.10.137 -k zbxlld[drive.discovery.nomount]
                              
                              Unhandled Exception: System.TypeInitializationException: 
                              The type initializer for 'zbxlld.Windows.Supplement.PerfMon.LogicalDisk' threw an exception        . 
                              ---> System.TypeInitializationException: The type initializer for 'zbxll        d.Windows.Supplement.PerfMon.Localization' threw an exception. 
                              ---> System        .ArgumentException: An item with the same key has already been added.
                              .....................
                              
                              [root@zabbix zabbix]# zabbix_get -s 10.1.10.137 -k zbxlld[drive.discovery.noswap] 
                              Unhandled Exception: System.TypeInitializationException: 
                              The type initializer for 'zbxlld.Windows.Supplement.PerfMon.LogicalDisk' threw an exception. 
                              ---> System.TypeInitializationException: The type initializer for 'zbxlld.Windows.Supplement.PerfMon.Localization' threw an exception. 
                              ---> System.ArgumentException: An item with the same key has already been added.
                              ..................................
                              Do I have to use the different syntax for commands which threw an exception?
                              Sincerely yours,
                              Aleksey

                              Comment

                              Working...