No announcement yet.

Is there any point in using key parameters with trappers?

  • Filter
  • Time
  • Show
Clear All
new posts

    Is there any point in using key parameters with trappers?

    Hi there!
    I'm using zabbix 2.0.8 to monitor a series of remote hosts. "remote" meaning, there is no direct connection to them - I only retrieve data by
    • having scripts run periodically on the hosts
    • storing the results in a local file
    • uploading the file to our FTP server
    • downloading it periodically from our FTP server and
    • using zabbix_sender to feed the trapper items into zabbix
    Now these hosts are different from one another - one host might provide items HDFreeSpaceC and HDFreeSpaceF, the other might provide HDFreeSpace/ and HDFreeSpace/boot, so I'm wondering if I could make good use of key parameters (the ones in square brackets). My idea was something like
    • setting up an item HDFreeSpace
    • use zabbix_sender to provide, e.g., HDFreeSpaceC and HDFreeSpaceF
    • defining a trigger, e.g., {HostName:HDFreeSpace
    • <5G}
    I was hoping that zabbix would magically expand the HDFreeSpace[*] and would trigger if any of my items fell below that threshold. I've already learned from this thread that "setting up an item HDFreeSpace[*]" will not work. But still, assuming I've set up HDFreeSpace[C] and HDFreeSpace[F], would I gain any magic as opposed to calling my keys HDFreeSpaceC and HDFreeSpaceF?
    Basically it boils down to: what's the point of this square bracket notation? Is it only used to provide information to a zabbix agent to tell it what data to retrieve? So once zabbix has stored the data in the item, the parameter is of no use at all (besides that I can label my item like "Free space on partition $1")?

    Thanks in advance for any enlightening remarks!

    No, you can't use HDFreeSpace[*].

    But you can use low level discovery. Even if you use zabbix sender. You must send data in the right format and discovery item must be zabbix trapper type. Example of discovery data for filesystem:
    vfs.fs.discovery {"data":[{"{#FSNAME}": "/"},{"{#FSNAME}":"/boot"},{"{#FSNAME}":"/data"},{"{#FSNAME}":"/tmp"},{"{#FSNAME}":"/usr"},{"{#FSNAME}":"/var"}]}
    Items, triggers will be created for every discovered filesystem automatically by zabbix, so then you can send your metric keys in standard format with parameters e.g. vfs.fs.size[/boot,free].
    Devops Monitoring Expert advice: Dockerize/automate/monitor all the things.
    My DevOps stack: Docker / Kubernetes / Mesos / ECS / Terraform / Elasticsearch / Zabbix / Grafana / Puppet / Ansible / Vagrant


      Alright, thank you!
      I've remodelled my setup to use LLD even with trappers . Now I want to allow my derived hosts (the ones inheriting from my templates) to override, e.g., trigger thresholds. I know I can do so using macros, but sometimes things get rather complicated. Example 1, override the graph scaling:
      • In my discovery rule, I've created an item prototype of type Calculated
      • The formula is just the template, e.g., {$AX_{#DISCOVERED_THING}_MAX}
      • In my discovery rule, I've created a graph prototype
      • I've set the graph prototype to scale to the item prototype

      Is there an easier way to do this?

      Example 2, override function arguments in trigger prototype expressions:
      • I know I can use a macro in a function argument as in {Template_Name:LocalTimeSecondsOfDay.nodata({$TR_T IME_WITHOUT_DATA})}=1
      • I know I can use a macro in the formula of a calculated item prototype as in {$AX_{#DISCOVERED_THING}_MAX}
      • But I don't seem able to use such a formula in a trigger prototype directly:
      Trying to set up
      Cannot implode expression "{Template_Name:ItemPrototype[{#FILE_TYPE}].delta({$TR_{#FILE_TYPE})}<0". Incorrect trigger function "delta" provided in expression. Parameter sec or #num or user macro expected, "{$TR_{#FILE_TYPE}" given. [CTriggerPrototype.create -> CTriggerPrototype.createReal]
      Is there no way to do this?