Zabbix Documentation PDF
Document Details
Uploaded by SpellboundTropicalIsland
Zabbix
Tags
Summary
This document contains information about monitoring various devices, including uptime and downtime information for devices. It also details common issues and best practices when using Zabbix, particularly for Java applications. It explains how to configure Java applications for monitoring using Zabbix.
Full Transcript
UPTIME AND DOWNTIME Uptime/Downtime column shows the time when the device was: Discovered for uptime Lost for downtime Every time the discovery status changes, the time is reset to 00:00:00 The same counter is used for Uptime and Downtime Example - discovery rule is running every 15 minutes WEB s...
UPTIME AND DOWNTIME Uptime/Downtime column shows the time when the device was: Discovered for uptime Lost for downtime Every time the discovery status changes, the time is reset to 00:00:00 The same counter is used for Uptime and Downtime Example - discovery rule is running every 15 minutes WEB server Time Type Up 00:00:00 Uptime 1 Up 00:15:00 Uptime 1 Up 00:30:00 Uptime Down 00:00:00 Downtime Down 00:15:00 Downtime Up 00:00:00 Uptime Up 00:15:00 Uptime 1 0 Discovered Lost 0 1 Discovered 1 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 21 Monitoring > Discovery section displays discovery results: VIEW DISCOVERY STATE Discovered devices IP address Whether it is already monitored Uptime/Downtime Individual service states Host name in Zabbix Discovered devices Host uptime Services uptime Host not monitored 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Uptime Downtime Theory 22 DISCOVERY ACTIONS Discovery actions react to the events with the source "Discovery" Device matches one of the specified patterns from 1.3.6.1.2.1.1.2.0 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 23 Configuration > Actions > Discovery ACTION OPERATIONS - DISCOVERY Add/Remove host Assign/Unassign host group Link/Unlink templates Send message: To user To user group Remote command: On Zabbix server, agent or proxy On a current or another host Enable/Disable host Set host inventory mode: Automatic, manual or disabled This overrides global inventory mode 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 24 DISCOVERY ACTIONS Multiple operation steps: All the steps are executed at the same time ! There is no option to control step execution order! 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 25 BEST PRACTICES & LIMITATIONS Suggested: Do not add/remove hosts immediately - use Uptime/Downtime Use data received from Zabbix agent/SNMP to link to different templates Use reasonable update interval Smaller network segments are more reliable than the big ones - they are scanned faster Set number of discoverer processes equal to the amount of discovery rules Number of processes is defined in configuration files with StartDiscoverers= option If discovery is performed by proxy, the discoverer processes must be started on proxy Timeout setting of a server/proxy affects the speed of discovery With long timeouts Zabbix will wait longer for nonresponsive checks Limitations: No discovery of a network topology Encryption is not supported by a network discovery 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 26 PRACTICAL SETUP 1) Create a new network discovery rule: Name: IP range: Discover services: Host Name: Visible Name Discover training servers Use training VMs IP addresses MySQL, SSH and HTTP DNS name Use host name 2) Create a new action for the discovery rule to do SSH checks: Name: SSH service discovery Add the discovered hosts to the "Training/Discovery" host group, if it is reachable via SSH. Assign template : SSH Service 3) Create a new action for the discovery rule to do HTTP checks: Name: HTTP service discovery Add the discovered hosts to the "Training/Discovery" host group, if it is reachable via HTTP Assign template HTTP Service 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved 20 minutes Practical task No: 19 27 Java monitoring 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved 20 minutes 28 JMX MONITORING JMX (Java Management Extensions) Is a technology designed to monitor and manage various Java applications and resources These resources are called MBeans (ManagedBeans) MBeans are registered on the MBean Server - object registry MBean Server resources are accessed using JMX connectors JMX client uses Remote Method Invocation (RMI) protocol to access a MBean server i https://www.zabbix.com/documentation/current/manual/config/items/itemtypes/jmx_monitoring 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 29 JMX MONITORING JMX monitoring can be used to monitor JMX counters of a Java application JMX monitoring has native support in the form of a daemon called "Zabbix Java gateway" Zabbix server queries Zabbix Java gateway to retrieve values using JMX management API Apache Tomcat GlassFish Zabbix server i Zabbix Java gateway https://www.oracle.com/java/technologies/javase/javamanagement.html 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 30 JMX MONITORING - MULTIPLE REMOTE GATEWAYS Zabbix active proxy Zabbix Java gateway Apache Tomcat Zabbix server Zabbix passive proxy Zabbix Java gateway GlassFish Zabbix Java gateway 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 31 JMX MONITORING - JAVA GATEWAY Install Zabbix Java gateway and start it Requires Java runtime environment Can run on the same (recommended) or a separate system Listens on 10052 TCP port by default Is polled by Zabbix server Bundles requests for the performance reasons Configuration files: zabbix_java_gateway.conf zabbix_java_gateway_logback.xml To use custom JMX endpoints, additional jars may be necessary (e. g. JBoss EAP 6) The communication between Zabbix server or proxy and Zabbix java gateway cannot be encrypted i https://www.zabbix.com/documentation/current/manual/concepts/java/from_rhel_centos 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 32 JAVA APPLICATION CONFIGURATION Configure Java Application: Java application does not need any additional software installed Java application needs to be started with enabled support for remote JMX monitoring As a bare minimum, start it with these options: JAVA_OPTS="-Dcom.sun.management.jmxremote \ -Dcom.sun.management.jmxremote.local.only=false \ -Dcom.sun.management.jmxremote.port=12345 \ -Dcom.sun.management.jmxremote.rmi.port=12345 -Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.ssl=false \ -Djava.rmi.server.hostname=<Java app IP/DNS>" There are many other Java options available (SSL, auth, etc.) ! Harden security settings for production environments! 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 33 ZABBIX SERVER CONFIGURATION Configure Zabbix server (zabbix_server.conf): Start several Java pollers (StartJavaPollers > 0) Recommended to use the same number of Pollers as defined in Java gateway configuration Configure a JavaGateway address and a port Restart Zabbix server ### Option: JavaGateway # IP address (or hostname) of Zabbix Java gateway. # Only required if Java pollers are started. JavaGateway=java-gateway.example.com ### Option: JavaGatewayPort # Port that Zabbix Java gateway listens on. # Range: 1024-32767 JavaGatewayPort=10052 ### Option: StartJavaPollers # Number of pre-forked instances of Java pollers. # Range: 0-1000 StartJavaPollers=5 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 34 JMX HOST CONFIGURATION Add a host with the JMX interface in the frontend: Use the IP address or DNS name of the Java application Add "JMX agent" item or link a JMX template JMX icon will become green, and the values will be collected by the items 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 35 JMX AGENT ITEM You should add JMX agent item for each JMX counter you are interested in. The syntax for key(s): jmx[<object_name>,<attribute_name>] <object_name> - the object name of an MBean <attribute_name> - MBean attribute name separated by dots Examples: jmx["java.lang:type=Memory",HeapMemoryUsage.used] jmx["java.lang:type=Threading",ThreadCount] To quote the item key parameters, use double quotes 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 36 JMX CLIENTS JMX clients can be used to get the data from Java application, for example JConsole - graphical user JMX interface Jmxterm - command line based interactive JMX client The Information retrieved by these tools can be used to: To extend or change official templates To create your own JMX templates # /usr/bin/java -jar ./jmxterm-1.0.2-uber.jar -l service:jmx:rmi:///jndi/rmi://<java_app>:12345/jmxrmi $>get -b java.lang:type=Memory HeapMemoryUsage #mbean = java.lang:type=Memory: HeapMemoryUsage = { committed = 14221312; init = 14680064; max = 204800000; used = 9368016; }; 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 37 JMX ENDPOINT JMX endpoint: Has a special address for each JAVA application Can be different for each item Syntax for JMX endpoint : service:jmx: protocol sap a constant a transport protocol (RMI, JMXMP, etc), used to connect to the connector server the address at which the connector server can be found. Specified as //[host[:port]][url-path] Examples: Tomcat: JBoss: IBM: service:jmx:rmi:///jndi/rmi://{HOST.CONN}:{HOST.PORT}/jmxrmi service:jmx:remoting-jmx://{HOST.CONN}:{HOST.PORT} service:jmx:iiop://{HOST.CONN}:{HOST.PORT} 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 38 COMMON ISSUES Wrong Java Application JMX remote port Type in Java App port here: Java app port The firewall (Zabbix server <>10052/TCP Zabbix Java Gateway <> 12345/TCP Java App) A typo in Java Application configuration file Default templates may cause many unsupported items Check error message or log to get some clues about an issue Some of the objects are not supported (e. g. HashMap, ArrayList, etc.) 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 39 LLD VIA JMX JMX objects can be discovered using Low-level discovery : jmx.discovery[<discovery mode>,<object name>] discovery mode - one of the following: attributes (retrieve JMX MBean attributes, default) beans (retrieve JMX MBeans) object name - object name pattern identifies the MBean names to be retrieved (empty by default, retrieves all the registered beans) Examples: jmx.discovery - Retrieves all JMX MBean attributes jmx.discovery[attributes,"*:type=GarbageCollector,name=*"] - Retrieves all the garbage collector attributes jmx.discovery[beans,"*:type=GarbageCollector,name=*"] - Retrieves all the garbage collectors This key returns a JSON object 6.0 Certified Professional ● Day 3 © 2023 by Zabbix. All rights reserved Theory 40