Ad Widget

Collapse

Could use some help on custom low level discovery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rcollier
    Member
    • Sep 2013
    • 53

    #1

    Could use some help on custom low level discovery

    Hello there,

    I am trying to get disk statistics information from my AIX servers into zabbix. I have written a script that outputs the following information in JSON format.

    Code:
    {
    
            "data":[
    
    
            {
    
                    "{#HDISKNAME}":"hdisk0",
                    "{#HDISKBUSY}":"0.0",
                    "{#HDISKKBPS}":"0.6",
                    "{#HDISKTPS}":"0.0",
                    "{#HDISKKBR}":"9630105",
                    "{#HDISKKBW}":"2635652"
            }
    
            ,
    
            {
    
                    "{#HDISKNAME}":"hdisk7",
                    "{#HDISKBUSY}":"0.0",
                    "{#HDISKKBPS}":"0.0",
                    "{#HDISKTPS}":"0.0",
                    "{#HDISKKBR}":"4375",
                    "{#HDISKKBW}":"8392"
            }
    
    
            ]
    
    }
    I am able to successfully create a discovery rule for the disks, and I am also to successfully create an item prototype using the build in vfs.dev.read items. Where I am not making the connection is how to use my own custom items. I am familiar with userparameters, maybe I should be using those here to get the information I need into Zabbix?

    Ideally what I want is an item that pulls in the disk name and data that I care about. Using the JSON output above as an example, I want to create an item prototype that has the name of the disk {#HDISKNAME} and a value {#HDISKBUSY}.

    I assumed that with my JSON output above I could simply create an item prototype and pull the information I wanted out of it. Can I do that? Does it require that I create another custom parameter?

    Thanks
  • Linwood
    Senior Member
    • Dec 2013
    • 398

    #2
    I think you are mixing up the discovery and returning items from an external check, though it is technically possible to use what you have.

    Normally a rule would return something like the "DISKNAME:hdisk0" portion (omitting all the surrounding syntax), and this would form an item by way of an item prototype, and the item's formation would would then do some different check (notably on a different and usually much more frequent interval) to retrieve the data. For example, it might include the disk name in an agent or snmp or other external check to pull the size, activity, etc.

    You have the actual polling data for statistics in the same json, so it is combining polling data with discovery data. Usually discovery data just returns identifying information, and then the item prototype polls.

    Now, all that said, and not usually a good idea (for speed reasons, as normal polling is faster than the overhead of external checks), it is also possible to let the item prototype build values, and thus let the discovery rule poll. In your case you could leave the LLD rule alone with that JSON coming back, and create individual item prototypes of type calculated, and return as the expression {#HDISKTPS}. That expression then does not actually DO a calculation, it is the calculation result, but zabbix is OK with that. The key has to include something like HDISKTPS[{#DISKNAME}] so it remains unique, but it doesn't actually poll. This is usually more of an interesting trick than the normal way to do things, but since you have the code already written it is a possibility.

    Comment

    • madchap
      Junior Member
      • May 2016
      • 4

      #3
      Nice answer, thank you :-) This just helped me out.

      Comment

      Working...