¡Esta es una revisión vieja del documento!
zabbix
Descripción
Instalacion de servidor de monitoreo zabbix
Instalación y Configuración
CentOS/RHEL6
Configurar repositorio
# rpm -ivh http://repo.zabbix.com/zabbix/2.0/rhel/6/x86_64/zabbix- release-2.0-1.el6.noarch.rpm
Instalar paquetes
# yum install zabbix-server-MySQL - MariaDB zabbix-web-mysql - MariaDB
Se realiza la creacion de la primera base de datos
# MySQL - MariaDB -uroot
MySQL - MariaDB> create database zabbix character set utf8 collate utf8_bin;
MySQL - MariaDB> grant all privileges on zabbix.html to zabbix@localhost identified by 'zabbix';
MySQL - MariaDB> exit
Se realiza la importacion del esquema inicial y los datos
# cd /usr/share/doc/zabbix-server-MySQL - MariaDB-2.0.4/create
# MySQL - MariaDB -uroot zabbix < schema.sql
# MySQL - MariaDB -uroot zabbix < images.sql
# MySQL - MariaDB -uroot zabbix < data.sql
Editar la configuracion de la base de datos in el archivo zabbix_server.conf
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
iniciar servicio de zabbix
# service zabbix-server start
Configurar el servicio de apache en el archivo /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
# php_value date.timezone America/Bogota
# service httpd restart
Debian
Versiones soportadas: Debian 6 (Squeeze), Debian 7 (Wheezy),
configurar el repositorio para la instalacion del paquete
Zabbix 2.0 para Debian 7:
# wget http://repo.zabbix.com/zabbix/2.0/debian/pool/main/z/zabbix-release/zabbix-release_2.0-1wheezy_all.deb
# dpkg -i zabbix-release_2.0-1wheezy_all.deb
# apt-get update
instalar el paquete MySQL - MariaDB server:
# apt-get install MySQL - MariaDB-server
Configurar el parametro de codificacion en el archivo /etc/MySQL - MariaDB/my.cnf
[mysqld]
default-character-set=utf8
Si la version es mayor a 5.5 usar
character-set-server=utf-8
Iniciar el servicio de MySQL - MariaDB
# service MySQL - MariaDB start
Instalar lo paquetes de zabbix
# apt-get install zabbix-server-MySQL - MariaDB zabbix-frontend-php
Configurar el servicio de apache en el archivo /etc/apache2/conf.d/zabbix
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M:
php_value max_input_time 300
php_value date.timezone America/Bogota
Es necesario descomentar el paramtro date.timezone con la ubicacion correcta. y reiniciar el servicio
service apache2 restart
Posteriormente ingresar al servicio y terminar la instalacion desde el gestor web.
Trucos
0. Instalar nuevos templates
1. MySQL - MariaDB
- http://blog.themilkyway.org/2013/11/how-to-monitor-MySQL - MariaDB-using-the-new-zabbix-template-app-MySQL - MariaDB/
- https://stackoverflow.com/questions/34805211/monitoring-MySQL - MariaDB-with-zabbix-agent
OJO: el archivo .my.cnf debe estar en /var/lib/zabbix y no en /etc/zabbix
Tambien se puede agregar valores y graficas personlizadas editando el archivo /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf con los datoq nuevos deseados. Por ejemplo
UserParameter=MySQL - MariaDB.queries,HOME=/var/lib/zabbix mysqladmin status|cut -f4 -d“:“|cut -f1 -d”S”
Eso funciona.
2. Windows
3. SQL Server
4. Monitoriar Servicios o paginas web
Entre por la configuracion de servidores .. presionando en triggers .. y ahi a la derecha esta el web escenario
https://www.zabbix.com/documentation/3.4/manual/web_monitoring
https://www.zabbix.com/documentation/6.0/en/manual/web_monitoring
5. Borrar informacion vieja
- - intervals in days
SET @history_interval = 30;
SET @trends_interval = 180; DELETE FROM alerts WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60); DELETE FROM acknowledges WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60); DELETE FROM events WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60); DELETE FROM history WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60); DELETE FROM history_uint WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60); DELETE FROM history_str WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60); DELETE FROM history_text WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60); DELETE FROM history_log WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60);
DELETE FROM trends WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@trends_interval * 24 * 60 * 60); DELETE FROM trends_uint WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@trends_interval * 24 * 60 * 60);
6. Cambiar contraseña en consola
Toca usar bcrypt y no md5 .. el truco esta ahi
htpasswd -bnBC 10 “” YourNewPassword | tr -d ':'
<copy the output>
mysql …
update users set passwd='<copied output>' where alias='Admin';
7. Borrar equipos de descubiertos (discover) viejos
Primero la fecha que quiero en EPOCH
date –date “2022-09-01” +%s 662008400
Y borre los registros mysql -B -u root -e “delete FROM dhosts where lastup < 1662008400” zabbix mysql -B -u root -e “delete FROM dservices where lastup < 1662008400” zabbix
8. Cambiar a Español
9 Multitenant
10. MySQL
El monitor mysql server 2 .. solo funciona con el agente 2 .. nada que hacer
https://www.zabbix.com/documentation/current/en/manual/guides/monitor_mysql
11. Puertos particulares
https://itadminguide.com/create-port-monitoring-in-zabbix/