1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
| ------------- Client ------------- [root@zabbixagent ~]# vim /etc/yum.repos.d/zabbix.repo [zabbix] name=Zabbix Official Repository - $basearch baseurl=http://repo.zabbix.com/zabbix/3.0/rhel/7/$basearch/ enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
[zabbix-non-supported] name=Zabbix Official Repository non-supported - $basearch baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/ enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX gpgcheck=0 [root@zabbixagent ~]# yum install -y zabbix-agent.x86_64 zabbix-sender.x86_64 [root@zabbixagent ~]# vim /etc/zabbix/zabbix_agentd.conf PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_agentd.log LogFileSize=0 Server=127.0.0.1,192.168.2.140 ServerActive=192.168.2.140 Hostname=Zabbix server # 在主动式提交采集数据时需要注意这里的Hostname要与web页面中添加的主机名称一致。 Include=/etc/zabbix/zabbix_agentd.d/ [root@zabbixagent ~]# systemctl start zabbix-agent
------------- Server ------------- [root@zabbix ~]# yum install -y zabbix-java-gateway.x86_64 # 安装java-gateway用以监控tomcat [root@zabbix ~]# cp /etc/zabbix/zabbix_java_gateway.conf{,.bak} [root@zabbix ~]# vim /etc/zabbix/zabbix_java_gateway.conf LISTEN_IP="0.0.0.0" # 监听所有地址 LISTEN_PORT=10052 # 监听端口 PID_FILE="/var/run/zabbix/zabbix_java.pid" START_POLLERS=5 # 启动线程数 TIMEOUT=30 [root@zabbix ~]# systemctl start zabbix-java-gateway [root@zabbix ~]# ss -tln|grep 10052 LISTEN 0 50 :::10052 :::* [root@zabbix ~]# vim /etc/zabbix/zabbix_server.conf ListenPort=10051 SourceIP=192.168.2.140 LogType=file LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=10 DebugLevel=3 PidFile=/var/run/zabbix/zabbix_server.pid DBHost=localhost DBName=zabbix DBUser=zbxuser DBPassword=zbxpass DBSocket=/var/lib/mysql/mysql.sock DBPort=3306 StartPollers=50 # 轮询器的预分叉实例数。 StartTrappers=20 # 此项不要调的过大,测试中调为200,致使zabbix-server服务无法正常启动,提示连接不到数据库 # 捕捉器的预分叉实例数。 # Trapper接受来自Zabbix发送器、活动代理和活动代理的传入连接。 # 必须至少运行一个Trapper进程,才能在前端显示服务器可用性和查看队列。 JavaGateway=127.0.0.1 JavaGatewayPort=10052 StartJavaPollers=50 SNMPTrapperFile=/var/log/snmptrap/snmptrap.log CacheSize=512M # 用于存储主机、项和触发器数据的共享内存大小。 Timeout=10 AlertScriptsPath=/usr/lib/zabbix/alertscripts ExternalScripts=/usr/lib/zabbix/externalscripts LogSlowQueries=3000 [root@zabbix ~]# systemctl restart zabbix-server [root@zabbix ~]# vim /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd skip_name_resolve = ON innodb_file_per_table = ON max_connections=1000 table_open_cache=2048 max_allowed_packet=128M query_cache_size=1024M query_cache_limit=2M wait_timeout=10800 net_read_timeout=3600 symbolic-links=0 [mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid
!includedir /etc/my.cnf.d [root@zabbix ~]# systemctl restart mariadb
------------- Client ------------- [root@zabbixagent ~]# yum install -y java-1.8.0-openjdk-devel tomcat tomcat-webapps tomcat-admin-webapps tomcat-docs-webapp [root@zabbixagent ~]# vim /etc/profile.d/java.sh export JAVA_HOME=/usr [root@zabbixagent ~]# source /etc/profile.d/java.sh [root@zabbixagent ~]# java -version openjdk version "1.8.0_212" OpenJDK Runtime Environment (build 1.8.0_212-b04) OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode) [root@zabbixagent ~]# vim /usr/libexec/tomcat/server #!/bin/bash CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 # 要监听的端口 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false # 注意要在脚本最上方加入这些内容,如果不加,在监控中会不能监控JVM,提示“java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure”。下面一项也可以加上。 -Dcom.sun.management.jmxremote.ssh=false -Djava.rmi.server.hostname=192.168.2.138" # 这里输入的是tomcat的监听地址
[root@zabbixagent ~]# systemctl start tomcat [root@zabbixagent ~]# ss -tln State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *:* LISTEN 0 128 *:10050 *:* LISTEN 0 100 :::8080 :::* LISTEN 0 128 :::22 :::* LISTEN 0 50 :::12345 :::* LISTEN 0 100 ::1:25 :::* LISTEN 0 50 :::42204 :::* LISTEN 0 50 :::35969 :::* LISTEN 0 128 :::10050 :::* LISTEN 0 1 ::ffff:127.0.0.1:8005 :::* LISTEN 0 100 :::8009 :::* # 这时tomcat监听了12345端口 [root@zabbixagent ~]# tomcat version Server version: Apache Tomcat/7.0.76 Server built: Mar 12 2019 10:11:36 UTC Server number: 7.0.76.0 OS Name: Linux OS Version: 3.10.0-693.el7.x86_64 Architecture: amd64 JVM Version: 1.8.0_212-b04 JVM Vendor: Oracle Corporation [root@zabbixagent ~]# wget http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.76/bin/extras/catalina-jmx-remote.jar [root@zabbixagent ~]# cp catalina-jmx-remote.jar /usr/share/tomcat/lib/ [root@zabbixagent ~]# systemctl restart tomcat
|