[[core-docker]]
= Core Docker
:description: Learn about startup arguments and environment variables for the Docker with the OpenNMS {page-component-title} core.

== Startup arguments

[options="header, %autowidth"]
|===
| Argument | Description
| `-h`     | Display help with available arguments.
| `-f`     | Start the process in the foreground and use existing data and configuration.
| `-i`     | One-time command to initialize or update database and configuration files and do *NOT* start.
| `-s`     | Command to initialize or update database and configuration files and start OpenNMS in the foreground.
| `-t`     | One-time command to run the config-tester against the configuration.
|===

[[core-oci-confd]]
== Environment variables

.Java options
|===
| Environment variable        | Description                                            | Required | Default value
| `JAVA_OPTS`                 | Allows you to add additional Java options.             | optional | `-`
| `PROM_JMX_EXPORTER_ENABLED` | Enable the JMX Prometheus Exporter agent.              | required | `false`
| `PROM_JMX_EXPORTER_PORT`    | TCP port for the JMX Prometheus Exporter.              | optional | `9299`
| `PROM_JMX_EXPORTER_CONFIG`  | Path to the JMX Prometheus Exporter configuration file | optional | `/opt/prom-jmx-exporter/config.yaml`
| `PROM_JMX_EXPORTER_JAR`     | Path to the JMX Prometheus agent                       | optional | `/opt/prom-jmx-exporter/jmx_prometheus_javaagent.jar`
|===

.PostgreSQL connection configuration in opennms-datasources.xml
[options="header, %autowidth"]
|===
| Environment variable                       | Description                                                                       | Required | Default value
| `OPENNMS_DBNAME`                           | Database name used for {page-component-title} Core instance                       | required | -
| `OPENNMS_DBUSER`                           | Username with access to the database                                              | required | -
| `OPENNMS_DBPASS`                           | Password for user with acccess to the database                                    | required | -
| `POSTGRES_HOST`                            | Host with the PostgreSQL server instance running                                  | required | -
| `POSTGRES_USER`                            | PostgreSQL super user to initialize database schema specified in `OPENNMS_DBNAME` | required | -
| `POSTGRES_PASSWORD`                        | PostgreSQL super user password                                                    | required | -
| `POSTGRES_PORT`                            | PostgreSQL server port                                                            | optional | `5432`
| `POSTGRES_SSL_MODE`                        | Encryption for database communication                                             | optional | `prefer`
| `POSTGRES_SSL_FACTORY`                     | PostgreSQL SSL factory for certificate validation                                 | optional | `org.postgresql.ssl.LibPQFactory`
| `OPENNMS_DATABASE_CONNECTION_IDLETIMEOUT`  | Global database connection pool idle timeout                                      | optional | `600`
| `OPENNMS_DATABASE_CONNECTION_LOGINTIMEOUT` | Global database connection pool login timeout                                     | optional | `3`
| `OPENNMS_DATABASE_CONNECTION_MINPOOL`      | Global minimal connection pool size                                               | optional | `25`
| `OPENNMS_DATABASE_CONNECTION_MAXPOOL`      | Global maximum connection pool size                                               | optional | `50`
| `OPENNMS_DATABASE_CONNECTION_MAXSIZE`      | Global maximum connections                                                        | optional | `50`
|===

.Timeseries storage configuration in opennms.properties.d/_confd.timeseries.properties
[options="header, %autowidth"]
|===
| Environment variable               | Description                                                             | Required | Default value
| `OPENNMS_TIMESERIES_STRATEGY`      | Used Timeseries storage strategy                                        | optional | `rrd`
| `OPENNMS_RRD_STOREBYFOREIGNSOURCE` | Store timeseries data by foreign source instead of the database node id | optional | `true`
| `OPENNMS_RRD_STRATEGYCLASS`        | Java RRD Strategy class                                                 | optional | `org.opennms.netmgt.rrd.rrdtool.MultithreadedJniRrdStrategy`
| `OPENNMS_RRD_INTERFACEJAR`         | Java RRD Interface library                                              | optional | `/usr/share/java/jrrd2.jar`
| `OPENNMS_LIBRARY_JRRD2`            | JRRD2 library path                                                      | optional | `/usr/lib64/libjrrd2.so`
|===

