Verifying the service's state

While the systemd method is a nice way to check a service's state for some distributions, it's not available everywhere and isn't always enough. Sometimes, you might want to use these other methods to check whether the Zabbix server or agent is running:

  • Checking running processes: The most common method to check whether a particular process is running is by looking at the running processes. You can verify whether the Zabbix agent daemon processes are actually running using this command:
    $ ps -C zabbix_agentd
  • Output from the ss command: Sometimes, an agent daemon might start up but fail to bind to the port or the port might be used by some other process. You can verify whether some other process is listening on the Zabbix port or whether the Zabbix agent daemon is listening on the correct port by issuing this command:
    # ss -tlnp

Process names won't be printed for other users' processes unless you are the root user. In the output, look for a line similar to this:

ss is a replacement for netstat on CentOS/Red Hat; if you would still like to use netstat, that is possible by installing the net-tools package—just remember that netstat is deprecated.
State  Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:10050 *:* users:(("zabbix_agentd",pid=1965,fd=4),("zabbix_agentd",pid=1964,fd=4),("zabbix_agentd",pid=1963,fd=4),
...
LISTEN 0 128 *:10051 *:* users:(("zabbix_server",pid=2011,fd=5),("zabbix_server",pid=2010,fd=5),("zabbix_server",pid=2009,fd=5),
...
LISTEN 0 50 *:3306 *:* users:(("mysqld",pid=1832,fd=14))
LISTEN 0 128 *:22 *:* users:(("sshd",pid=1033,fd=3))
LISTEN 0 100 127.0.0.1:25 *:* users:(("master",pid=1278,fd=13))
LISTEN 0 128 :::10050 :::* users:(("zabbix_agentd",pid=1965,fd=5),
...
LISTEN 0 128 :::10051 :::* users:(("zabbix_server",pid=2011,fd=6),("zabbix_server",pid=2010,fd=6),("zabbix_server",pid=2009,fd=6),
...
LISTEN 0 128 :::22 :::* users:(("sshd",pid=1033,fd=4))
LISTEN 0 100 ::1:25 :::* users:(("master",pid=1278,fd=14))

This indicates that the zabbix_agentd process is running and listening on all addresses on port 10050—just what we need.

  • Telnetting to the port: Even when a service starts up and successfully binds to a port, there might be some connectivity issues, perhaps due to a local firewall. To quickly check connectivity on the desired port, you can try this:
    $ telnet localhost 10050

This command should open a connection to the Zabbix agent daemon, and the daemon should not close the connection immediately. All of this applies to the Zabbix server as well, except that it uses a different port by default: 10051

On CentOS, it is possible that telnet will not work—that's because we have to install it first. This can be done by running the following: 

    # yum install telnet
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.108.54