Zabbix 3.0 - Dia 2&3 - Administrator PDF
Zabbix 3.0 - Dia 2&3 - Administrator PDF
Zabbix 3.0 - Dia 2&3 - Administrator PDF
0 Administrator
WWW.YOURCOMPANY.CO
M
ABOUT US
AGENDA
❖ Advanced data collection - Java monitoring ❖ Low level discovery - discovery of host
LLD rules.
3
AGENDA
❖ Advanced problem detection - detecting ❖ Scaling and performance tuning - how to
triggers.
4
JAVA
MONITORING
MONITORING JAVA
APPLICATIONS
Zabbix server
ZBX
Apache
Tomcat
GlassFish
Zabbix Java
gateway
ZABBIX 3.0 -
ADMINISTRATOR 6
www.nubiral.com
JAVA GATEWAY
❖ Requires Java
ZABBIX 3.0 -
ADMINISTRATOR 7
www.nubiral.com
MULTIPLE AND REMOTE
GATEWAYS
Apache
Tomcat
Zabbix Java
gateway
ZABBIX 3.0 -
ADMINISTRATOR 8
www.nubiral.com
ODBC
MONITORING
GET DATA FROM
EXTERNAL DATABASE
ODBC connectivity is required
Depends on UnixODBC
db.odbc.select[<unique short description>,<dsn>]
ZABBIX 3.0 -
ADMINISTRATOR 10
www.nubiral.com
SSH/TELNET
MONITORING
GET DATA FROM
EXTERNAL DEVICE
Password or public key authentication (SSHKeyLocation)
Ability to run any command and return result back to Zabbix
ssh.run[<unique short description>,<ip>,<port>,<encoding>]
ZABBIX 3.0 -
ADMINISTRATOR 12
www.nubiral.com
MONITORING OF
VMWARE
MONITORING OF
VMWARE
ZABBIX 3.0 -
ADMINISTRATOR 15
www.nubiral.com
READY TO USE TEMPLATES
ZABBIX 3.0 -
ADMINISTRATOR 16
www.nubiral.com
USER MACROS
USER MACRO
FUNCTIONALITY
Easier maintenance – one template and:
different item key parameters
net.tcp.service[ssh,{$SSH_PORT}]
different trigger expression values
{server:system.cpu.load[,avg1].last(0)} > {$CPU_LOAD}
ZABBIX 3.0 -
ADMINISTRATOR 18
www.nubiral.com
USER MACRO
CONFIGURATION
Global: Administration → General → Macros
ZABBIX 3.0 -
ADMINISTRATOR 19
www.nubiral.com
LOW LEVEL
DISCOVERY
BUILT-IN ENTITIES
FOR LLD
❖ Agent – filesystems
❖ Agent – network interfaces
❖ Agent – Windows services
❖ Agent - CPUs and CPU cores
❖ SQL entities
❖ SNMP entities
...anything using scripting
ZABBIX 3.0 -
ADMINISTRATOR 21
www.nubiral.com
LLD COMPONENTS
LLD rule
Item prototypes
Trigger prototypes
Graph prototypes
Host prototypes
ZABBIX 3.0 -
ADMINISTRATOR 22
www.nubiral.com
NETWORK INTERFACES
DISCOVERY
Item prototype:Traffic in Item prototype:Traffic out
Network
Trigger prototype: Trigger prototype:
interfaces high traffic in high traffic out
discovery rule Graph prototype:
traffic on interface
Example key:
vfs.fs.size[{#FSNAME},free]
ZABBIX 3.0 -
ADMINISTRATOR 24
www.nubiral.com
CONTEXT SUPPORT
IN USER MACROS
Macro context is a text value
Use case for macro contexts would be using an LLD macro value
Example:
{ca_001:vfs.fs.size[{#FSNAME},pfree].last()} <
{$LOW_SPACE_LIMIT:"{#FSNAME}"}
where:
{$LOW_SPACE_LIMIT} 10
{$LOW_SPACE_LIMIT:"/opt"} 25
Events will be created when "/" and "/home" have less than 10% or
"/opt" filesystem has less than 25% of free disk space.
ZABBIX 3.0 -
ADMINISTRATOR 25
www.nubiral.com
LLD RULE
PROPERTIES
Can use any "item" type for data collection
Update interval concerns
Filtering by regexp
ZABBIX 3.0 -
ADMINISTRATOR 26
www.nubiral.com
DEPENDENCIES BETWEEN
TRIGGER PROTOTYPES
ZABBIX 3.0 -
ADMINISTRATOR 27
www.nubiral.com
CREATED ENTITIES
Denoted in configuration
ZABBIX 3.0 -
ADMINISTRATOR 28
www.nubiral.com
ENTITIES TO BE REMOVED
ZABBIX 3.0 -
ADMINISTRATOR 29
www.nubiral.com
Linking to applications based on discovery values
ZABBIX 3.0 -
ADMINISTRATOR 30
www.nubiral.com
LLD OF WINDOWS
SERVICES
LLD for Windows services:
service.discovery
LLD rule returns data in macros:
{#SERVICE.NAME}
{#SERVICE.DISPLAYNAME}
{#SERVICE.DESCRIPTION}
{#SERVICE.STATE}
{#SERVICE.STATENAME}
{#SERVICE.PATH}
{#SERVICE.USER}
{#SERVICE.STARTUP}
{#SERVICE.STARTUPNAME}
Item key:
service.info[service,<param>]
Example:
service.info[{#SERVICE.NAME},state]
ZABBIX 3.0 -
ADMINISTRATOR 32
www.nubiral.com
CUSTOM LLD DATA
{
"data":[
{ "{#FSNAME}":"/", "{#FSTYPE}":"rootfs"},
{ "{#FSNAME}":"/sys", "{#FSTYPE}":"sysfs"},
{ "{#FSNAME}":"/proc", "{#FSTYPE}":"proc"},
{ "{#FSNAME}":"/dev", "{#FSTYPE}":"devtmpfs"},
{ "{#FSNAME}":"/dev/pts", "{#FSTYPE}":"devpts"}
]
}
ZABBIX 3.0 -
ADMINISTRATOR 33
www.nubiral.com
LLD OF
SNMP OIDS
Syntax for SNMP discovery rules:
SNMP OID before 3.0: SNMP OID
SNMP OID from 3.0: discovery[{#SNMPVALUE}, SNMP OID]
Example:
{ "data":[
{"{#SNMPINDEX}":1,"{#IFDESCR}":"Interface #1","{#IFALIAS}":"eth1"},
{"{#SNMPINDEX}":2,"{#IFDESCR}":"Interface #2", "{#IFALIAS}":"eth2"},
{"{#SNMPINDEX}":3,"{#IFALIAS}":"eth3"},
#4"},
{"{#SNMPINDEX}":4,"{#IFDESCR}":"Interface
{"{#SNMPINDEX}":5,"{#IFALIAS}":"eth5"}
} ]
ZABBIX 3.0 -
ADMINISTRATOR 42
www.nubiral.com
LLD USING
SQL
LLD VIA SQL QUERIES
ZABBIX 3.0 -
ADMINISTRATOR 37
www.nubiral.com
DISTRIBUTED
MONITORING
THE PROBLEM
Zabbix Server
ZABBIX 3.0 -
ADMINISTRATOR 39
www.nubiral.com
THE SOLUTION
ZABBIX PROXY
ZABBIX 3.0 -
ADMINISTRATOR 40
www.nubiral.com
PASSIVE PROXY
ZABBIX 3.0 -
ADMINISTRATOR 41
www.nubiral.com
PROXY OVERVIEW
❖ Centralised monitoring
❖ Zabbix server controls configuration of all proxies
❖ Supports any platform server supports
❖ Supports any database server supports
❖ Can create SQLite DB automatically
❖ Can buffer data in case of communication problems
❖ Choose the direction of the connection
Don't use the same DB for proxy as server
ZABBIX 3.0 -
ADMINISTRATOR 42
www.nubiral.com
INITIAL SETUP
ZABBIX 3.0 -
ADMINISTRATOR 43
www.nubiral.com
PROXIES
Proxy list in frontend
Shows proxy mode
Encryption
Last seen
Host, item count
Required performance
ZABBIX 3.0 -
ADMINISTRATOR 44
www.nubiral.com
ACTIVE ZABBIX PROXY
CONFIGURATION
ZABBIX 3.0 -
ADMINISTRATOR 45
www.nubiral.com
PASSIVE ZABBIX PROXY
CONFIGURATION
ZABBIX 3.0 -
ADMINISTRATOR 46
www.nubiral.com
PROXY COMMUNICATION
Server connects every
ProxyConfigFrequency seconds
and sends configuration (1 hour by default)
Passive
Server connects every proxy
ProxyDataFrequency seconds
and retrieves data (1 second by default)
Zabbix
server Proxy connects every
ConfigFrequency seconds
and retrieves configuration (1 hour by
default)
Proxy connects every
Active
DataSenderFrequency seconds and proxy
sends data, if any (1 second by default)
ZABBIX 3.0 -
ADMINISTRATOR 47
www.nubiral.com
RELOAD ACTIVE PROXY
CONFIGURATION
ZABBIX 3.0 -
ADMINISTRATOR 48
www.nubiral.com
MONITORING PROXY
AVAILABILITY
HeartbeatFrequency ensures server will notice proxy
missing even if no data has to be sent. One minute by
default.
ZABBIX 3.0 -
ADMINISTRATOR 49
www.nubiral.com
PER-PROXY QUEUE
ZABBIX 3.0 -
ADMINISTRATOR 50
www.nubiral.com
PERFORMANCE
CONSIDERATIONS
Zabbix server
Fast CPU
Fast storage for processing of historical information
Number of trappers should be higher than number of Proxies
Performance after downtime
Proxy
Low hardware requirements
Embedded hardware can be used
ZABBIX 3.0 -
ADMINISTRATOR 51
www.nubiral.com
LIMITATIONS
ZABBIX 3.0 -
ADMINISTRATOR 52
www.nubiral.com
ADVANCED
TOPICS
Z
ZABBIX SERVER
COMPONENTS
ZABBIX 3.0 -
ADMINISTRATOR 54
www.nubiral.com
FRONTEND
CUSTOMIZATION
In include/defines.inc.php
ZABBIX 3.0 -
ADMINISTRATOR 55
www.nubiral.com
CONFIGURATION
IN DETAIL
Zabbix server configuration parameters
zabbix_server.conf
ZABBIX 3.0 -
ADMINISTRATOR 56
www.nubiral.com
ZABBIX PROTOCOLS
See https://zabbix.org/wiki/Docs/protocols
ZABBIX 3.0 -
ADMINISTRATOR 57
www.nubiral.com
ADVANCED
PROBLEM
DETECTION
DETECTING ANOMALIES
Time shift available for functions min, max, avg, last and count
ZABBIX 3.0 -
ADMINISTRATOR 59
www.nubiral.com
ANOMALY
ZABBIX 3.0 -
ADMINISTRATOR 60
www.nubiral.com
HYSTERESIS
Hysteresis:
({TRIGGER.VALUE}=0 and {server:system.cpu.load.last(0)}>5) or
({TRIGGER.VALUE}=1 and {server:system.cpu.load.last(0)}>1)
ZABBIX 3.0 -
ADMINISTRATOR 61
www.nubiral.com
HYSTERESIS
ZABBIX 3.0 -
ADMINISTRATOR 62
www.nubiral.com
HYSTERESIS
TIMESTAMP VALUE
2016-01-30
10:55:50
0.2
2016-01-30
10:55:20
0.8 OK
2016-01-30
10:54:50
2.5
2016-01-30
OK 10:54:20
4.7 -
2016-01-30
PROBLEM 10:53:50
10 -
2016-01-30
OK 10:53:20
4.6 -
2016-01-30
PROBLEM 10:52:50
5.2 -
2016-01-30
OK 10:52:20
2.4 -
2016-01-30
PROBLEM 10:51:50
5.3
PROBLEM
2016-01-30
10:51:20
2.5
2016-01-30
10:50:50
1.2
No hysteresis 2016-01-30
10:50:20
0.5 Hysteresis
ZABBIX 3.0 -
ADMINISTRATOR 63
www.nubiral.com
ADVANCED TRIGGER
FUNCTIONS
TREND PREDICTION (VALUE)
Function: forecast(sec|#num,<time_shift>,time,<fit>,<mode>)
Parameters:
sec - time period
#num - number of values
<time_shift> - evaluation period time -
forecasting horizon in seconds
<fit> - function used (linear, polynomialN, exponential, logarithmic, power)
<mode> - demanded output (value, max, min, delta, avg)
Example:
{ora01_bi:vfs.fs.size[/,free].forecast(7d,,7d)}<100M
ZABBIX 3.0 -
ADMINISTRATOR 65
www.nubiral.com
TREND PREDICTION (TIME)
Function:
timeleft(sec|#num,<time_shift>,threshold,<fit>)
Parameters:
sec - time period
#num - number of values
<time_shift> - evaluation period
threshold - value to reach
<fit> - function used (linear, polynomialN, exponential, logarithmic, power)
Example:
{ora01_bi:vfs.fs.size[/,free].timeleft(1d,,104857600)}<1h
ZABBIX 3.0 -
ADMINISTRATOR 66
www.nubiral.com
TREND PREDICTION
Use calculated items to visualize values
Examples: forecast("vfs.fs.size[/,free]",1d,,1d)
timeleft("vfs.fs.size[/,free]",1d,,104857600)
ZABBIX 3.0 -
ADMINISTRATOR 67
www.nubiral.com
TREND PREDICTION NOTES
ZABBIX 3.0 -
ADMINISTRATOR 68
www.nubiral.com
TREND PREDICTION TIPS
If you have no insights on how your monitored system behaves start with
linear (default fit)
If your data is not straight but is curved you may want to try
polynomial
Power fit may be useful when your data has "ups" and "downs"
Use longer intervals with more data points to obtain more accurate long-
term forecasts
ZABBIX 3.0 -
ADMINISTRATOR 69
www.nubiral.com
TREND PREDICTION
Additional reading:
https://www.zabbix.com/documentation/3.0/manual/config
/triggers/prediction
http://zabbix.org/mw/images/1/18/Prediction_docs.pdf
ZABBIX 3.0 -
ADMINISTRATOR 70
www.nubiral.com
PERCENTILE
The function is used to determine the percent of
acceptability. The 95th percentile is the value which is
greater than 95% of the observed values:
measure bandwidth level without random peaks
do not take peak traffic into account
detect various anomalies
ZABBIX 3.0 -
ADMINISTRATOR 71
www.nubiral.com
PERCENTILE
Function:
percentile(period/#num, time_shift, percentage)
Parameters:
period - time period
#num - number of values
time_shift - time shift period
percentage - range of 0 to 100
Example:
{crtr05_rix:net.if.in[eth0,bytes].percentile(10m,,95)}>10M
ZABBIX 3.0 -
ADMINISTRATOR 72
www.nubiral.com
ZABBIX API
API OVERVIEW
ZABBIX 3.0 -
ADMINISTRATOR 74
www.nubiral.com
API STRUCTURE
Examples:
host.create - creates new host
history.get - retrieves history data
item.update - updates existing items
ZABBIX 3.0 -
ADMINISTRATOR 75
www.nubiral.com
API FUNCTIONALITY
ZABBIX 3.0 -
ADMINISTRATOR 76
www.nubiral.com
API MESSAGE FLOW
Authenticate
Session ID
Method A
ZABBIX 3.0 -
ADMINISTRATOR 77
www.nubiral.com
EXAMPLE - AUTHENTICATING
{"jsonrpc":"2.0",
"result":"2f2ec4720863281c34cdd3c4c8a5de46","id":0}
ZABBIX 3.0 -
ADMINISTRATOR 78
www.nubiral.com
EXAMPLE - GETTING HOST
ZABBIX 3.0 -
ADMINISTRATOR 79
www.nubiral.com
EXAMPLE - GETTING HOST
USING DIFFERENT LANGUAGES
Install PyZabbix Python library using pip: Response:
# yum install python-pip $ ./host_get.py
# pip install pyzabbix available: 1
description:
disable_until: 0
Get auth & host via custom script: error:
#!/usr/bin/env python errors_from: 0
from pyzabbix import ZabbixAPI flags: 0
host: Zabbix server
zapi = ZabbixAPI("http://195.13.231.163/zabbix")
zapi.login("Admin", "zabbix") hostid: 10126
...
result = zapi.host.get(filter={"host" : "Zabbix server"}) for h in snmp_available: 0
result: snmp_disable_until: 0
snmp_error:
for key in sorted(h):
snmp_errors_from: 0
print "%s: %s " % (key, h[key])
status: 0
templateid: 0
ZABBIX 3.0 -
ADMINISTRATOR 80
www.nubiral.com
INTEGRATION WITH GRAFANA
ZABBIX 3.0 -
ADMINISTRATOR 81
www.nubiral.com
PERFORMANCE
BASIC DATA FLOW
Notifications
Visualization
NVPS
ZABBIX 3.0 -
ADMINISTRATOR 84
www.nubiral.com
PERFORMANCE DELIVERED BY ZABBIX
ZABBIX 3.0 -
ADMINISTRATOR 85
www.nubiral.com
FACTORS MAKING PERFORMANCE
LOWER
ZABBIX 3.0 -
ADMINISTRATOR 86
www.nubiral.com
PERFORMANCE VS NUMBER OF HOSTS
ZABBIX 3.0 -
ADMINISTRATOR 87
www.nubiral.com
SLOW VS FAST
ZABBIX 3.0 -
ADMINISTRATOR 88
www.nubiral.com
VISIBLE SYMPTOMS OF BAD
PERFORMANCE
No notifications
ZABBIX 3.0 -
ADMINISTRATOR 89
www.nubiral.com
NICE LOOKING QUEUE
ZABBIX 3.0 -
ADMINISTRATOR 90
www.nubiral.com
IDENTIFY AND
FIX COMMON
PROBLEMS
GENERIC TOOLS
top, ntop...
iostat, vmstat, sar
Zabbix itself
Database statistics, innotop
ps x|grep zabbix_server
ZABBIX 3.0 -
ADMINISTRATOR 92
www.nubiral.com
DIFFERENT VIEWS ON
PERFORMANCE
however:
"Zabbix Milestone achieved - 1000 hosts and
growing" :-)
"Our status update: 8500 hosts, 950400 items, 670340
triggers, 9550 vps" :-)
LogSlowQueries=3000
ZABBIX 3.0 -
ADMINISTRATOR 95
www.nubiral.com
TUNE ZABBIX
CONFIGURATION
GET INITIAL STATS
Real number of VPS
zabbix[wcache, values, all]
zabbix[queue,1m] number of items delayed for more than 1 minute
ZABBIX 3.0 -
ADMINISTRATOR 97
www.nubiral.com
GET INTERNAL STATS
ZABBIX 3.0 -
ADMINISTRATOR 98
www.nubiral.com
INTERNAL STATS: OVERVIEW
ZABBIX 3.0 -
ADMINISTRATOR 99
www.nubiral.com
HOW IT LOOKS LIKE
ZABBIX 3.0 -
ADMINISTRATOR 10
www.nubiral.com 0
TUNE NUMBER OF PROCESSES
(EXAMPLE)
StartPollers=80
StartPingers=10
StartPollersUnreachable=80
StartIPMIPollers=10
StartTrappers=20
StartDBSyncers=8
ZABBIX 3.0 -
ADMINISTRATOR 101
www.nubiral.com
TUNE SIZE OF IN-MEMORY CACHE
(EXAMPLE)
VMwareCacheSize=64M CacheSize=64M
HistoryCacheSize=128M
TrendCacheSize=64M
HistoryIndexCacheSize = 64M
ValueCacheSize=64M
ZABBIX 3.0 -
ADMINISTRATOR 102
www.nubiral.com
TABLE PARTITIONING
Benefits:
Easy to remove older data
Much better performance
ZABBIX 3.0 -
ADMINISTRATOR 103
www.nubiral.com
NO TABLE PARTITIONING
Zabbix
Server History
& GUI
ZABBIX 3.0 -
ADMINISTRATOR 10
www.nubiral.com 4
WITH TABLE PARTITIONING
Partition 2016_02
Partition 2015_11
ZABBIX 3.0 -
10
ADMINISTRATOR
www.nubiral.com 5
MYSQL SPECIFIC
InnoDB is better than MyISAM In-
memory tmpfs for tmpdir Peek at
the data
mysqladmin status
mysqladmin variables
InnoDB
innodb_file_per_table = 1 innodb_buffer_pool_size=<large>
(~75% of total RAM) innodb_buffer_pool_instances = 4
(MySQL 5.6 - 8)
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
innodb_log_file_size = 256M
Do not use
query log
binary logs if no replication is used (sync_binlog = 0)
ZABBIX 3.0 -
ADMINISTRATOR 10
www.nubiral.com 6
I STILL NEED BETTER
PERFORMANCE!
Database
Zabbix Server Frontend
16 core CPU
8 core CPU Fast CPU
64GB of RAM
4GB of RAM 4GB of RAM
Fast storage
ZABBIX 3.0 -
ADMINISTRATOR 107
www.nubiral.com
HIGH-AVAILABILITY
AND REDUNDANCY
HIGH AVAILABILITY AND
REDUNDANCY
General
Shared storage
Virtual IP
Cluster solutions
Linux HA (OpenAIS/Corosync, Pacemaker)
ZABBIX 3.0 -
ADMINISTRATOR 10
www.nubiral.com 9
FAILOVER SETUP
ZABBIX 3.0 -
ADMINISTRATOR 110
www.nubiral.com
PRACTICAL
SETUP
PRACTICAL SETUP
ZABBIX 3.0 -
ADMINISTRATOR 11
www.nubiral.com 2
PRACTICAL SETUP
❖ Add:
"Ping loss is too high on <host>" trigger
Use 5 as threshold
ZABBIX 3.0 -
ADMINISTRATOR 11
www.nubiral.com 3
PRACTICAL SETUP
❖ Create "Production cluster" dummy host which will
represent your "production HA cluster"
ZABBIX 3.0 -
ADMINISTRATOR 11
www.nubiral.com 5
PRACTICAL SETUP
ZABBIX 3.0 -
ADMINISTRATOR 11
www.nubiral.com 6
PRACTICAL SETUP
ZABBIX 3.0 -
ADMINISTRATOR 11
www.nubiral.com 7
PRACTICAL SETUP
ZABBIX 3.0 -
ADMINISTRATOR 11
www.nubiral.com 8
PRACTICAL SETUP
ZABBIX 3.0 -
ADMINISTRATOR 11
www.nubiral.com 9
PRACTICAL SETUP
ZABBIX 3.0 -
ADMINISTRATOR 12
www.nubiral.com 0
PRACTICAL SETUP
❖ Install Tomcat
❖ Check JMX agent icon status and "Latest data" for the
values
ZABBIX 3.0 -
ADMINISTRATOR 1
www.nubiral.com 2
1
PRACTICAL SETUP
ZABBIX 3.0 -
ADMINISTRATOR 12
www.nubiral.com 2
PRACTICAL SETUP
Add "Future value for CPU load after 30 minutes will be more than 1"
trigger
ZABBIX 3.0 -
ADMINISTRATOR 12
www.nubiral.com 4
QUESTIONS?
Thank you