################################
# OpenSearch
################################

# OpenSearch home directory


# Directory where the OpenSearch binary distribution resides
OPENSEARCH_HOME="/usr/local/nagioslogserver/opensearch"

# k-NN Lib Path
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/usr/local/nagioslogserver/opensearch/plugins/opensearch-knn/lib"

# OpenSearch configuration directory
# Note: this setting will be shared with command-line tools
OPENSEARCH_PATH_CONF=/usr/local/nagioslogserver/opensearch/config

# OpenSearch PID directory
PID_DIR=/var/run/opensearch

# Additional Java OPTS
#OPENSEARCH_JAVA_OPTS=

JAVA_HOME=/usr/local/nagioslogserver/opensearch/jdk

################################
# OpenSearch service
################################

# The number of seconds to wait before checking if OpenSearch started successfully as a daemon process
OPENSEARCH_STARTUP_SLEEP_TIME=5

# Notification for systemd
OPENSEARCH_SD_NOTIFY=true


# Heap Size (defaults to 256m min, 1g max)
# Nagios Log Server Default to 0.5 physical Memory
ES_HEAP_SIZE=$(expr $(free -m|awk '/^Mem:/{print $2}') / 2 )
if [ $ES_HEAP_SIZE -gt 32000 ] ; then
        ES_HEAP_SIZE=32000
fi

# Heap new generation
#ES_HEAP_NEWSIZE=

# max direct memory
#ES_DIRECT_SIZE=

# Additional Java OPTS
#ES_JAVA_OPTS=

################################
# System properties
################################

# Specifies the maximum file descriptor number that can be opened by this process
# When using Systemd, this setting is ignored and the LimitNOFILE defined in
# /usr/lib/systemd/system/opensearch.service takes precedence
MAX_OPEN_FILES=65535

# The maximum number of bytes of memory that may be locked into RAM
# Set to "unlimited" if you use the 'bootstrap.memory_lock: true' option
# in opensearch.yml.
# When using systemd, LimitMEMLOCK must be set in a unit file such as
# /etc/systemd/system/opensearch.service.d/override.conf.
MAX_LOCKED_MEMORY=unlimited

# Maximum number of VMA (Virtual Memory Areas) a process can own
# When using Systemd, this setting is ignored and the 'vm.max_map_count'
# property is set at boot time in /usr/lib/sysctl.d/opensearch.conf
MAX_MAP_COUNT=262144

# OpenSearch log directory
LOG_DIR=/var/log/opensearch

# OpenSearch data directory
DATA_DIR="/usr/local/nagioslogserver/opensearch/data"

# OpenSearch work directory
WORK_DIR="/usr/local/nagioslogserver/tmp/opensearch"

# OpenSearch conf directory
CONF_DIR="/usr/local/nagioslogserver/opensearch/config"

# OpenSearch configuration file (opensearch.yml)
CONF_FILE="/usr/local/nagioslogserver/opensearch/config/opensearch.yml"

# User to run as, change this to a specific OpenSearch user if possible
# Also make sure, this user can write into the log directories in case you change them
# This setting only works for the init script, but has to be configured separately for systemd startup
ES_USER=nagios
ES_GROUP=nagios

# Configure restart on package upgrade (true, every other setting will lead to not restarting)
#RESTART_ON_UPGRADE=true

#if [ "x$1" == "xstart" -o "x$1" == "xrestart" -o "x$1" == "xreload" -o "x$1" == "xforce-reload" ];then
#	GET_ES_CONFIG_MESSAGE="$( php $APP_DIR/scripts/get_es_config.php )"
#	GET_ES_CONFIG_RETURN=$?
#
#	if [ "$GET_ES_CONFIG_RETURN" != "0" ]; then
#		echo $GET_ES_CONFIG_MESSAGE
#		exit 1
#	else
#		ES_JAVA_OPTS="$GET_ES_CONFIG_MESSAGE"
#	fi
#fi
