Skip to main content

Zabbix on CentOS 5 from RPMs

I've recently been asked to investigate Zabbix and found this guide to installing Zabbix 1.4 on CentOS.

However, I also found that Zabbix RPMs are available in the EPEL repository, which makes installation much mores straight-forward.

Here's what I did…

This guide installs the zabbix server, agent, and web interface on one machine.

The server used was a minimal install of CentOS 5.2.

  1. Make sure the EPEL repository has been added to your system. Details of how to use it are here.
  2. Install zabbix, zabbix-web, zabbix-agent, MySQL server, and net-snmp

yum install zabbix zabbix-web zabbix-agent mysql-server net-snmp

The zabbix packages, and all necessary dependencies are installed:

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
mysql-server            x86_64     5.0.45-7.el5     core-0            9.7 M
net-snmp                x86_64     1:5.3.1-24.el5_2.1  CentOS-5.2-x86_64-Updates  703 k
zabbix                  x86_64     1.4.5-2.el5      epel-5-x86_64     2.1 M
zabbix-agent            x86_64     1.4.5-2.el5      epel-5-x86_64     200 k
zabbix-web              x86_64     1.4.5-2.el5      epel-5-x86_64     933 k
Installing for dependencies:
apr                     x86_64     1.2.7-11         core-0            118 k
apr-util                x86_64     1.2.7-7.el5      core-0             74 k
aspell                  x86_64     12:0.60.3-7.1    core-0            946 k
aspell-en               x86_64     50:6.0-2.1       core-0            1.6 M
curl                    x86_64     7.15.5-2.el5     core-0            229 k
fping                   x86_64     2.4b2-7.el5      epel-5-x86_64      33 k
freetype                x86_64     2.2.1-20.el5_2   CentOS-5.2-x86_64-Updates  311 k
gmp                     x86_64     4.1.4-10.el5     core-0            201 k
gnutls                  x86_64     1.4.1-3.el5_1    CentOS-5.2-x86_64-Updates  364 k
httpd                   x86_64     2.2.3-11.el5_1.centos.3  core-0            1.1 M
iksemel                 x86_64     1.3-1.el5.rf     RPMForge-RHEL5-x86_64  118 k
libidn                  x86_64     0.6.5-1.1        core-0            195 k
libjpeg                 x86_64     6b-37            core-0            139 k
libpng                  x86_64     2:1.2.10-7.1.el5_0.1  core-0            235 k
lm_sensors              x86_64     2.10.0-3.1       core-0            504 k
mysql                   x86_64     5.0.45-7.el5     core-0            4.2 M
net-snmp-libs           x86_64     1:5.3.1-24.el5_2.1  CentOS-5.2-x86_64-Updates  1.2 M
perl-DBD-MySQL          x86_64     3.0007-1.fc6     core-0            147 k
perl-DBI                x86_64     1.605-1.el5.rf   RPMForge-RHEL5-x86_64  871 k
perl-Net-Daemon         noarch     0.43-1.el5.rf    RPMForge-RHEL5-x86_64   44 k
perl-PlRPC              noarch     0.2020-1.el5.rf  RPMForge-RHEL5-x86_64   33 k
php                     x86_64     5.1.6-20.el5_2.1  CentOS-5.2-x86_64-Updates  1.2 M
php-bcmath              x86_64     5.1.6-20.el5_2.1  CentOS-5.2-x86_64-Updates   33 k
php-cli                 x86_64     5.1.6-20.el5_2.1  CentOS-5.2-x86_64-Updates  2.2 M
php-common              x86_64     5.1.6-20.el5_2.1  CentOS-5.2-x86_64-Updates  155 k
php-gd                  x86_64     5.1.6-20.el5_2.1  CentOS-5.2-x86_64-Updates  112 k
php-mysql               x86_64     5.1.6-20.el5_2.1  CentOS-5.2-x86_64-Updates   86 k
php-pdo                 x86_64     5.1.6-20.el5_2.1  CentOS-5.2-x86_64-Updates   63 k
postgresql-libs         x86_64     8.1.11-1.el5_1.1  core-0            195 k

Note 1: I also have the RPMForge repo enabled on this system. This is not necessary.

