Positional parameters for item names
While we're working with items, let's explore some more tricks:
- Go to Configuration | Hosts
- Click on Items next to Another host
- Click on Incoming traffic on interface enp0s8 (or whatever interface you have) in the Name column
- In the item-editing form, click on the Clone button at the bottom
- In the new form, modify the Key field so that it reads net.if.in[lo]
- 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.