Let's assume we have a Linux host that has three ethernet cards - eth0, eth1 and eth2. Rather than create three service checks which reference these interfaces explicitly, we'll configure a single Interface Throughput check that will be duplicated for each network card that a host has.
1. Create the attribute
First we'll create an attribute called "NIC" so that we can store this metadata against the host. Go to Advanced -> Attributes -> Actions -> Create new attribute and enter a name of NIC, then save it.
2. Define the attribute for one or more hosts
Now that the attribute is known to the system, it can be applied to some hosts. In this example, we edit the Linux host, and under the "Attributes" tab, add three entries all with a label of NIC, with the values eth0, eth1 and eth2.
Now that we have some metadata about the host, we can create a service check that uses it. The screenshot shows the configured service check - the "Multiple" prefix indicates that we have selected "NIC" as the value for Create Multiple Services under the Advanced section of the check configuration, and so at reload time Opsview will create three service checks, replacing %NIC% with each of the three values.
4. Apply the new check to the host
The check can either be applied directly on the Monitors tab of the host configuration, or using a Host Template. Once the check has been applied, reload Opsview and navigate to the host status. You should now see three services, one for each ethernet card that you have defined for the host.
This new service check can now be applied to any number of hosts you wish, and you simply need to define as many NIC attributes as you need for that particular host. This example really just scratches the surface of how host attributes can help you better organise your server monitoring. You can find out more about attributes on our documentation site and try it out for yourself by downloading Opsview Community Edition.
Find your next job with techworld jobs