Manually querying items
Adding items to the frontend and waiting for them to update is one way of seeing whether you got the item key right. It is not a very quick method, though—you have to wait for the server to get to checking the item. If you are not sure about the parameters or would like to test different combinations, the easiest way to do this is with a utility called zabbix_get. When installing from source, it is installed together with the Zabbix agent. When installing from the packages, it could be installed together with the Zabbix agent or it could also be in a separate package. Using it is very simple: if we want to query the agent on the Zabbix server, we will run this on our Zabbix server, a test host.
On Debian/Ubuntu, run the following command:
# apt install zabbix-get
On Red Hat/Centos run the following command:
# yum install zabbix-get
This is the command to run from the shell of our Zabbix server:
$ zabbix_get -s 127.0.0.1 -k system.cpu.load
This will obtain the value in the exact same way as the server would do it. If you would like to get values like this from another host, you could run zabbix_get on the Zabbix server. Attempting to run it from the same host on which the agent runs will fail as we changed the Server parameter to accept connections from the Zabbix server only. If you would like to query the agent from the localhost for debugging purposes, 127.0.0.1 can be added to the Server parameter through a comma—this is sometimes done on all systems when deploying the agent. The -s option is to specify the IP/hostname of the host and -k is to specify the item key as we defined in Zabbix for our item. Run zabbix_get --help to check out all of the options you can specify.
This covers the basics of normal, or passive, Zabbix items, where the server queries agents. Let's move on to other item types.