.SNMP Trap receiver configuration in trapd-configuration.xml
[options="header, %autowidth"]
|===
| Environment variable              | Description                                                        | Required | Default value
| `OPENNMS_TRAPD_ADDRESS`           | Listen interface for SNMP Trapd                                    | optional | `*`
| `OPENNMS_TRAPD_PORT`              | Port to listen for SNMP traps                                      | optional | `1162`
| `OPENNMS_TRAPD_NEWSUSPECTONTRAP`  | Create new suspect event-based trap recipient for unknown devices. | optional | `false`
| `OPENNMS_TRAPD_INCLUDERAWMESSAGE` | Preserve raw messages in SNMP traps.                               | optional | `false`
| `OPENNMS_TRAPD_THREADS`           | Set maximum thread size to process SNMP traps.                     | optional | `0`
| `OPENNMS_TRAPD_QUEUESIZE`         | Set maximum queue for SNMP trap processing.                        | optional | `10000`
| `OPENNMS_TRAPD_BATCHSIZE`         | Set batch size for SNMP trap processing.                           | optional | `1000`
| `OPENNMS_TRAPD_BATCHINTERVAL`     | Set batch processing interval in milliseconds.                     | optional | `500`
|===

.Karaf Shell configuration in org.apache.karaf.shell.cfg
[options="header, %autowidth"]
|===
| Environment variable     | Description                        | Required | Default value
| `OPENNMS_karaf_SSH_HOST` | Listen interface for Karaf shell | optional | `0.0.0.0`
| `OPENNMS_karaf_SSH_PORT` | SSH port for Karaf shell       | optional | `8101`
|===

.Cassandra and Newts configuration in opennms.properties.d/_confd.newts.properties
[options="header, %autowidth"]
|===
| Environment variable           | Description                                                               | Required | Default value
| `REPLICATION_FACTOR`           | Set Cassandra replication factor for the newts keyspace if Newts is used. | optional | `1`
| `OPENNMS_CASSANDRA_HOSTNAME`   | A comma-separated list with Cassandra hosts for Newts                     | optional | `localhost`
| `OPENNMS_CASSANDRA_KEYSPACE`   | Name of the keyspace used by Newts                                        | optional | `newts`
| `OPENNMS_CASSANDRA_PORT`       | Cassandra server port                                                     | optional | `9042`
| `OPENNMS_CASSANDRA_USERNAME`   | Username with access to Cassandra                                         | optional | `cassandra`
| `OPENNMS_CASSANDRA_PASSWORD`   | Password for user with access to Cassandra                                | optional | `cassandra`
| `OPENNMS_CASSANDRA_DATACENTER` | Set this to the value of your local datacenter for the best performance   | optional | `datacenter1`
|===

== Directory conventions

[options="header, %autowidth"]
|===
| Mountpoint             | Description
| `/opt/opennms-overlay` | Allows you to overwrite files relative to `/opt/opennms`.
| `/opennms-data`        | Directory with RRDTool files and generated PDF reports sent to the file system.
|===

== JMX Prometheus Exporter

.JMX Exporter with a Confd YAML configuration file
[source, yaml]
----
java:
  agent:
    prom-jmx-exporter:
      startDelaySeconds: 0
      lowerCaseOutputName: true
      lowercaseOutputLabelNames: true
      autoExcludeObjectNameAttributes: true
      includeObjectNames:
        - "java.lang:*"
        - "OpenNMS:*"
        - "org.opennms.*:*"
        - "org.opennms.newts:name=ring-buffer*"
        - "org.opennms.newts:name=repository.samples-inserted*"
        - "org.opennms.core.ipc.rpc:*"
      excludeObjectNames:
        - "org.apache.camel:*"
----