Note 2: I am using local mirrors of the repositories from a cobbler server, so the Repository names you see will be slightly different.

  1. Start the mysql server, and configure it to start at boot:

service mysqld start
chkconfig mysqld on

  1. Create a database for zabbix to use:

mysqladmin create zabbix
cat | mysql << EOF
grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'password';
EOF

  1. Initialise the zabbix database:

mysql -uzabbix -ppassword zabbix < /usr/share/doc/zabbix-1.4.5/dbinit/schema/mysql.sql
mysql -uzabbix -ppassword zabbix < /usr/share/doc/zabbix-1.4.5/dbinit/data/data.sql
mysql -uzabbix -ppassword zabbix < /usr/share/doc/zabbix-1.4.5/dbinit/data/images_mysql.sql 

  1. Add zabbix ports to /etc/services:

cat >> /etc/services << EOF
zabbix_agent 10050/tcp
zabbix_trap 10051/tcp
EOF

  1. Make sure a couple of settings are correct in /etc/php/ini:

[Date]
; Defines the default timezone used by the date functions
date.timezone = Europe/London
max_execution_time = 300

  1. Add the MySQL password to /etc/zabbix/zabbix_server.conf

perl -pi -e 's/^#DBPassword.*/DBPassword=password/' /etc/zabbix/zabbix_server.conf

  1. Open ports 80, 10050, and 10051 on the firewall:

system-config-securitylevel-tui --port=80:tcp --port=10050:tcp --port=10051:tcp --quiet

  1. Start all the services and configure them to start at boot:

chkconfig zabbix on
chkconfig zabbix-agent on
chkconfig httpd on
service zabbix start
service zabbix-agent start
service httpd start

You should now be able to open a browser on http://server/zabbix and complete the initial configuration.

Optional step: If you need/want to use any SNMP tools (snmpwalk, etc.), you should install net-snmp-utils

Comments

Popular posts from this blog

Python logging with rich - writing to stderr - plain output when writing to file

Rich is a Python library for writing rich text (with color and style) to the terminal, and for displaying advanced content such as tables, markdown, and syntax highlighted code. Rich provides RichHandler , a logging handler for python's logging module which will format and colorize text written by the module. However, RichHandler writes to stdout by default. More specifically, it writes to a rich Console object which, by default, writes to stdout. To make RichHandler write to stderr by default, you must pass in a Console object which has been configured to write to stderr: import logging from rich.console import Console from rich.logging import RichHandler DATEFMT = "%Y-%m- %d T%H:%M:%SZ" FORMAT = " %(message)s " logging . basicConfig( level = "NOTSET" , format = FORMAT, datefmt = DATEFMT, handlers = [RichHandler(console = Console(stderr = True ))], ) logger = logging . getLogger(__name__) logger . i...

Fix python import order on save in vim with ruff and ale

My IDE of choice is vim. I use various tools to perform linting and code formatting, and configure them all with ALE  (the Asynchronous Lint Engine). After using several discrete tools ( black , isort , flake8 , etc) I have settled on using Ruff to do my python code formatting and linting. Here's the relevant fragment of my ALE config in my .vimrc: " ALE config let g :ale_fixers = { \ 'python' : [ 'ruff' , 'ruff_format' ], \} let g :ale_linters = { \ 'python' : [ 'ruff' ], \} let g :ale_python_ruff_use_global = 1 One of the last remaining wrinkles I had was getting Ruff to automatically sort import statements. Sorting imports is performed by the Ruff linter, not the formatter, which is documented here . The fix on the command line is to add an option, like this: ruff check --select I --fix The difficulty I had was getting this to happen in the editor when the file was saved. It turns out, all I needed to do was ...

Escaping special characters in wget username or password

I recently offered to help out with the hosting of a WordPress  site. It’s currently hosted somewhere with no shell access – just ftp – and there are a lot of images to transfer. I quickly figured out I could use wget to mirror the site, using something like: wget -m ftp://username:password@example.com However, this broke in this case because the username for the site contained an @ character (the username was user@example.com ). Turns out the solution was to encode the special chars using HTML notation. This is the command that did the trick: wget -m ftp://user%40example.com:password@example.com