Ad Widget

Collapse

Zabbix Inventory custom fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • greavette
    Member
    • Jul 2015
    • 82

    #1

    Zabbix Inventory custom fields

    Hello Team,

    I'm interested in using Zabbix inventory to capture the following types of detail from my servers:

    1. What's in each Dimm Slot (model #)
    2. Serial number of drive in each drive bay
    3. Date of each hard drive added
    4. License keys

    I'd like to be able to add some free form text fields where I can set the box titles so that I can use Zabbix as my CMDB for the hardware in our server closet and keep track of some critical data.

    Please advise if and how I would be able to add these fields to my Zabbix.

    Thank you.
  • brunohl
    Senior Member
    Zabbix Certified Specialist
    • Mar 2019
    • 215

    #2
    That's tricky. You are not able to add custom fields on the inventory unless you edit the Database and Config files. I did it, but I'm not sure I recommend.

    There are two ways you could do that:

    First:
    If you would like to do it anyway (watch out when you update and you cannot fill these values automatically), do this:
    - Create new column on host_inventory
    - Edit the file "include/hosts.inc.php"
    - Edite the file "include/schema.inc.php"
    Thats it

    Second:
    The second way is more difficult, but more stable. You should pick a big field (text field) and transform it in your text storage. You create a JSON object containing the things you want to monitor and store them inside this field.

    Comment

    • greavette
      Member
      • Jul 2015
      • 82

      #3
      Thank you brunohl for your suggestion. I don't like the idea of messing with the database and possibly making upgrades difficult. I'll have to find another way to record the data I need in an inventory database.

      Comment

      • kloczek
        Senior Member
        • Jun 2006
        • 1771

        #4
        Introducing custom inventory entries by adding more columns it would be really bad idea.

        Right way is should be done by transforming current inventory names to default inventoryid to which will be possible to map exact items and add three new tables: inventory (float), inventory_uint (int), and inventory_str (char or text). In each of those tables should be columns: inventory_name, inventoryid and inventory_value.
        Transforming database schema it is only 1/4 (easiest) part of such transformation. Biggest part of necessary changes will be rewrite php code and then zabbix server changes.
        Last part will be set of SQL queries moving existing static inventory content to dynamic representation during zabbix upgrade procedure.
        http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
        https://kloczek.wordpress.com/
        zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
        My zabbix templates https://github.com/kloczek/zabbix-templates

        Comment

        Working...