See for the official Zabbix site.

Docs/Triggers and Actions and Hosts

Jump to: navigation, search

Triggers and Actions and Hosts (Oh My!)

It took me quite a while to wrap my head around how to set up monitoring and triggers on my network. All of the functionality you want is in Zabbix, but the documentation does not really seem to take you by the hand and guide you through setting up some monitoring. I hope this article will supply the deficit.

The first thing you need to appreciate is the precedence of configuration steps to monitor a given host or service.

  |__ Item(s)
       |___ Trigger(s)

If you are wondering why this was not obvious to me, then this article is not for you. If you are just getting started with Zabbix and you share my initial confusion, then read on.


There are several ways to monitor a service running somewhere within your network, or even on the outside. The methods you use will depend on how much access you have to the host, and what sort of services you wish to monitor. In the case of a Web server Up/Down, you may use a regular port 80 request to make sure the server is answering. No need to install an agent. In the case of a Router, you will need to use SNMP queries to get your data. Basically, you may only get data that you have permission to get manually. Back to that Web server: Maybe Up/Down status is not good enough. What if your web site is pulling pages from a database? Apache may in fact be up, but the web page you are getting back is an error message about the database. In this case you may want to install a Zabbix Agent on that server so that you may also test the MySQL service. The Zabbix manual provides lots of information on these topics.

The title of this Article "Triggers and Items and Hosts (Oh My!)" is actually backwards. You begin with defining a Host:

Add Host

Log into your administrator web interface, go to the Configuration screen and select Hosts. Click the Create Host button.

  • Name: The name used here should identify the target host, OR the type of tests you will be running. Bear in mind that you will most often create several items for each Host. If you are testing for the availability, CPU utilization, ethernet load, etc. on your application server, chances are you will use the common name of that server here. On the other hand, if you are calling Zabbix agent service on the localhost (server) or another server for the purpose of testing availability of distributed services such as DNS, NTP, POP, etc., then you may want to give this host a name like "Network Services".
  • Groups: you may associate your host with an existing group like Agent_Hosts or Windows. It is even more useful to create new groups like Routers, Switches, Application_Servers. The group association makes it easier for you to navigate your Hosts, Items, and Triggers screens in order to find a particular entity.
  • Use IP address: I am guessing that if you do not use an IP address here, then Zabbix assumes you are referring to localhost. I always use the IP address.
  • Port: If you will only be doing an ICMPping to check for a response from the host then use 0; If you will be querying a Zabbix agent then use 10050 (or an alternate port you specified in your agent setup); if using SNMP then use 161 (even if you will ALSO be using ICMPping for one of your Items.

So, now you have a Host set up. Next we need to create Items (AKA tests) against this host.

Add Items

Having created your new Host, you should see it listed on your Hosts screen. Off to the right side you will see links for Items, Triggers, and Graphs. Of course, before you can trigger anything or graph anything, you have to collect data. This is what items do.

Click on the Items link and then observe the address bar of your browser. You will see a hostid listed there at the end of the URL. When you click on Create item the new item you create will be associated specifically with this host. The most common Item to create is an availability test, using icmpping (a simple ping test to the IP address of the Host.

  • Name: Available
  • Type: Simple Check
  • Key: icmpping
  • Type of information: Numeric (Integer 64bit)

Use other parameters as desired, You should store the information As Is. There are many other types of queries you may use. For a sample just examine the list of offered tests by clicking on the Select button to the right of the Key field. Use the drop-down list of Types to see what is available. The Zabbix manual explains all of these tests.

Having created your Item to monitor, let us now create a Trigger with which to generate an Action in case that host is not available. Before we go there, click on the name of your new Trigger. Note that the description of the trigger is Hostname:Item, and that the test is icmpping.

Add Trigger

The key thing about Triggers is to understand that they are testing data already written to the database by Items. If your Item takes a sample every 90 seconds, then there will be a new value to test every 90 seconds. You will usually compare that value to the previously stored value to detect a change. If the change is from positive to negative, or exceeds some value that you set, then the trigger will trip.

Go back to the Hosts list and locate your new host. Click the Triggers link off to the right of you host. Click the Create Trigger button.

  • Name: In this case, I name the trigger the same as the Host. This has to do with the Action we will define a bit later, and what the message says.
  • Expression: is stated as {Hostname:test.value()}, so in this case it would be {MyServer:icmpping.last(0)=0}, where if the last value was 0 (indicating that that result of the ping test was negative) then this trigger will trip.
  • Depends On will make more sense to you once you have created triggers on many of your network hosts. For example, if this server is behind a Router and the router is not available then it makes sense that I only need a page about the router being unavailable, not two pages complaining about the router and the server.

The Zabbix Manual has good information about the warning levels. You may comment this Trigger as suits your needs. Comments here do not have any effect that I am aware of. Finally it is time to define an action. I like getting a page on my Cell Phone. In other cases an email message may suffice. In order to define an email address to send a message to you must go to the Users screen and select the Media link next to the user who will get the page. My carrier (Verizon) provides a service at that I may email my message to with Moments later this message will pop up on my SMS screen.

Add an Action

In the previous steps you have been defining Items and Triggers in the context of a Host and a test. Actions are different - and there is power in this. Actions are generated when a Trigger is tripped. However, you do not have to define an individual Action for each and every Trigger. You will instead generate actions based on quite a selection of Host, Group, or Trigger attributes. You will then use the Name of the trigger to report what specific thing tripped the trigger.

Go to the Actions screen. Click on the Create action button.

(Oh My!) and Graphs

The essential thing about graphs is that when you first create a graph, it is not assigned to any Host or Item. It is just floating there until you assign an Item to the graph. Only then does the graph appear to be assigned to a Host (associated with the Item you assigned to it. You can in fact assign Items from several Hosts to a graph. It appears to me that the Graph title is made up of the Hostname:Graphname, based on the Host associated with the first item assigned to the graph.

So after you create and name a new Graph, you will not see your new graph until you set the Group to all and the host to all. There you will see all of your graphs listed. You will notice that the Host field of your new graph is blank. When you edit the new graph and assign the first item to be displayed, the graph will thereafter be associated with a host (and the group to which that host is assigned.

Summing up

I hope this helps new Zabbix users to get started with setting up useful monitoring. Understanding the way things are related and assigned in the interface took me an embarrassingly long time. Once I got the hang of it, things progressed very well.

See also