CAPÍTULO 2: MARCO TEÓRICO
2.5. CARACTERÍSTICAS DE LA ROCA Y DEL FLUIDO
Instead of using this predefined host configuration we want to understand how items work. But items can't exist in an empty space—each item has to be attached to a host.
In Zabbix, a host is a logical entity that groups items. Definition of what a host is can be freely adapted to specific environment and situation. Zabbix
in no way limits this choice; thus a host can be network switch, a physical server, a virtual machine, or a website.
If a host is required to attach items to then we must create one. Head over to
Configuration | Hosts and click the Create Host button, located at the top-right corner. We are presented with a host creation screen. This time we won't concern ourselves with the details, so let's input only some relevant information.
Name: Enter A Test Host
Groups: Select Linux servers in the right-hand selectbox, named Other Groups, press the << button to add this group then select Zabbix Servers
in the In Groups selectbox and press the >> button to remove our new host from this pre-defined group
IP address: Enter 127.0.0.1
Why did we have to select a group for this host? All permissions are assigned to host groups, not individual hosts, and thus a host must belong to at least one group. We will cover permissions in more detail in Chapter 5.
The configured host should look as follows:
When you are ready, click Save.
Back in the host list, take a look at DNS and IP columns. Notice how IP value is
• •
[ 52 ]
Creating an item
So we created our very own first host. But given that items are the basis of all the data, it's probably of little use right now. To give more substance we should create items, so select Linux servers in the Group dropdown, then click Items next to the host we just created, A Test Host. This host has no items to list—click Create Item button.
There's a form, vaguely resembling the one for host creation, so let's fill some values. Description: Enter value as CPU Load. This is how the item will be
named—basically the name that you will use to refer to the item in most places.
Key: The value in this field will be system.cpu.load. This is the "technical name" of the item that identifies what information it gathers.
Type of information: Choose Numeric (float). This defines what formatting and type the incoming data will have.
• • •
We will look at the other defaults in more detail later, so click Save.
More information on item keys is provided in Chapter 3.
You should now see your new item in the list. But we were interested in the associated data, so navigate to Monitoring | Latest data and click on the + sign next to - other -. Wait for a minute to pass since saving the item, and you should see that this newly created item has already gathered some data:
What should you do if you don't see any entries at all? This usually means that data has not been gathered, which can happen for a variety of reasons. If that is the case, check some common causes:
Did you enter item configuration exactly as in the screenshot? Check the item key and type of information.
Are both the agent and the server, running? You can check that by executing as root:
# netstat -ntpl | grep zabbix
The output should list both the server daemon and the agent daemon running on the correct ports:
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 23569/zabbix_agentd
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 23539/zabbix_server
If any one of them is missing, make sure to start it.
Can the server connect to the agent? You can verify that by executing from Zabbix server:
$ telnet localhost 10050
If the connection fails, that could mean that either the agent is not running, or some restrictive firewall setting prevents the connection.
• •
[ 54 ]
If the connection succeeds but is immediately closed, then the IP address that agent receives connection from does not match the one specified in its configuration file for the Server directive. On some distributions this can be caused by IPv6 being used by default, so you should try to add IPv6 localhost representation to this directive, ::1.
Since version 1.8, Zabbix server reads all the information on items to monitor into cache every minute by default. This means that configuration changes like adding a new item might show an effect in collected data after one minute. This interval can be tweaked in /etc/zabbix/zabbix_server.conf, CacheUpdateFrequency parameter. Once data is arriving, you might see no value in the Change column. This means you moved to this display quickly, and the item managed to gather single value only, thus there's no change yet. If that is the case, waiting a bit should result in page automatically refreshing (look at the page title, remember the 30 second refresh we left untouched in user profile?) and the Change column will be populated. So we are now monitoring single value – the UNIX system load. Data is automatically retrieved and stored in the database. If you are not familiar with the concept, it might be a good idea to read the overview at http://en.wikipedia.org/wiki/Load_(computing).