Ad Widget

Collapse

Low-Level Discovery preprocessing questions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TomasC
    Junior Member
    • Jul 2023
    • 1

    #1

    Low-Level Discovery preprocessing questions

    Hello,

    I am creating a Zabbix template to monitor a commercial software package.
    I am using a lot of Low-Level Discovery (LLD) and it works.
    However, some of the preprocessing rules seem redundant, so I am wondering if I am perhaps not using the most effective/efficient way of monitoring.

    The application is connected to cameras. For each camera, I would like to monitor the processing lag, and also run some checks on the camera itself. This seems to me to mean a discovery rule with an item prototype and a host prototype.

    On the system with the zabbix-agent, I've created a script that produces the output for Zabbix to consume, /usr/local/bin/zabbixscripts/cameras.sh. It produces output like this:
    Code:
    [
      {
        "id": "camera001",
        "version": 1,
        "ip": "10.3.0.7",
        "lag": 83
      },
      {
        "id": "camera002",
        "version": 2,
        "ip": "10.3.0.8",
        "lag": 116
      },
      {
        "id": "camera003",
        "version": 2,
        "ip": "10.3.0.9",
        "lag": 97
      }
    ]​
    This is how I configure this in Zabbix:
    1. In the Zabbix agent configuration, add
      Code:
      UserParameter=cameras.get,/usr/local/bin/zabbixscripts/cameras.sh
    2. In Zabbix server, in the template, create a new item and in Tab Item:
      1. Name: cameras information
      2. Type Zabbix agent (active)
      3. Key "cameras.get"
      4. Type of information: Text
      5. Update interval 10m
    3. Click the three dots next to the new item and choose "Create dependent discovery rule"
      1. Tab Discovery rule:
        1. Name: Discovery rule for cameras
        2. Type: Dependent item
        3. Key: cameras.discovery
        4. Master item: template: cameras.get
      2. Tab LLD macros
        1. {#ID}: $.id
        2. {#VERSION}: $.version
        3. {#IP}: $.ip
        4. {#LAG}: $.lag
    4. In the discovery rule list, click item prototypes and Create item prototype
      1. Tab Item prototype
        1. Name: Camera {#ID} lag
        2. Type: Dependent item
        3. Key: camera.lag[{#ID}]
        4. Type: Numeric (unsigned)
        5. Master item: template: cameras.get
      2. Tab Preprocessing
        1. JSONPath: $.[?(@.id=='{#ID}')].lag.first()
    5. In the discovery rule list, click host prototypes and Create host prototype
      1. Host tab:
        1. Host name: camera {#ID}
        2. Templates: camera_test_template
        3. Groups: cameras
        4. Interfaces: SNMP, {#IP}
    This works, I get for each camera an item showing the lag, and also each camera is discovered as its own host with template camera_test_template applied.

    Questions:
    • Is the item prototype preprocessing required? It seems it already knows which item of the array it is working with (#ID is already set to one specific camera), but at the same time it needs a JSONPath to select the specific camera from the array? For the host prototype, the preprocessing doesn't seem to be required?
    • Can I skip the creation of the item (step 2 above) and just create a discovery rule of type Zabbix agent (active) and key "cameras.get"? I have tried, but can't get it to work.
      • Would this impact performance?
    • The LLD macros seem superfluous: can I skip these macros if I change the output of the script from
      Code:
      {"id": "x", "ip": "127.0.0.1", ...}
      to
      Code:
      {"{#ID}": "x", "{#IP}": "127.0.0.1", ...}
      ?
Working...