Simple checks
The previously created items all required the Zabbix agent daemon to be installed, running, and able to make a connection in either direction. But what if you can't or don't want to install the agent on a remote host and only need to monitor simple things? This is where simple checks can help you. These checks do not require any specialized agent running on the remote end and only rely on basic network protocols such as Internet Control Message Protocol (ICMP) and TCP to query monitored hosts.
Tip
Host-availability icons only cover the Zabbix agent, SNMP, JMX, and IPMI status, that is, things where we expect the response to arrive. Our expectations for simple checks could go both ways—an open port could be good or bad. There is no status icon for simple checks.
Let's create a very basic check now. Go to Configuration | Hosts, click on Items next to Another host, and click on Create item. Use the following values:
- Name: Enter
SMTP server status
- Type: Select Simple check
- Key: Click on the Select button
The Type dropdown at the upper-right corner should already say Simple check. If it doesn't, change it to that. In the Key list, click on the net.tcp.service[service,<ip>,<port>]
key and then edit it. Replace service
with smtp
and remove everything after it in the square brackets so that it becomes net.tcp.service[smtp]
, like so:
Note
When configuring simple checks in Zabbix, beware of "paranoid" network security configurations that might trigger an alert if you check too many services too often.
When done, click on the Add button at the bottom. To check the result, go to Monitoring | Latest data—our new check should be there and, depending on whether you have the SMTP server running and accessible for the Zabbix server, should list either 1 (if running and accessible) or 0.
Setting up ICMP checks
What if we care only about the basic reachability of a host, such as a router or switch that is out of our control? ICMP ping (echo request and reply) would be an appropriate method for monitoring in that case, and Zabbix supports such simple checks. Usually, these won't work right away; to use them, we'll have to set up a separate utility, fping
, which Zabbix uses for ICMP checks. It should be available for most distributions, so just install it using your distribution's package-management tools. If not, you'll have to download and compile fping
manually; it's available at http://fping.sourceforge.net/.
Note
At the time of writing this, Zabbix 3.0 still does not fully support fping 3. Most notably, setting the source IP for the server will break ICMP ping items. Such support is currently planned for version 3.0.2. For any later version, check compatibility information in the manual. Installing fping
from distribution packages is likely to provide version 3, and it is also available at http://fping.org/.
Once fping
is properly installed, Zabbix server must know where to find it and be able to execute it. On the Zabbix server, open zabbix_server.conf
and look for the FpingLocation
parameter. It is commented out by default, and it defaults to /usr/sbin/fping
. You can quickly find the fping
binary location with this command:
$ which fping
If one of the results is /usr/sbin/fping
, you don't have to change this parameter. If not, modify the parameter to point to the correct fping
location and restart the Zabbix server so that it knows about the configuration change. That's not it yet. Zabbix also needs to be able to run fping
with administrative privileges, so execute the following as root
:
# chgrp zabbix /usr/sbin/fping # chmod 4710 /usr/sbin/fping
Tip
Permissions are usually already correct in Fedora/RHEL-based distributions. If you're using distribution packages, don't execute the previous commands; they might even disallow access for the Zabbix server, as it might be running under a different group.
As the fping
binary should have been owned by root
before, this should be enough to allow its use by the Zabbix group as required; let's verify that.
As usual, navigate to Configuration | Hosts, click on Items next to Another host, and click on Create item. Set the following details:
- Name:
ICMP ping performance
- Type: Simple check
- Key: Click on the Select button; in the list, click on the
icmppingsec
key, and then remove everything inside the square brackets—and the brackets themselves - Type of information:
Numeric (float)
- Units:
ms
- Use custom multiplier: Select the checkbox and enter
1000
When all fields have been correctly set, click on the Add button at the bottom. Perform the usual round trip to Monitoring | Latest data—ICMP ping should be recording data already. If you wait for a few minutes, you can also take a look at a relatively interesting graph to notice any changes in the network performance.
Here, we set up ICMP ping measuring network latency in seconds. If you wanted to simply test host connectivity, you would have chosen the icmpping
key, which would only record whether the ping was successful or not. That's a simple way to test connectivity on a large scale, as it puts a small load on the network (unless you use ridiculously small intervals). Of course, there are things to be aware of, such as doing something different to test Internet connectivity—it wouldn't be enough to test the connection to your router, firewall, or even your provider's routers. The best way would be to choose several remote targets to monitor that are known to have a very good connection and availability.
For ICMP ping items, several parameters can be specified. For example, the full icmpping
key syntax is as follows:
icmpping[<target>,<packets>,<interval>,<size>,<timeout>]
By default, target
is taken from the host this item is assigned to, but that can be overridden. The packets
parameter enables you to specify how many packets each invocation should issue—usually, the fping
default is 3
. The interval
parameter enables you to configure the interval between these packets—usually, the fping
default is 1 second against the same target, specified in milliseconds. As for size
, here, the default of a single packet could differ based on the fping
version, architecture, and maybe other parameters. And the last one—timeout
—sets individual target timeouts, with a common default being 500
milliseconds.
Note
These defaults are not Zabbix defaults—if not specified, fping
defaults are used.
Note that one should not set ICMP ping items with very large timeouts or packet counts; it can lead to weird results. For example, setting the packet count to 60
and using a 60-second interval on an item will likely result in that item missing every second value.
If you set up several ICMP ping items against the same host, Zabbix invokes the fping
utility only once. If multiple hosts have ICMP ping items, Zabbix will invoke fping
once for all hosts that have to be pinged at the same time with the same parameters (such as packet
, size
, and timeout
).