Difference between revisions of "OS4X Core environment variables"

From OS4X
Jump to navigation Jump to search
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
Some environment variables are created and/or set by all OS4X binaries. These variables are:  
+
Environment variables are created and/or set by all OS4X binaries, which values are based on the configuration of OS4X. These variables are:  
*<code>OS4X_CFGFILE</code>: [[OS4X_Core_installation#Main_configuration|OS4X main configuration file (absolute path information)]]
+
*<code>OS4X_CFGFILE</code>: [[OS4X Core main configuration file|OS4X main configuration file (absolute path information)]]
 
*<code>OS4X_IN_DIR</code>: [[OS4X_Core_configuration#data_incoming_directory|incoming data directory]]
 
*<code>OS4X_IN_DIR</code>: [[OS4X_Core_configuration#data_incoming_directory|incoming data directory]]
 
*<code>OS4X_OUT_DIR</code>: [[OS4X_Core_configuration#data_outgoing_directory|outgoing data directory]]
 
*<code>OS4X_OUT_DIR</code>: [[OS4X_Core_configuration#data_outgoing_directory|outgoing data directory]]
Line 12: Line 12:
 
*<code>RRDB_DATAPATH</code>: [[OS4X_Core_configuration#RRDB_data_path|RRD data path]]
 
*<code>RRDB_DATAPATH</code>: [[OS4X_Core_configuration#RRDB_data_path|RRD data path]]
 
*<code>OS4X_WEBGUI_DIR</code>: web interface installation directory
 
*<code>OS4X_WEBGUI_DIR</code>: web interface installation directory
*<code>JAVA_BIN</code>: configured path to the Java runtime (JRE) binary
 
 
*<code>CA_FILE</code>: [[OS4X_Core_configuration#root_certificate_file_.26_root_certificate_path|configured absolute path to the root certificate file]]
 
*<code>CA_FILE</code>: [[OS4X_Core_configuration#root_certificate_file_.26_root_certificate_path|configured absolute path to the root certificate file]]
 
*<code>CA_PATH</code>: [[OS4X_Core_configuration#root_certificate_file_.26_root_certificate_path|configured absolute path to the root certificate directory]]
 
*<code>CA_PATH</code>: [[OS4X_Core_configuration#root_certificate_file_.26_root_certificate_path|configured absolute path to the root certificate directory]]
 +
 +
The following environment variables are extracted form the global OS4X configuration file (default: <code>/etc/os4x.conf</code>):
 +
*<code>OS4X_DB_HOST</code>
 +
*<code>OS4X_DB_USER</code>
 +
*<code>OS4X_DB_PWD</code>
 +
*<code>OS4X_DB_NAME</code>
 +
*<code>OS4X_DB_SOCKET</code>
 +
*<code>OS4X_DB_PORT</code>
 +
*<code>OS4X_DB_TYPE</code>: either "<code>mysql</code>", "<code>DB2</code>", "<code>sqlite</code>" or "<code>POSTGRESQL</code>"
 +
 +
Beginning from OS4X build 2019-08-09, the following variable exists:
 +
*<code>OS4X_DB_PREFIX</code>: database table prefix
 +
 +
Beginning from OS4X build 2020-12-08, the following variable exists:
 +
*<code>OS4X_DB_SCHEMA</code>: database schema name (only used in PostgreSQL)
 +
  
 
All processes started by OS4X (event scripts, plugins, etc.) have access to these environment variables.  
 
All processes started by OS4X (event scripts, plugins, etc.) have access to these environment variables.  
Line 20: Line 35:
 
*you may start OS4X programs in a shell where this variable is set without using the parameter "<code>-C</code>" for all binaries (because the environment variable points to the correct position of the configfile)  
 
*you may start OS4X programs in a shell where this variable is set without using the parameter "<code>-C</code>" for all binaries (because the environment variable points to the correct position of the configfile)  
 
*all subsequent processes started by OS4X (like event scripts) don't have to bother about the given configfile (like plugins of OS4X Enterprise).
 
*all subsequent processes started by OS4X (like event scripts) don't have to bother about the given configfile (like plugins of OS4X Enterprise).
 +
 +
== Database performance benchmarking ==
 +
Available in OS4X 3 Core, an environment variable can be set to log all database access timing information into that given file:
 +
OS4X_DB_BENCHMARKLOG
 +
You can set this variable to an absolute filename where OS4X logs all innformation (example: "ksh" or "bash"):
 +
export OS4X_DB_BENCHMARKLOG=/tmp/db2perf.log
 +
This file logs the connect and query time for every single database access, resulting in a fast growing file. The content if this file looks like this (using DB2 database abstraction layer, others like MySQL start with "<code>MySQL</code>"):
 +
<pre>
 +
DB2 connect: 0.052482 seconds
 +
DB2 SQL query: 0.126631 seconds
 +
DB2 connect: 0.032447 seconds
 +
DB2 SQL query: 0.004983 seconds
 +
DB2 connect: 0.029555 seconds
 +
DB2 SQL query: 0.004500 seconds
 +
DB2 connect: 0.031012 seconds
 +
DB2 SQL query: 0.001324 seconds
 +
</pre>

Latest revision as of 20:38, 8 December 2020

Environment variables are created and/or set by all OS4X binaries, which values are based on the configuration of OS4X. These variables are:

The following environment variables are extracted form the global OS4X configuration file (default: /etc/os4x.conf):

  • OS4X_DB_HOST
  • OS4X_DB_USER
  • OS4X_DB_PWD
  • OS4X_DB_NAME
  • OS4X_DB_SOCKET
  • OS4X_DB_PORT
  • OS4X_DB_TYPE: either "mysql", "DB2", "sqlite" or "POSTGRESQL"

Beginning from OS4X build 2019-08-09, the following variable exists:

  • OS4X_DB_PREFIX: database table prefix

Beginning from OS4X build 2020-12-08, the following variable exists:

  • OS4X_DB_SCHEMA: database schema name (only used in PostgreSQL)


All processes started by OS4X (event scripts, plugins, etc.) have access to these environment variables. The environment variable "OS4X_CFGFILE" points to the absolute path to the OS4X main configuration file. This has two effects:

  • you may start OS4X programs in a shell where this variable is set without using the parameter "-C" for all binaries (because the environment variable points to the correct position of the configfile)
  • all subsequent processes started by OS4X (like event scripts) don't have to bother about the given configfile (like plugins of OS4X Enterprise).

Database performance benchmarking

Available in OS4X 3 Core, an environment variable can be set to log all database access timing information into that given file:

OS4X_DB_BENCHMARKLOG

You can set this variable to an absolute filename where OS4X logs all innformation (example: "ksh" or "bash"):

export OS4X_DB_BENCHMARKLOG=/tmp/db2perf.log

This file logs the connect and query time for every single database access, resulting in a fast growing file. The content if this file looks like this (using DB2 database abstraction layer, others like MySQL start with "MySQL"):

DB2 connect: 0.052482 seconds
DB2 SQL query: 0.126631 seconds
DB2 connect: 0.032447 seconds
DB2 SQL query: 0.004983 seconds
DB2 connect: 0.029555 seconds
DB2 SQL query: 0.004500 seconds
DB2 connect: 0.031012 seconds
DB2 SQL query: 0.001324 seconds