Positional parameters for item names

While we're working with items, let's explore some more tricks:

  1. Go to Configuration | Hosts
  2. Click on Items next to Another host 
  3. Click on Incoming traffic on interface enp0s8 (or whatever interface you have) in the Name column
  1. In the item-editing form, click on the Clone button at the bottom
  2. In the new form, modify the Key field so that it reads net.if.in[lo]
  3. Click on the Add button at the bottom

You might notice it right away, or go to Monitoring | Latest data and look at the list. Despite the fact that we only modified the key, the item name was updated accordingly as well:

That's what the $1 part in the item Name field is doing. It's working like a common positional parameter, taking the first parameter of the item key. If we had more parameters, we could access those for inclusion in the name with $2, $3, and so on. This is mostly useful in cases where you want to create several items that monitor different entities so that when cloning the items, you have to change only a single instance of the identifier. It's easier than it seems to miss some change when there are multiple locations, hence creating items with mismatched configuration.

Now that we have some more items configured, it's worth looking at another monitoring view. While we spent most of our time in Monitoring | Latest data, this time, navigate to Monitoring | Overview. The Type drop-down menu in the upper-right corner currently lists Triggers, which does not provide a very exciting view for us: we only have a single trigger created. But we did create several items, so switch this drop-down menu to Data:

This time, the overview page is a bit more interesting: we can see which hosts have which items and item values.

The usage of $1 to $9 in item names is deprecated so it's advised to not use this anymore as, in later versions, this might not work anymore. This is already true in 4.2 and it can also be that it is in 5.0; there is no plan yet when it will be removed completely (https://support.zabbix.com/browse/ZBXNEXT-4591).
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset