Настройка JMX

Процесс установки
Ответить
Аватара пользователя
Артём Мамзиков
Admin
Сообщения: 319
Зарегистрирован: Вс фев 17, 2019 17:47
Репутация: 4
Откуда: Вологодская область
Контактная информация:

Настройка JMX

Сообщение Артём Мамзиков » Вт май 12, 2020 19:06 #1

Доделать оформить!!!


Установка JMX
https://www.zabbix.com/documentation/3. ... cepts/java
Установка JAVA
nano /etc/apt/sources.list
прописать
deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main
Команда
apt-get update
apt-get install oracle-java8-installer

echo "export JAVA_HOME=/usr/lib/jvm/java-8-amd64/" >> ~/.bashrc
echo "export JAVA_HOME=/usr/lib/jvm/java-8-oracle/" >> ~/.bashrc
. ~/.bashrc

apt install zabbix-java-gateway
/etc/zabbix/zabbix_java_gateway.conf
service zabbix-java-gateway restart
systemctl enable zabbix-java-gateway

wget http://repo.zabbix.com/zabbix/3.4/debia ... ie_all.deb
dpkg -i zabbix-java-gateway_3.4.7-1+jessie_all.deb
dpkg -i ./, zabbix-java-gateway_3.4.7-1+jessie_all.deb
apt install ./,zabbix-java-gateway_3.4.7-1+jessie_all.deb


cd /root/zabbix-3.4.6/
./configure --enable-java --prefix=$PREFIX
make
make install

cd /sbin/zabbix_java/
nano shutdown.sh - скрипт завершения
nano startup.sh - скрипт запуска
nano settings.sh - скрипты запуска остановки
LISTEN_IP="192.168.90.111"
LISTEN_PORT=10052
PID_FILE="/var/run/zabbix/zabbix_java.pid
START_POLLERS=4

cd /sbin/zabbix_java/

nano /sbin/zabbix_java/settings.sh

./startup.sh - запуск
./shutdown.sh - стоп

nano /usr/local/etc/zabbix_server.conf
Параметры
JavaGateway=192.168.90.111
JavaGatewayPort=10052
StartJavaPollers=5

service zabbix-server restart - перезапуск

проверка
/usr/share/doc/zabbix-java-gateway
/usr/share/zabbix-java-gateway
/etc/init.d/zabbix-java-gateway
/etc/logrotate.d/zabbix-java-gateway

/usr/sbin/zabbix_java
/root/zabbix-3.4.6/src/zabbix_java



https://www.zabbix.com/documentation/3. ... cepts/java
https://www.zabbix.com/documentation/3. ... monitoring


Скрипты

/sbin/zabbix_java/shutdown.sh
/sbin/zabbix_java/startup.sh

nano settings.sh

# Mandatory: no
# Range: 1-1000
# Default:

START_POLLERS=5

### Option: zabbix.timeout
# How long to wait for network operations.
#
# Mandatory: no
# Range: 1-30
# Default:
# TIMEOUT=3

nano shutdown.sh

#!/bin/sh

cd `dirname $0`
. ./settings.sh

if [ -n "$PID_FILE" ]; then
if [ -f "$PID_FILE" ]; then
PID=`cat "$PID_FILE"`
if ps -p "$PID" > /dev/null 2>&1; then
kill "$PID"
for i in 1 2 3 4 5; do
sleep 1
ps -p "$PID" > /dev/null 2>&1
if [ $? -ne 0 ]; then
exit 0
fi
done
echo "Zabbix Java Gateway did not stop"
exit 1
[ Read 28 lines ]

nano startup.sh

#!/bin/sh

cd `dirname $0`
. ./settings.sh

if [ -n "$PID_FILE" -a -f "$PID_FILE" ]; then
PID=`cat "$PID_FILE"`
if ps -p "$PID" > /dev/null 2>&1; then
echo "Zabbix Java Gateway is already running"
exit 1
fi
rm -f "$PID_FILE"
fi

JAVA=${JAVA:-java}

JAVA_OPTIONS="-server"
if [ -z "$PID_FILE" ]; then
JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=logback-console$
[ Read 79 lines ]


Томкад
Я включил следующий параметр в remote tomcat catalina.sh:

-Djava.rmi.server.hostname=<host ip>
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=9004 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false




-Dcom.sun.management.jmxremote.port=1616
-Dcom.sun.management.jmxremote.rmi.port=1616
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.local.only=false
-Djava.rmi.server.hostname=localhost


https://docs.cuba-platform.com/cuba/5.6 ... 02s01.html
http://qaru.site/questions/58961/connec ... g-jconsole

http://www.oracle.com/technetwork/java/ ... #javasejdk - 10 версия для компа JDK


-Dcom.sun.management.jmxremote.port=12345
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

шаблон Template_Multitenant_Tomcat_JMX_Toolkit
Template JMX Tomcat
https://habrahabr.ru/post/137641/
https://www.zabbix.com/documentation/3. ... monitoring
http://www.oracle.com/technetwork/java/ ... index.html



-Dcatalina.home=d:\sitex\tomcat7
-Dcatalina.base=d:\sitex\tomcat7
-Djava.endorsed.dirs=d:\sitex\tomcat7\endorsed
-Djava.io.tmpdir=d:\sitex\tomcat7\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=d:\sitex\tomcat7\conf\logging.properties
-Djava.rmi.server.hostname=192.168.621.56
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.host=localhost
-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
-Dcom.sun.management.jmxremote.local.only=false

С паролем
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password
-Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access

Максоры в шаблон
{$AJP_PORT} 8009
{$CONNECTOR_MODE} bio
{$HTTPS_PORT} 8443
{$HTTP_PORT} 8080

jmx["Catalina:type=ThreadPool,name=\"http-bio-8080\"",maxThreads]
jmx["Catalina:type=ThreadPool,name=\"http-bio-8080\"",currentThreadsBusy]
jmx["Catalina:type=ThreadPool,name=\"http-bio-8080\"",currentThreadCount]
jmx["Catalina:type=Server",serverInfo]
jmx["Catalina:type=ProtocolHandler,port=8080",compression]


Изменить

Properties in creation order type=GlobalRequestProcessor,name="http-apr-8080"
jmx["Catalina:type=GlobalRequestProcessor,name=\"http-apr-8080\"",bytesReceived]

Instead of
jmx["Catalina:type=GlobalRequestProcessor,name=http-8080",bytesReceived]

bio 8080
jmx["Catalina:type=GlobalRequestProcessor,name=\"http-{$CONNECTOR_MODE}-{$HTTP_PORT}\"",bytesReceived]

you should use:
jmx["Catalina:type=GlobalRequestProcessor,name=\"http-bio-8080\"",bytesReceived]


Команды перезапуска
/sbin/zabbix_java/shutdown.sh
/sbin/zabbix_java/startup.sh

Ответить

Вернуться в «Установка Заббикс»