Review Java Gateway startup script

This commit is contained in:
Alexey Pustovalov 2021-02-18 13:14:27 -05:00
commit 531b195374
18 changed files with 87 additions and 27 deletions

View File

@ -80,6 +80,14 @@ This variable is used to specify timeout for outgoing connections. By default, v
This variable is used to specify log level. By default, value is `info`. The variable allows next values: ``trace``, ``debug``, ``info``, ``want``, ``error``, ``all``, ``off`` This variable is used to specify log level. By default, value is `info`. The variable allows next values: ``trace``, ``debug``, ``info``, ``want``, ``error``, ``all``, ``off``
### `ZBX_PROPERTIES_FILE`
Name of properties file. Can be used to set additional properties using a key-value format in such a way that they are not visible on a command line or to overwrite existing ones. Available since 5.2.3.
### `ZABBIX_OPTIONS`
Additional arguments for Zabbix Java Gateway. Useful to enable additional libraries and features.
## Allowed volumes for the Zabbix Java Gateway container ## Allowed volumes for the Zabbix Java Gateway container
### ``/usr/sbin/zabbix_java/ext_lib`` ### ``/usr/sbin/zabbix_java/ext_lib``
@ -114,7 +122,7 @@ Please see [the Docker installation documentation](https://docs.docker.com/insta
## Documentation ## Documentation
Documentation for this image is stored in the [`java-gateway/` directory](https://github.com/zabbix/zabbix-docker/tree/3.0/java-gateway) of the [`zabbix/zabbix-docker` GitHub repo](https://github.com/zabbix/zabbix-docker/). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/zabbix/zabbix-docker/blob/master/README.md) before attempting a pull request. Documentation for this image is stored in the [`java-gateway/` directory](https://github.com/zabbix/zabbix-docker/tree/current/java-gateway) of the [`zabbix/zabbix-docker` GitHub repo](https://github.com/zabbix/zabbix-docker/). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/zabbix/zabbix-docker/blob/master/README.md) before attempting a pull request.
## Issues ## Issues

View File

@ -1,26 +1,34 @@
JAVA=${JAVA:-"/usr/bin/java"} JAVA=${JAVA:-"/usr/bin/java"}
DAEMON=${DAEMON:-"/usr/sbin/zabbix_java"}
JAVA_OPTIONS="-server $JAVA_OPTIONS" JAVA_OPTIONS="-server $JAVA_OPTIONS"
JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=/etc/zabbix/zabbix_java_gateway_logback.xml" JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=/etc/zabbix/zabbix_java_gateway_logback.xml"
cd $DAEMON cd /usr/sbin/zabbix_java
CLASSPATH="$DAEMON/lib" CLASSPATH="lib"
for jar in `find lib bin ext_lib -name "*.jar"`; do for jar in `find lib bin ext_lib -name "*.jar"`; do
if [ $jar != *junit* ]; then CLASSPATH="$CLASSPATH:$jar"
CLASSPATH="$CLASSPATH:$DAEMON/$jar"
fi
done done
ZABBIX_OPTIONS="" if [ -n "$ZBX_LISTEN_IP" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenIP=$ZBX_LISTEN_IP"
fi
if [ -n "$ZBX_LISTEN_PORT" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenPort=$ZBX_LISTEN_PORT"
fi
if [ -n "$ZBX_START_POLLERS" ]; then if [ -n "$ZBX_START_POLLERS" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.startPollers=$ZBX_START_POLLERS" ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.startPollers=$ZBX_START_POLLERS"
fi fi
if [ -n "$ZBX_TIMEOUT" ]; then if [ -n "$ZBX_TIMEOUT" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.timeout=$ZBX_TIMEOUT -Dsun.rmi.transport.tcp.responseTimeout=${ZBX_TIMEOUT}000" ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.timeout=$ZBX_TIMEOUT"
fi
if [ -n "$ZBX_PROPERTIES_FILE" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.propertiesFile=$ZBX_PROPERTIES_FILE"
fi fi
tcp_timeout=${ZBX_TIMEOUT:=3}000
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dsun.rmi.transport.tcp.responseTimeout=$tcp_timeout"
COMMAND_LINE="$JAVA $JAVA_OPTIONS -classpath $CLASSPATH $ZABBIX_OPTIONS com.zabbix.gateway.JavaGateway" COMMAND_LINE="$JAVA $JAVA_OPTIONS -classpath $CLASSPATH $ZABBIX_OPTIONS com.zabbix.gateway.JavaGateway"

View File

@ -80,6 +80,14 @@ This variable is used to specify timeout for outgoing connections. By default, v
This variable is used to specify log level. By default, value is `info`. The variable allows next values: ``trace``, ``debug``, ``info``, ``want``, ``error``, ``all``, ``off`` This variable is used to specify log level. By default, value is `info`. The variable allows next values: ``trace``, ``debug``, ``info``, ``want``, ``error``, ``all``, ``off``
### `ZBX_PROPERTIES_FILE`
Name of properties file. Can be used to set additional properties using a key-value format in such a way that they are not visible on a command line or to overwrite existing ones. Available since 5.2.3.
### `ZABBIX_OPTIONS`
Additional arguments for Zabbix Java Gateway. Useful to enable additional libraries and features.
## Allowed volumes for the Zabbix Java Gateway container ## Allowed volumes for the Zabbix Java Gateway container
### ``/usr/sbin/zabbix_java/ext_lib`` ### ``/usr/sbin/zabbix_java/ext_lib``
@ -114,7 +122,7 @@ Please see [the Docker installation documentation](https://docs.docker.com/insta
## Documentation ## Documentation
Documentation for this image is stored in the [`java-gateway/` directory](https://github.com/zabbix/zabbix-docker/tree/3.0/java-gateway) of the [`zabbix/zabbix-docker` GitHub repo](https://github.com/zabbix/zabbix-docker/). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/zabbix/zabbix-docker/blob/master/README.md) before attempting a pull request. Documentation for this image is stored in the [`java-gateway/` directory](https://github.com/zabbix/zabbix-docker/tree/current/java-gateway) of the [`zabbix/zabbix-docker` GitHub repo](https://github.com/zabbix/zabbix-docker/). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/zabbix/zabbix-docker/blob/master/README.md) before attempting a pull request.
## Issues ## Issues

View File

@ -1,26 +1,34 @@
JAVA=${JAVA:-"/usr/bin/java"} JAVA=${JAVA:-"/usr/bin/java"}
DAEMON=${DAEMON:-"/usr/sbin/zabbix_java"}
JAVA_OPTIONS="-server $JAVA_OPTIONS" JAVA_OPTIONS="-server $JAVA_OPTIONS"
JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=/etc/zabbix/zabbix_java_gateway_logback.xml" JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=/etc/zabbix/zabbix_java_gateway_logback.xml"
cd $DAEMON cd /usr/sbin/zabbix_java
CLASSPATH="$DAEMON/lib" CLASSPATH="lib"
for jar in `find lib bin ext_lib -name "*.jar"`; do for jar in `find lib bin ext_lib -name "*.jar"`; do
if [ $jar != *junit* ]; then CLASSPATH="$CLASSPATH:$jar"
CLASSPATH="$CLASSPATH:$DAEMON/$jar"
fi
done done
ZABBIX_OPTIONS="" if [ -n "$ZBX_LISTEN_IP" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenIP=$ZBX_LISTEN_IP"
fi
if [ -n "$ZBX_LISTEN_PORT" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenPort=$ZBX_LISTEN_PORT"
fi
if [ -n "$ZBX_START_POLLERS" ]; then if [ -n "$ZBX_START_POLLERS" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.startPollers=$ZBX_START_POLLERS" ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.startPollers=$ZBX_START_POLLERS"
fi fi
if [ -n "$ZBX_TIMEOUT" ]; then if [ -n "$ZBX_TIMEOUT" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.timeout=$ZBX_TIMEOUT -Dsun.rmi.transport.tcp.responseTimeout=${ZBX_TIMEOUT}000" ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.timeout=$ZBX_TIMEOUT"
fi
if [ -n "$ZBX_PROPERTIES_FILE" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.propertiesFile=$ZBX_PROPERTIES_FILE"
fi fi
tcp_timeout=${ZBX_TIMEOUT:=3}000
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dsun.rmi.transport.tcp.responseTimeout=$tcp_timeout"
COMMAND_LINE="$JAVA $JAVA_OPTIONS -classpath $CLASSPATH $ZABBIX_OPTIONS com.zabbix.gateway.JavaGateway" COMMAND_LINE="$JAVA $JAVA_OPTIONS -classpath $CLASSPATH $ZABBIX_OPTIONS com.zabbix.gateway.JavaGateway"

View File

@ -80,6 +80,14 @@ This variable is used to specify timeout for outgoing connections. By default, v
This variable is used to specify log level. By default, value is `info`. The variable allows next values: ``trace``, ``debug``, ``info``, ``want``, ``error``, ``all``, ``off`` This variable is used to specify log level. By default, value is `info`. The variable allows next values: ``trace``, ``debug``, ``info``, ``want``, ``error``, ``all``, ``off``
### `ZBX_PROPERTIES_FILE`
Name of properties file. Can be used to set additional properties using a key-value format in such a way that they are not visible on a command line or to overwrite existing ones. Available since 5.2.3.
### `ZABBIX_OPTIONS`
Additional arguments for Zabbix Java Gateway. Useful to enable additional libraries and features.
## Allowed volumes for the Zabbix Java Gateway container ## Allowed volumes for the Zabbix Java Gateway container
### ``/usr/sbin/zabbix_java/ext_lib`` ### ``/usr/sbin/zabbix_java/ext_lib``
@ -114,7 +122,7 @@ Please see [the Docker installation documentation](https://docs.docker.com/insta
## Documentation ## Documentation
Documentation for this image is stored in the [`java-gateway/` directory](https://github.com/zabbix/zabbix-docker/tree/3.0/java-gateway) of the [`zabbix/zabbix-docker` GitHub repo](https://github.com/zabbix/zabbix-docker/). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/zabbix/zabbix-docker/blob/master/README.md) before attempting a pull request. Documentation for this image is stored in the [`java-gateway/` directory](https://github.com/zabbix/zabbix-docker/tree/current/java-gateway) of the [`zabbix/zabbix-docker` GitHub repo](https://github.com/zabbix/zabbix-docker/). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/zabbix/zabbix-docker/blob/master/README.md) before attempting a pull request.
## Issues ## Issues

View File

@ -1,26 +1,34 @@
JAVA=${JAVA:-"/usr/bin/java"} JAVA=${JAVA:-"/usr/bin/java"}
DAEMON=${DAEMON:-"/usr/sbin/zabbix_java"}
JAVA_OPTIONS="-server $JAVA_OPTIONS" JAVA_OPTIONS="-server $JAVA_OPTIONS"
JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=/etc/zabbix/zabbix_java_gateway_logback.xml" JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=/etc/zabbix/zabbix_java_gateway_logback.xml"
cd $DAEMON cd /usr/sbin/zabbix_java
CLASSPATH="$DAEMON/lib" CLASSPATH="lib"
for jar in `find lib bin ext_lib -name "*.jar"`; do for jar in `find lib bin ext_lib -name "*.jar"`; do
if [ $jar != *junit* ]; then CLASSPATH="$CLASSPATH:$jar"
CLASSPATH="$CLASSPATH:$DAEMON/$jar"
fi
done done
ZABBIX_OPTIONS="" if [ -n "$ZBX_LISTEN_IP" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenIP=$ZBX_LISTEN_IP"
fi
if [ -n "$ZBX_LISTEN_PORT" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenPort=$ZBX_LISTEN_PORT"
fi
if [ -n "$ZBX_START_POLLERS" ]; then if [ -n "$ZBX_START_POLLERS" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.startPollers=$ZBX_START_POLLERS" ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.startPollers=$ZBX_START_POLLERS"
fi fi
if [ -n "$ZBX_TIMEOUT" ]; then if [ -n "$ZBX_TIMEOUT" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.timeout=$ZBX_TIMEOUT -Dsun.rmi.transport.tcp.responseTimeout=${ZBX_TIMEOUT}000" ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.timeout=$ZBX_TIMEOUT"
fi
if [ -n "$ZBX_PROPERTIES_FILE" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.propertiesFile=$ZBX_PROPERTIES_FILE"
fi fi
tcp_timeout=${ZBX_TIMEOUT:=3}000
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dsun.rmi.transport.tcp.responseTimeout=$tcp_timeout"
COMMAND_LINE="$JAVA $JAVA_OPTIONS -classpath $CLASSPATH $ZABBIX_OPTIONS com.zabbix.gateway.JavaGateway" COMMAND_LINE="$JAVA $JAVA_OPTIONS -classpath $CLASSPATH $ZABBIX_OPTIONS com.zabbix.gateway.JavaGateway"

View File

@ -318,6 +318,7 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "HostnameItem" "${ZBX_HOSTNAMEITEM}" update_config_var $ZBX_CONFIG "HostnameItem" "${ZBX_HOSTNAMEITEM}"
fi fi
update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"
update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}" update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"
update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}" update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"

View File

@ -315,6 +315,7 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "HostnameItem" "${ZBX_HOSTNAMEITEM}" update_config_var $ZBX_CONFIG "HostnameItem" "${ZBX_HOSTNAMEITEM}"
fi fi
update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"
update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}" update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"
update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}" update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"

View File

@ -315,6 +315,7 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "HostnameItem" "${ZBX_HOSTNAMEITEM}" update_config_var $ZBX_CONFIG "HostnameItem" "${ZBX_HOSTNAMEITEM}"
fi fi
update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"
update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}" update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"
update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}" update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"

View File

@ -124,6 +124,7 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "HostnameItem" "${ZBX_HOSTNAMEITEM}" update_config_var $ZBX_CONFIG "HostnameItem" "${ZBX_HOSTNAMEITEM}"
fi fi
update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"
update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}" update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"
update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}" update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"

View File

@ -124,6 +124,7 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "HostnameItem" "${ZBX_HOSTNAMEITEM}" update_config_var $ZBX_CONFIG "HostnameItem" "${ZBX_HOSTNAMEITEM}"
fi fi
update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"
update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}" update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"
update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}" update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"

View File

@ -124,6 +124,7 @@ update_zbx_config() {
update_config_var $ZBX_CONFIG "HostnameItem" "${ZBX_HOSTNAMEITEM}" update_config_var $ZBX_CONFIG "HostnameItem" "${ZBX_HOSTNAMEITEM}"
fi fi
update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"
update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}" update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"
update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}" update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"

View File

@ -302,6 +302,7 @@ update_zbx_config() {
ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf
update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"
update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}" update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"
update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}" update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"

View File

@ -299,6 +299,7 @@ update_zbx_config() {
ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf
update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"
update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}" update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"
update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}" update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"

View File

@ -299,6 +299,7 @@ update_zbx_config() {
ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf
update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"
update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}" update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"
update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}" update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"

View File

@ -335,6 +335,7 @@ update_zbx_config() {
ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf
update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"
update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}" update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"
update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}" update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"

View File

@ -335,6 +335,7 @@ update_zbx_config() {
ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf
update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"
update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}" update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"
update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}" update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"

View File

@ -335,6 +335,7 @@ update_zbx_config() {
ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf
update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"
update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}" update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"
update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}" update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"