参考来源:(官网)
https://www.zabbix.com/documentation/3.4/manual/introduction/about
1what’s zabbix?
index |
detail |
remark |
1 |
An enterprise-class open source distributed monitoring solution |
|
2 |
Monitor numerous parameters of a network and the health and integrity of servers. |
|
3 |
Flexible notifcation mechanism for virtually any event |
|
4 |
Excellent reporting and data visualistaion based on stored data |
ideal for capacity planning(容量规划) |
5 |
Supports both polling and trapping. |
|
6 |
Web-based fronted |
|
7 |
GPL (General Public License) |
Freely distributed and available for general public |
2zabbix features
Features |
Detail |
remark |
Data gethering |
1Availability and performance checks 2Support for SNMP(both trapping and polling),IPMI,JMX,Vmware monitoring |
|
Flexible threshold definitions |
Define flexible problem thresholds,called triggers,referencing values from backend database |
|
Highly configurable alerting |
1sending notifications can be customized for the escalation schedule,recipient,media type 2automatic actions include remote commands |
Escalation [eskə'leɪʃn]n,扩大 recipient[rɪˈsɪpiənt],接收者 |
Real-time graphing |
Monitored items are immediately graphed using the built-in graphing functionality |
|
Extensive visualisation options |
1ablitiy to create custom graphs that can combine multiple items into a single view 2network maps |
|
Historical data storage |
1data stored in a database 2configurable history |
|
Network discovery |
1automatic discovery of network devices 2agent auto registration |
|
Fast web interface |
A web-based fronted in PHP |
|
Zabbix api |
json |
|
Persmissions system |
Secure user authentication |
权限系统 |
Full featured and easily extensible agent |
can be deployed on both Linux and Windows |
3zabbix overview
components |
Detail |
remark |
Server |
1Central component to which agents report availability and integrity information and statistics. 2the central repository in which all configuration,statistical and operational data are stored. |
|
Database storage |
All configuration information as well as the data gathered by zabbix is stored in database |
|
Web interface |
Provided web-based interface for easy access to zabbix from anywhere and from any platform |
|
Proxy |
1Can collect performance and availability data on behalf of zabbix server. 2 an optional part of zabbix deployment, beneficial to distribute the load of a single zabbix server. |
|
Agent |
Deployed on monitoring targets to actively monitor local resources and applications and report the gatherd data to zabbix server |
|
Data flow |
Important to take a step back and have a look at the overall data flow within zabbix. |
The process within zabbix. |
4 terminology
Index |
Name |
description |
1 |
Host |
A network device that you want to monitor,with ip/dns |
2 |
Host group |
Logical groupting of hosts,may contain hosts and templates. Hosts and templates within a host group are not in any way linked to each other. Host groups are used when assigning access rights to hosts for different user groups. |
3 |
item |
A particular piece of data that you want to receive off of a host,a metric of data |
4 |
Trigger |
A logical expression that defines a problem threshold and is used to “evaluate” data received in items When received data are above the threshold, triggers go from 'Ok' into a 'Problem' state. When received data are below the threshold, triggers stay in/return to an 'Ok' state. |
5 |
Event |
a single occurrence of something that deserves attention such as a trigger changing state or a discovery/agent auto-registration taking place |
6 |
problem |
a trigger that is in “Problem” state |
7 |
action |
a predefined means of reacting to an event. An action consists of operations (e.g. sending a notification) and conditions (when the operation is carried out) |
8 |
escalation |
a custom scenario for executing operations within an action; a sequence of sending notifications/executing remote commands |
9 |
media |
a means of delivering notifications; delivery channel |
10 |
notification |
a message about some event sent to a user via the chosen media channel |
11 |
template |
a set of entities (items, triggers, graphs, screens, applications, low-level discovery rules, web scenarios) ready to be applied to one or several hosts The job of templates is to speed up the deployment of monitoring tasks on a host; also to make it easier to apply mass changes to monitoring tasks. Templates are linked directly to individual hosts. |
12 |
application |
a grouping of items in a logical group |
13 |
web scenario |
one or several HTTP requests to check the availability of a web site |
5 zabbix process
5.1server
5.1.1Features
Index |
features |
detail |
1 |
performs the polling and trapping of data |
Polling : 轮询,服务器隔一段时间读取 Trapping:自陷,客户端主动上报 Agent and proxies’ central component. |
2 |
Central repository in which all configuration,statistical and operational data is stored |
1A basic zabbix server:zabbix server,web frontend and database storage 2All of the configuration information for Zabbix is stored in the database, which both the server and the web frontend interact with. |
5.1.2zabbix Processes
5.1.2.1server
Premise:If installed as package
Zabbix server runs as a daemon process
1.base process
Process |
Detail |
remark |
Start |
shell> service zabbix-server start or shell> /etc/init.d/zabbix-server start |
If it doesn’t work,you hava to start it manually: Find the path to the zabbix_server binary and execute: shell> zabbix_server |
other |
shell> service zabbix-server stop shell> service zabbix-server restart shell> service zabbix-server status |
|
Run zabbix with command line parameters |
-c –config<file> -R –runtime-control<option> -h –help -V --version |
1Runtime control is not supported on OpenBSD and NetBSD 2example: shell>zabbix_server -c /usr/local/etc/zabbix_server.conf shell> zabbix_server --help shell> zabbix_server -V |
Runtime control |
|
|
Runtime control
Option |
Description |
target |
config_cache_reload |
Reload configuration cache. Ignored if cache is being currently loaded. |
|
housekeeper_execute |
Start the housekeeping procedure. Ignored if the housekeeping procedure is currently in progress. |
|
log_level_increase[=<target>] |
Increase log level, affects all processes if target is not specified. |
pid - Process identifier (1 to 65535) process type - All processes of specified type (e.g., poller) process type,N - Process type and number (e.g., poller,3) |
log_level_decrease[=<target>] |
Decrease log level, affects all processes if target is not specified. |
1)Allowed range of PIDs for changing the log level of a single Zabbx process is from 1 to 65535.
2)On systems with large PIDs <process type,N> target option can be used for changing the log level of a single process.
Example:
Option |
Command |
remark |
reload the server configuration cache |
shell>zabbix_server -c /usr/local/etc/ zabbix_server.conf –R config_cache_reload |
|
trigger execution of housekeeper |
shell> zabbix_server -c /usr/local/etc/zabbix_server.conf -R housekeeper_execute |
|
change log level |
1) Increase log level of all processes: shell> zabbix_server -c /usr/local/etc/zabbix_server.conf -R log_level_increase 2)Increase log level of second poller process: shell> zabbix_server -c /usr/local/etc/zabbix_server.conf -R log_level_increase=poller,2 3) Increase log level of process with PID 1234: shell> zabbix_server -c /usr/local/etc/zabbix_server.conf -R log_level_increase=1234 4) Decrease log level of all http poller processes: shell> zabbix_server -c /usr/local/etc/zabbix_server.conf -R log_level_decrease="http poller" |
|
2process user
Option |
Description |
remark |
Zabbbix server is designed to run as a non-root user. |
It will run as whatever non-root user it is started as. So you can run server as any non-root user without any issues. |
|
If you want run it as ‘root’ |
it will switch to a hardcoded 'zabbix' user, which must be present on your system. If Zabbix server and agent are run on the same machine it is recommended to use a different user for running the server than for running the agent. |
|
Start-up scripts |
automatically start/stop Zabbix processes during system's start-up/shutdown. The scripts are located under directory misc/init.d. |
|
Supported platforms |
Unix is the only operating system that can consistently deliver the necessary performance, fault tolerance and resilience. |
Zabbix server support: Linux|Solaris|AIX|Mac OS X |FreeBSD|OpenBSD|NetBSD |SCO Open Server |Tru64/OSF1 |
Local |
the server requires a UTF-8 locale |
|
5.1.2.2zabbix agent
1Overview:
Index |
Description |
note |
1 |
Is deployed on a monitoring target to actively monitor local resources and applications (hard drivers,memory,processor statistics etc) |
Gather operational information locally and reports data to zabbix server. |
2 |
Zabbix agents can perform passive and active checks |
|
3 |
Supported platforms |
Linux|IBM AIX|FreeBSD| NetBSD|OpenBSD|HP-UX| MAC OS X|solaris 9,10,11 |window:all since xp |
2passive and active checks
Option |
Description |
note |
Passive check |
The agent responds to data request,zabbix server(or proxy)asks for data. |
|
Active check |
The agent must first retrieve a list of items from zabbix server.Agent periodically send new values to server. |
Require More complex processing |
Note: Whether to perform passive or active checks is configured by selecting the respective monitoring item type. Zabbix agent processes items of type 'Zabbix agent' or 'Zabbix agent (active)
3 agent on UNIX-like systems
If installed as package, See the package installation section for instructions on how to install Zabbix agent as package.
Operation |
Description |
note |
Start |
shell> service zabbix-agent start or shell> /etc/init.d/zabbix-agent start |
|
Stop/restart /status |
shell> service zabbix-agent stop shell> service zabbix-agent restart shell> service zabbix-agent status |
|
Start up manually |
If the above doesn’t work, Find the path to the zabbix_agentd binary and execute: shell> zabbix_agentd |
|
|
|
|
|
|
|
4agent on windows systems
Operation |
Description |
note |
preparation |
1Download and uppack the zip agent file,choose any folder to store.e.g. c:zabbix 2copy binwin64zabbix_agentd.exe and confzabbix_agentd.win.conf to c:zabbix 3edit the c:zabbixzabbix_agentd.win.conf to your needs, making sure to specify a correct “Hostname” parameter |
|
installation |
install Zabbix agent as Windows service C:> c:zabbixzabbix_agentd.exe -c c:zabbixzabbix_agentd.win.conf -i |
|
5.1.2.3zabbix proxy
index |
description |
1 |
zabbix proxy is a process tha may collect monitoring data from one or more monitored devices and send the information to the zabbix server,essentially working on behalf of the server. |
2 |
All collected data is buffered locally and then transferred to the server the proxy belongs to. |
3 |
Optional,but may very beneficial to distrubute the load of a single server. If only proxies collect data, processing on the server becomes less CPU and disk I/O hungry. |
4 |
Zabbix proxy requires a serparte database. E.g. sqlite,mysql,postgresql. |
Proxy process
Operation |
Description |
note |
installation |
If installed as package |
|
Start |
shell> service zabbix-proxy start or shell> /etc/init.d/zabbix-proxy start |
|
Stop/restart/status |
shell> service zabbix-proxy stop shell> service zabbix-proxy restart shell> service zabbix-proxy status |
|
Start up manually |
If the above does not work you have to start it manually. Find the path to the zabbix_proxy binary and execute: shell> zabbix_proxy |
|
command line parameters |
-c --config <file> path to the configuration file -R --runtime-control <option> perform administrative functions -h --help give this help -V --version display version number Examples: shell> zabbix_proxy -c /usr/local/etc/zabbix_proxy.conf shell> zabbix_proxy --help shell> zabbix_proxy -V |
Runtime control is not supported on OpenBSD and NetBSD |
Runtime control |
|
|
5.1.2.4java geteway
index |
description |
1 |
since Zabbix 2.0. Native support for monitoring JMX applications The application does not need any additional software installed, it just has to be started with -Dcom.sun.management.jmxremote option on the command line. |
2 |
Java gateway accepts incoming connection from Zabbix server or proxy and can only be used as a “passive proxy”. Access to each Java gateway is configured directly in Zabbix server or proxy configuration file, thus only one Java gateway may be configured per Zabbix server or Zabbix proxy. |
3 |
If a host will have items of type JMX agent and items of other type, only the JMX agent items will be passed to Java gateway for retrieval. |
4 |
1Zabbix server or proxy has a specific type of processes that connect to Java gateway, controlled by the option StartJavaPollers. 2Internally, Java gateway starts multiple threads, controlled by the START_POLLERS option. 3On the server side, if a connection takes more than Timeout seconds, it will be terminated, but Java gateway might still be busy retrieving value from the JMX counter. there is the TIMEOUT option in Java gateway that allows to set timeout for JMX network operations. |
5 |
It is suggested to have StartJavaPollers less than or equal to START_POLLERS, |
Operation |
Description |
note |
Getting java gateway |
1download from zabbix website http://www.zabbix.com/download.php Or 2compile java gateway from source https://www.zabbix.com/documentation/3.4/manual/concepts/java |
|
Overview of files In java gateway distribution |
1you should have ended up with a collection of shell scripts 2JAR and configuration files under $PREFIX/sbin/zabbix_java 3bin/zabbix-java-gateway-$VERSION.jar The Java gateway JAR file itself. 4lib/logback-core-0.9.27.jar lib/logback-classic-0.9.27.jar lib/slf4j-api-1.6.1.jar lib/android-json-4.3_r3.1.jar Dependencies of Java gateway: Logback, SLF4J, and Android JSON library. 5 lib/logback.xml lib/logback-console.xml Configuration files for Logbac 6 shutdown.sh startup.sh Convenience scripts for starting and stopping Java gateway. 7 settings.sh Configuration file that is sourced by startup and shutdown scripts above. |
|
Configuring And run |
1default port:10052 2after setting,can start with : $ ./startup.sh ;or stop with: $ ./shutdown.sh |
|
Configuring server for use with java gatewary |
The java gateway is running,then tell server where to find gateway. 1specifying JavaGateway and JavaGatewayPort parameters in server configuration file.if the jmx application host is monitored by zabbix proxy,specify the proxy configuration file: JavaGateway=192.168.3.14 JavaGatewayPort=10052 2default,server not start any processes related to jmx monitoring,can specify the number of pre-forked instances of java pollers. StartJavaPollers=5 3then,restart server or proxy. |
|
Debugging java gateway |
1 By default, Java gateway logs its activities into /tmp/zabbix_java.log file with log level “info”. To increase logging level “debug”.modify file lib/ logback.xml and change the level attribute of <root> tag to “debug” <root level="debug"> <appender-ref ref="FILE" /> </root>
|
no need to restart Zabbix Java gateway after changing logback.xml file - changes in logback.xml will be picked up automatically. |
start Java gateway as a console application rather than a daemon |
comment out PID_FILE variable in settings.sh. If PID_FILE is omitted, startup.sh script starts Java gateway as a console application and makes Logback use lib/logback-console.xml file instead, which not only logs to console, but has logging level “debug” enabled as well |
|
5.1.2.5sender
index |
description |
1 |
is a command line utility that may be used to send performance data to Zabbix server for processing. The utility is usually used in long running user scripts for periodical sending of availability and performance data. |
2 |
For sending results directly to Zabbix server or proxy, a trapper item type must be configured. |
3 |
can be used to send multiple values from an input file. See the Zabbix sender manpage for more information. |
Operation |
Description |
note |
Running zabbix sender |
1linux-like shell> cd bin shell> ./zabbix_sender -z zabbix -s "Linux DB3" -k db.connections -o 43 where: z - Zabbix server host (IP address can be used as well) s - technical name of monitored host (as registered in Zabbix frontend) k - item key o - value to send 2 windows Zabbix sender on Windows can be run similarly: zabbix_sender.exe [options] |
1Options that contain whitespaces, must be quoted using double quotes. 2Zabbix sender accepts strings in UTF-8 encoding 3A value that is not further apart from the previous value than 0.2 seconds can be put in the same stack, but maximum pooling time still is 1 second. 4Zabbix sender will terminate if invalid (not following parameter=value notation) parameter entry is present in the specified configuration file. |
5.1.2.6Get
index |
description |
1 |
1a command line utility which can be used to communicate with Zabbix agent and retrieve required information from the agent. 2The utility is usually used for the troubleshooting of Zabbix agents. |
Operation |
Description |
note |
Running zabbix get |
1get the processor load value from the agent: shell> cd bin shell> ./zabbix_get -s 127.0.0.1 -p 10050 -k system.cpu.load[all,avg1] 2capturing a string from a website: shell> cd bin shell> ./zabbix_get -s 192.168.1.1 -p 10050 -k "web.page.regexp[www.zabbix.com,,,"USA: ([a-zA-Z0-9.-]+)",,1]"
|
1Note that the item key here contains a space so quotes are used to mark the item key to the shell. The quotes are not part of the item key; they will be trimmed by the shell and will not be passed to Zabbix agent. |
Zabbix get accepts the following command line parameters: |
-s --host <host name or IP> Specify host name or IP address of a host. -p --port <port number> Specify port number of agent running on the host. Default is 10050. -I --source-address <IP address> Specify source IP address. -k --key <item key> Specify key of item to retrieve value of. -h --help Give this help. -V --version Display version number. |
See also Zabbix get manpage for more information. |
Zabbix get on Windows can be run similarly: |
zabbix_get.exe [options] |
|