Starting up

You should never start the Zabbix server or agent as root, which is common sense for most daemon processes. If you installed Zabbix from distribution packages, system users should have been created already—if not, let's create a new user to run these processes. You can use tools provided by your distribution or use the most widely available command, useradd, which we need to execute as root:

# useradd -m -s /bin/bash zabbix

For production systems, consider using different user accounts for the Zabbix server and agent. Otherwise, users with configuration rights will be able to discover Zabbix database credentials by instructing the agent to read the server configuration file. Some distribution packages, such as the EPEL and OpenSUSE ones, already use a separate user account called zabbixsrv or zabbixs by default.

This will create a user named zabbix with a home directory in the default location, /home/zabbix usually, and a shell at /bin/bash.

While using bash on a test system will make it easier to debug issues, consider using /bin/nologin or /bin/false on production systems.

If you installed from source, let's try the direct approach—running the binaries. The location of the binaries will depend on the chosen method of installation. Installing from the source without any extra parameters will place the agent and server binaries in /usr/local/sbin; distribution packages are likely to place them in /usr/sbin. Assuming they are in your path, you can determine where the binaries are by running this:

# which zabbix_server
Keep in mind the potential use of a dash or minus instead of an underscore.

This will show something similar to the following:

/usr/sbin/zabbix_server

Alternatively, the whereis command can also list configuration and other related files:

# whereis zabbix_server

This would likely list the binary, configuration file, and main page:

zabbix_server: /usr/sbin/zabbix_server /usr/local/etc/zabbix_server.conf /usr/share/man/man3/zabbix_server

Once you know the exact location of the binaries, execute the following as the root user:

# <path>/zabbix_agentd
We are using zabbix_agentd, which runs as a daemon. Older versions also had the zabbix_agent executable, which provided an option to be run within internet service daemon (inetd); it did not support active items and, in most cases, had worse performance than the agent daemon.

This will start the Zabbix agent daemon, which should start up silently and daemonize. If the command produces errors, resolve them before proceeding. If it succeeds, continue by starting the Zabbix server:

# <path>/zabbix_server
Check the Zabbix server log file, configurable in zabbix_server.conf. If there are database-related errors, fix them and restart the Zabbix server.

If you installed from the packages, execute this:

# systemctl start zabbix-agent    
# systemctl start zabbix-server    
With systemd no output should be printed on the screen if the service was started without issues.

Feel free to experiment with other parameters, such as stop and restartit should be obvious what these two do.

You can verify whether services are running with the status parameter. For a service that is not running, you would get the following:

# systemctl status zabbix-server

A running service would yield the following:

zabbix-server.service - Zabbix Server
Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2018-08-05 12:57:13 CEST; 1min 39s ago
Process: 1972 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
Main PID: 1974 (zabbix_server)
CGroup: /system.slice/zabbix-server.service
├─1974 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
├─1979 /usr/sbin/zabbix_server: configuration syncer [synced
configuration in 0.008373 sec, idle 60 sec]
....

While it's nice to have Zabbix processes running, it's hardly a process one expects to do manually upon each system boot, so the server and agent should be added to your system's startup sequence. This is fairly distribution specific, so all possible variations can't be discussed here. With RHEL or CentOS, a command such as this should help:

# systemctl enable zabbix-agent
# systemctl enable zabbix-server

This will add both services to be started at boot time.

A nice summary of Systemd can be found at https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet.

..................Content has been hidden....................

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