Zabbix
Add Host
Test: zabbix_get -s <IP / DNS> -p 10050 -k "agent.ping"
Maintenance
Query most triggered items
SELECT DISTINCT `history_uint`.`itemid`, count(`history_uint`.`itemid`) AS CountOf, `items`.`itemid`, `items`.`name` FROM `history_uint` LEFT JOIN `items` ON `history_uint`.`itemid` = `items`.`itemid` GROUP BY `history_uint`.`itemid` ORDER BY CountOf DESC
Configuration
Host name
{psl}.{ber|dus}.{ns125|rds26}.{vh|hh|fb|hh|...}.{ug|eg|1og|...}.{kind e.g. vserver}.{machine name, e.g. pslsrv32}. Example:
psl.dus.ns125.fb.1ug.vserver.pslsrv15
Visible name
{PSL} | {BER|DUS} | {NS125|RDS26} | {VH|HH|FB|HH|...} | {UG|EG|1OG|...} | {kind e.g. vServer} | {machine name, e.g. PSLSRV15} ({Short Description}). Example:
PSL | DUS | NS125 | FB | 1UG | vServer | PSLSRV15 (Preview Webserver)
Tags
The clients can be configured with tags in the zabbix_agentd.conf (for Agent) or zabbix_agent2.conf (for Agent 2), so the clients will be assigned to the right Host Group and Template Group. To do so, you need to add the predefined tags under HostMetadata.
Example:
/etc/zabbix/zabbix_agentd.conf (Zabbix Agent) HostMetadata=win,vfx,psl,dus
OR /etc/zabbix/zabbix_agent2.conf (Zabbix Agent 2) HostMetadata=linux,websrv,psl,dus,247
the following tags are predefined:
| Tag | Meaning |
|---|---|
| win | Windows |
| linux | Linux |
| psl | Company Parasol Island |
| capm | Company Capture Media |
| dus | Location Düsseldorf |
| ber | Location Berlin |
| env | Type Environmental |
| websrv | Type Webserver |
| winsrv | Type Windows Server |
| erp | Type ERP |
| firewall | Type Firewall |
| hotspot | Type Hotspot |
| hypervisor | Type Hypervisor |
| network | Type Network |
| render | Type Rendernode |
| storage | Type Storage |
| switch | Type Switch |
| vfx | Type VFX |
| vm | Type Virtual Machine |
| cisco | Vendor Cisco |
| hp | Vendor HP |
| ibm | Vendor IBM |
| juniper | Vendor Juniper |
| 105 | Availability 10/5 |
| 247 | Availability 24/7 |
Hostgroups
- By Type, e.g. "HGRP | PSL | TYPE | WEBSERVER" , "HGRP | PSL | TYPE | PRINTER"
- By Logical Group, e.g. "HGRP | PSL | LOGIC | DUS" , "HGRP | PSL | LOGIC | BER"
- By Purpose, e.g. "HGRP | PSL | TYPE | RENDERNODE" , "HGRP | PSL | TYPE | NETWORK"
- By Availability Level, e.g. "HGRP | PSL | AVAILABILITY | 24/7" , "HGRP | CAPM | AVAILABILITY | 10/5"
- By Vendor, e.g. "HGRP | PSL | VENDOR | OKI" , "HGRP | PSL | VENDOR | HP"
Template Groups/Template
- The Template Group is a group of multiple templates that are linked to the Template Group.
- The Template has defined Applications, Trigger, Items, Discovery, Dashboards and Graphs.
- TGRP | WINDOWS has the following templates linked
| TPL | WINDOWS | CPU |
| TPL | WINDOWS | FILESYSTEMS |
| TPL | WINDOWS | GENERIC |
| TPL | WINDOWS | MEMORY |
| TPL | WINDOWS | NETWORK |
| TPL | WINDOWS | PHYSICAL DISKS |
| TPL | WINDOWS | SERVICES |
| TPL | ZABBIX AGENT| PASSIVE |
Monitoring
- Install Zabbix Agent
- https://www.zabbix.com/documentation/current/manual/installation/upgrade/packages/debian_ubuntu
- Make sure, 10050/tcp is open (Testen mit 'nc -zvw3 zabbix 10050')
- configure "/etc/zabbix/zabbix_agent2.conf"
- Server=zabbix
- ServerActive=zabbix
- Hostname={Hostname configured in Zabbix Server}
- service zabbix-agent2 restart (Debug with: cat /var/log/zabbix/zabbix_agent2.log)
SQL
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/mysql_agent2
On the Host (Zabbix Agent installed)
- mysql
<syntaxhighlight lang="mysql"> CREATE USER 'zbx_monitor'@'%' IDENTIFIED BY '<password>'; GRANT USAGE,REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON *.* TO 'zbx_monitor'@'%'; </syntaxhighlight>
- configure "/etc/zabbix/zabbix_agent2.conf"
- Plugins.Mysql.Sessions.mysql01.Uri=unix:/var/run/mysqld/mysqld.sock
- Plugins.Mysql.Sessions.mysql01.User=zbx_monitor
- Plugins.Mysql.Sessions.mysql01.Password=b1RhaAh43ZALR
- service zabbix-agent2 restart
In Zabbix
- Marco: {$MYSQL.DSN} = mysql01
Apache2
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/apache_agent
On the Host (Zabbix Agent installed)
- a2enmod status
- Create "/etc/apache2/conf-available/zabbix.conf", e.g. "nano /etc/apache2/conf-available/zabbix.conf"
<syntaxhighlight lang="apache"> <Location "/server-status">
SetHandler server-status
Require host localhost Require ip 127.0.0.1 Require ip 192.168 Require ip 10
</Location> </syntaxhighlight>
- a2enconf zabbix
- service apache2 restart
In Zabbix
- Enable Template: "Template App Apache by Zabbix agent"
Snippets
RegEx Replace Text Output to Int
https://www.schatenseite.de/2018/04/05/zabbix-item-preprocessing-und-regular-expressions/
(.*) > \1:Off=0:On=1 (On|Off)(?=.*:\1=(\d)) > \2