{"id":20194941,"url":"https://github.com/newrelic-experimental/nri-db","last_synced_at":"2025-04-10T10:13:24.184Z","repository":{"id":64188317,"uuid":"296041982","full_name":"newrelic-experimental/nri-db","owner":"newrelic-experimental","description":"Database On-Host Integration for New Relic Infrastructure (formerly 'InfraDBPlugin')","archived":false,"fork":false,"pushed_at":"2022-12-04T01:56:42.000Z","size":447,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T09:05:03.716Z","etag":null,"topics":["database","db2"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/newrelic-experimental.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-16T13:32:02.000Z","updated_at":"2024-10-17T16:22:56.000Z","dependencies_parsed_at":"2023-01-15T03:30:59.831Z","dependency_job_id":null,"html_url":"https://github.com/newrelic-experimental/nri-db","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-experimental%2Fnri-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-experimental%2Fnri-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-experimental%2Fnri-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-experimental%2Fnri-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/newrelic-experimental","download_url":"https://codeload.github.com/newrelic-experimental/nri-db/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248198889,"owners_count":21063628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","db2"],"created_at":"2024-11-14T04:14:59.283Z","updated_at":"2025-04-10T10:13:24.136Z","avatar_url":"https://github.com/newrelic-experimental.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Experimental Project header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Experimental.png)](https://opensource.newrelic.com/oss-category/#experimental)\n\n# New Relic Infrastructure Database Integration\n\nThe New Relic Infrastructure Database Integration is a standalone Java\napplication that uses JDBC to extract telemetry from a variety of relational\ndatabase management systems.\n\n## Compatibility\n\nThe following database types are supported.\n\n| Database Vendor | JDBC Driver Class | Driver Packaged? | Provider ID |\n| --- | --- | --- | --- |\n| IBM AS/400 | `com.ibm.as400.access.AS400JDBCDriver` | N | AS400 |\n| IBM Db/2 | `com.ibm.db2.jcc.DB2Driver` | N | DB2 |\n| Oracle | `oracle.jdbc.driver.OracleDriver` | N | oracle |\n| MSSQL | `com.microsoft.sqlserver.jdbc.SQLServerDriver` | N | MSSQL |\n| MySQL | `com.mysql.cj.jdbc.Driver` | N | MySQL |\n| Postgres | `org.postgresql.Driver` | Y | Postgres |\n| HSQLDB | `org.hsqldb.jdbc.JDBCDriver` | Y | HSQLDB |\n| Sybase | `com.sybase.jdbc42.jdbc.SybDriver` | N | SYBASE |\n\n## Installation\n\nThere are three deployment options for the New Relic Infrastructure Database\nIntegration (hereafter just `nri-db`).\n\n1. On-host: The Java application is run directly on a host as a native process\n1. Docker: The Java application is run inside a Docker container deployed to a container\n   service (e.g. AWS ECS) using a [docker-compose file](https://docs.docker.com/compose/compose-file/)\n1. Kubernetes: The Java application is run as a deployment in a Kubernetes\n   cluster\n\nThe following steps are required for _all_ deployment options.\n\n1. Download and extract [the latest release](https://github.com/newrelic-experimental/nri-db/releases)\n   from this repository.\n\n   For On-host deployments, if deploying to a host manually, perform this\n   steps directly on the host. For Docker or Kubernetes deployments, or if\n   deploying on-host using an automation tool such as\n   [Ansible](https://www.ansible.com/), perform this step locally to prepare\n   the configuration files, images, etc.\n\n1. Setup an [encryption password](#setup-an-encryption-password)\n1. [Encrypt](#encrypt-passwords) the database password\n1. (Optional) [Encrypt](#encrypt-passwords) the trust store password if\n   connecting to databases using SSL\n\n### On-host\n\n1. Setup the [configuration file](#integration-configuration)\n1. Setup the [database command file(s)](#database-command-file)\n1. Deploy [the latest release](https://github.com/newrelic-experimental/nri-db/releases)\n   to the host if not already deployed\n1. Copy the configuration file to `config/plugin.json`\n1. Copy the database command file(s) to the appropriate directory\n1. [Run](#running-the-integration-on-host) the integration\n\n### Docker\n\n1. Setup the [configuration file](#integration-configuration)\n1. Setup the [database command file(s)](#database-command-file)\n1. Build the Docker image, specifying an appropriate tag for your deployment\n   service, the local path to the JDBC driver for your database, and the\n   name of the JDBC driver Jar.\n\n   `docker build -t name:tag . --build-arg db_driver_path=/path/to/dbdriver.jar --build-arg db_driver_jar=dbdriver.jar`\n\n   When using a single `nri-db` container to access databases from multiple\n   vendors, manual customization of the [`Dockerfile`](./Dockerfile) will be\n   necessary in order to add multiple driver JARs to the image and to the\n   `CLASSPATH`. See [Using Multiple Databases With The `Dockerfile`](#using-multiple-drivers-with-the-dockerfile)\n\n1. Create a `.env` file in the project root with the following contents\n\n   ```ini\n   NRI_DB_NAME_TAG=name:tag\n   ```\n\n   where `name:tag` is the tag used to build the image in the previous step\n\n1. Follow the instructions from your cloud provider for deploying Docker\n   containers.  For AWS ECS, you can use the\n   [docker-compose CLI ECS integration](https://docs.docker.com/cloud/ecs-integration/).\n\n### Kubernetes\n\nDeployment to Kubernetes is done via a [Helm](https://helm.sh/) [chart](./helm).\n\n1. Build a Docker image as outlined [above](#docker)\n1. Setup the [Helm values file](#helm-values-file)\n1. Install the Helm chart by executing the following command from the project\n   directory root\n\n   `helm install -f /path/to/values.yaml nri-db ./helm/nri-db`\n\n## Usage\n\n### Password Encryption\n\nThe New Relic Infrastructure Database Integration uses password based encryption\nto encrypt passwords in the [configuration file](#integration-configuration).\nPassword based encryption uses an alphanumeric password to encrypt and decrypt\ndata.\n\nDuring setup, the encryption password is used by the included `encrypt-password`\ntool to encrypt the passwords for the configuration file.  At runtime, the\nencryption password is used to decrypt the passwords prior to executing\noperations that require a password.\n\nIn both cases, the encryption password can either be specified as an environment\nvariable or specified in a Java properties file named `.nridbrc` in the\ndirectory from which the integration is launched.\n\n#### Setup an encryption password\n\nBefore any passwords can be encrypted, an encryption password must be\nestablished. You can choose your own password or generate one using the\n`encrypt-password` tool.\n\n##### Generate a random encryption password\n\nThere are two ways to generate a random encryption password. The method you use\ndepends on whether you plan to specify the encryption password at runtime via an\nenvironment variable of the `.nridbrc` file.\n\n1. To generate an encryption password and create the `.nridbrc` file at the same\n   time, simply invoke the `./bin/encrypt-password` command.\n2. To generate an encryption password for use as an environment variable, invoke\n   the command `./bin/encrypt-password --generate`. A random encryption password\n   will be generated and output to the screen. Save the value for later use.\n\n##### Choose your own password\n\nIf you plan to specify the encryption password as an environment variable, no\nfurther action is necessary. If you plan to specify the encryption password via\nthe `.nridbrc` file, create a file named `.nridbrc` within the project root\ndirectory with the following format.\n\n```properties\nencryptionPassword=YOUR_ENCRYPTION_PASSWORD_HERE\n```\n\n#### Encrypt passwords\n\nThe `encrypt-password` tool is used to encrypt passwords for use within the\n[configuration file](#integration-configuration). The password to encrypt can be\nspecified either on the command line or using a password prompt. The specified\npassword will be encrypted using the encryption password and the resulting\nencrypted value will be output to the console.\n\nThe encryption password will be taken from either the environment variable named\n`NRIDB_ENCRYPTION_PASSWORD` or, if no value exists or the value is empty, from\na file named `.nridbrc` in the current directory. If no such file exists, the\ntool will create the file with a random password and exit. You must run it again\nto actually encrypt the password.\n\nTo encrypt a password by specifying it at the command line, execute the\nfollowing command from the project root directory.\n\n```sh\n./bin/encrypt-password YOUR_PASSWORD_HERE\n```\n\nThe screenshot below shows an example of encrypting the password `password`\nusing the encryption key `12345` by specifying the password as an argument at\nthe command line.\n\n![encrypt password argument](./docs/images/encrypt-arg.png)\n\nTo encrypt a password using a secure password prompt, execute the\n`encrypt-password` tool with no arguments from the project root directory as\nfollows.\n\n```sh\n./bin/encrypt-password\n```\n\nThe screenshot below shows an example of encrypting the password `password`\nusing the encryption key `12345` using the secure password prompt.\n\n![encrypt password prompt](./docs/images/encrypt-prompt.png)\n\n### Integration Configuration\n\nThe New Relic Infrastructure Database Integration configuration file consists of\ntwo main parts: the New Relic connections settings and a list of\n\"agent instances\". The [sample configuration file](./config/plugin.sample.json)\nshows an example of all possible settings.\n\n#### Connection settings\n\nThe `global` section of the integration configuration file contains the settings\nused to connect to New Relic and insert data via the Event API. The section\ntakes the following format.\n\n```json\n{\n  \"global\": {\n    \"account_id\": \"insert_your_RPM_account_ID_here\",\n    \"insights_mode\": {\n      \"insights_insert_key\": \"insert_your_insights_insert_key_here\"\n    },\n    \"proxy\": {\n      \"proxy_host\": \"enter_proxy_host\",\n      \"proxy_port\": 8080,\n      \"proxy_username\": \"enter_proxy_username\",\n      \"proxy_password\": \"enter_proxy_password\"\n    }\n  },\n  \"agents\": [\n    ...\n  ]\n}\n```\n\nThe available settings and their meanings are as follows.\n\n##### Valid connection settings\n\n| Setting | Description |\n| --- | --- |\n| account_id | A New Relic account ID to which to send telemetry |\n| insights_mode.insights_insert_key | A New Relic [insights insert key / license key](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/#insights-insert-key) |\n| proxy.proxy_host | If a proxy is required to connect to New Relic, the proxy hostname |\n| proxy.proxy_port | If a proxy is required to connect to New Relic, the proxy port |\n| proxy.proxy_username | If an authenticated proxy is required to connect to New Relic, the proxy username |\n| proxy.proxy_password | If an authenticated proxy is required to connect to New Relic, the proxy password |\n\n#### Agent instances\n\nThe `agents` section of the integration configuration file contains a list of\n\"agent instances\". Each agent instance is a defined by a configuration\nconsisting of the connections settings of a database to connect to along with\nthe path to a [database command file](#database-command-file). The section takes\nthe following format.\n\n```json\n{\n  \"global\": {\n    ...\n  },\n  \"agents\": [\n    {\n      \"name\": \"INSTANCE NAME\",\n      \"host\": \"HOST\",\n      \"port\": 12345,\n      \"username\": \"DB USER\",\n      \"password\": \"ENCRYPTED PASSWORD\",\n      \"inputfile\": \"PATH TO QUERY JSON FILE\",\n    },\n    ...\n    {\n      \"name\": \"INSTANCE NAME 2\",\n      \"host\": \"HOST\",\n      \"port\": 12345,\n      \"username\": \"DB USER\",\n      \"password\": \"ENCRYPTED PASSWORD\",\n      \"inputfile\": \"PATH TO QUERY JSON FILE\",\n      \"sslConnection\": true,\n      \"sslEncrypt\": true,\n      \"sslTrustServerCert\": true,\n      \"sslHostnameInCert\": \"HOSTNAME\",\n      \"sslTrustStoreLocation\": \"TRUST STORE LOCATION\",\n      \"sslTrustStorePassword\": \"ENCRYPTED TRUST STORE PASSWORD\",\n      \"static\": {\n        \"foo\": \"bar\",\n        \"beep\": \"bop\"\n      }\n    }\n  ]\n```\n\nThe available settings and their meanings are as follows.\n\n##### Valid agent instance settings\n\n| Setting | Description | Type | Required? | Default |\n| --- | --- | --- | --- | --- |\n| name | A name for the agent instance. This is *not* the database name. It is used in the event data sent to New Relic and can be used to query different database samples via NRQL. | string | Y | n/a |\n| host | The hostname of the database to which to connect | string | Y | n/a |\n| port | The port of the database to which to connect | integer | Y | n/a |\n| username | The username to use to authenticate to the database | string | Y | n/a |\n| password | The password to use to authenticate to the database | string | Y | n/a |\n| inputfile | The path to the [database command file](#database-command-file) | string | Y | n/a |\n| sslConnection | Whether or not to use secure sockets when connecting to the database | boolean | N | false |\n| sslEncrypt | MSSQL only - driver uses TLS encryption | boolean | N | false |\n| sslTrustServerCert | MSSQL only - whether or not the host's SSL cert is automatically trusted via TLS | boolean | N | false |\n| sslHostnameInCert | MSSQL only - The host name to be used to validate the SQL Server TLS/SSL certificate | string | N | '' |\n| sslTrustStoreLocation | The path to the [database command file](#database-command-file) | string | Y if sslConnection = true | '' |\n| sslTrustStorePassword | The path to the [database command file](#database-command-file) | string | Y if sslConnection = true | '' |\n| static | An set of key/value pairs to add to every event for this instance | object | N | null |\n| useSsl | Sybase only | boolean | N | false |\n\n### Database Command File\n\nEach agent instance must specify a database command file. A database command\nfile consists of a list of queries to run. Each query is specified using a\nconfiguration consisting of the query to run along with a name for the query and\nthe database name and provider. The file takes the following format.\n\n```json\n[\n  {\n    \"query\" : \"select * from pg_stat_activity\",\n    \"name\" : \"Stat Activity\",\n    \"type\" : \"metric\",\n    \"database\" : \"postgres\",\n    \"provider\" : \"Postgres\"\n  },\n  ...\n  {\n    \"query\" : \"select * from pg_user\",\n    \"name\" : \"Archive Files\",\n    \"type\" : \"metric\",\n    \"database\" : \"postgres\",\n    \"provider\" : \"Postgres\"\n  }\n]\n```\n\nThe available settings and their meanings are as follows.\n\n#### Valid query configuration settings\n\n| Setting | Description | Type | Required? | Default |\n| --- | --- | --- | --- | --- |\n| name | A name for the query. This is used only in the event data sent to New Relic and can be used to query different query results via NRQL. | string | Y | n/a |\n| query | The SQL query to run | string | Y | n/a |\n| type | This field should always be set to `metric` ^ | string | Y | n/a |\n| database | The name of the database to query | string | Y | n/a |\n| provider | The database provider ID (see [Compatibility](#compatibility)) | string | Y | n/a |\n| metricType | The type of metric, either `Gauge`, `Delta` or `Rate` ^^ | string | N | Gauge |\n| queryOptions | Collection of options used in the query ^^^ | object | N | null |\n| eventType | The name of the custom event | string | N | [the database provider ID](#compatibility) |\n| parser | Class of custom result parser to load (must be in the class path) | string | N | null |\n| parserOptions | JSON to pass to the custom parser for configuration | object | N | null\n| deduplicate   | Wether or not to attempt row-level deduplication based on MD5 hash | boolean | N | false |\n| uniqueHistorySize | Number of unique row hashes to keep | integer | N | 10000 |\n| rowBufferSize | uffer size for deduplication hash | integer | N | 5120 |\n\n^ The `inventory` type is no longer supported as this package no longer\nsupports \"Infrastructure mode\".\n\n^^ The `metricType` attribute defines the data type that will be used by the\nagent. This is an optional attribute. The default value is \"Gauge\", which is the\n\"real\" number reported. The other supported values are:\n\n* Gauge: Just the absolute number\n* Delta: Number as compared to the previous number\n* Rate: Calculated Rate\n\nThese values only apply to numeric metrics. All the string/text values are\nconsidered \"attribute metrics\" and will be saved as string attributes on the\nevent.\n\nIn addition, the following guidelines should be followed.\n\n* If possible, return single numbers in the queries where `Delta` or `Rate` will\n  be used\n* Provide \"readable\" names using aliases whenever possible to get better\n  attribute names in the custom events, especially when running functions on SQL\n  (count(), sum(), avg(), etc)\n\n^^^ The following query options are supported.\n\n| Name | Description |\n| --- | --- |\n| initialQuery | Query to run at startup time. The goal is to initialize the columns below for use in query that is parameterized. |\n| queryParameterColumns | Array of column names returned by **BOTH** the `initialQuery` and the main `query`. The last value returned will be used as the parameter for the next query run. The order of the array items matters. |\n\nThe following is an example of a minimal agent instance configuration.\n\n```json\n{\n  \"name\" : \"Stat Activity\",\n  \"provider\" : \"Postgres\",\n  \"query\" : \"select * from pg_stat_activity\",\n  \"type\" : \"metric\",\n  \"database\" : \"test\"\n}\n```\n\nThe following is an example of a full agent instance configuration.\n\n```json\n{\n  \"name\" : \"Stat Activity\",\n  \"provider\" : \"Oracle\",\n  \"query\" : \"SELECT ID, ErrorMessage FROM MyTable WHERE ID \u003e ? ORDER BY ID ASC\",\n  \"type\" : \"metric\",\n  \"database\" : \"test\",\n  \"metricType\": \"Gauge\",\n  \"queryOptions\": {\n    \"initialQuery\": \"select max(id) ID from MyTable\",\n    \"queryParameterColumns\": [\n      \"ID\"\n    ]\n  },\n  \"parser\": \"my.custom.result.parser.class\",\n  \"parserOptions\": {\n    \"ThisJSON\": \"Passed to the Parser\"\n  },\n  \"deduplicate\": true,\n  \"uniqueHistorySize\": 5000,\n  \"rowBufferSize\": 10000\n}\n```\n\n### Helm Values File\n\nFor Kubernetes deployments, a Helm chart is provided to install a deployment\nand the supporting Kubernetes resources required to run nri-db in a cluster.\nAs with most Helm charts, a Helm Values file can be provided to specify the\nHelm values used in the chart. The default set of values are provided in the\n[values.yaml file](./helm/values.yaml).\n\nThe settings underneath the line `# Kubernetes resource settings` are values\nthat can be used to customize various aspects of the actual Kubernetes\nresources created when the chart is installed. These are not documented here\nand in general require a knowledge of Kubernetes to customize.\n\nThe section underneath the line `# nri-db application settings` are the values\nused to customize the `nri-db` application itself. These settings correspond\nto those specified in the\n[integration configuration](#integration-configuration) and the\n[database command file](#database-command-file) and to the\n[encryption password](#setup-an-encryption-password). Refer to the referenced\nsections when customizing the values file.\n\nThe following is an example of a values file with customized settings for the\n`nri-db` application settings.\n\n```yaml\n# ------------------------------------------------------------------------------\n# nri-db application settings\n\nencryptionPassword: \"12345\"\npluginConfig:\n  accountId: \"1\"\n  insertKey: \"NRAK-XXXXXXXXXXXX\"\n  agents:\n  - name: INSTANCE NAME\n    host: HOST\n    port: 12345\n    username: DB USER\n    password: ENCRYPTED PASSWORD\n    inputfile: inputs/input1.json\n  - name: INSTANCE NAME 2\n    host: HOST\n    port: 12345\n    username: DB USER\n    password: ENCRYPTED PASSWORD\n    inputfile: inputs/input2.json\n    sslConnection: true\n    sslTrustStoreLocation: TRUST STORE LOCATION\n    sslTrustStorePassword: ENCRYPTED TRUST STORE PASSWORD\n    static:\n      foo: bar\n      beep: bop\n  inputs:\n  - name: input1.json\n    queries:\n    - name: Stat Activity\n      provider: Postgres\n      query: select * from pg_stat_activity\n      type: metric\n      database: test\n  - name: input2.json\n    queries:\n    - name: Stat Activity\n      provider: Oracle\n      query: 'SELECT ID, ErrorMessage FROM MyTable WHERE ID \u003e ? ORDER BY ID ASC'\n      type: metric\n      database: test\n      metricType: Gauge\n      queryOptions:\n        initialQuery: select max(id) ID from MyTable\n        queryParameterColumns:\n          - ID\n      parser: my.custom.result.parser.class\n      parserOptions:\n        ThisJSON: Passed to the Parser\n      deduplicate: true\n      uniqueHistorySize: 5000\n      rowBufferSize: 10000\n```\n\n### Using Multiple Drivers With The `Dockerfile`\n\nIf databases from multiple database vendors need to be accessed from within a\nsingle Docker container, manual customization of the\n[`Dockerfile`](./Dockerfile) is necessary.\n\nFor each database vendor, the appropriate driver must be added to the\n`/app/nri-db/lib` directory and the path to the driver JAR file must be appended\nto the `CLASSPATH` environment variable. The following examples shows how to\ncreate an image using 2 different database drivers.\n\n```Dockerfile\nFROM openjdk:11\n\n# No need for these since we are manually modifying anyway\n#ARG db_driver_path\n#ARG db_driver_jar\n\nRUN mkdir /app\n\nADD . /app/nri-db\nADD ./.nridbrc /root\nADD /path/to/dbdriver1.jar /app/nri-db/lib\nADD /path/to/a/different/dbdriver2.jar /app/nri-db/lib\n\nRUN chmod 0400 /root/.nridbrc\n\nENV CLASSPATH=/app/nri-db/lib/dbdriver1.jar:/app/nri-db/lib/dbdriver2.jar\n\nWORKDIR /app/nri-db\n\nCMD [\"./bin/nri-db\"]\n```\n\n### Running the Integration On Host\n\nFor On-host deployments, the `nri-db` application process must be running at\nall times. The easiest way to ensure this on Linux based distributions is to\ninstall one of the operating system [startup services](#linux-startup-services).\nOn Windows, the best option is probably to use Docker. Another option is to use\na tool like [NSSM](https://nssm.cc/) to create a Windows service to execute the\nservice [using a shell script](#windows)\n\n#### Linux Startup Services\n\n##### Systemd\n\nThe file [`install/nri-db.service`](./install/nri-db.service) contains a\n[Systemd](https://en.wikipedia.org/wiki/Systemd) service unit definition for\nrunning the `nri-db` application process. To install this service unit, perform\nthe following steps.\n\n1. Edit the `install/nri-db.service` file as follows\n\n   1. Update the value for the `WorkingDirectory` property from `@installdir@`\n      to the absolute path to the  `nri-db` installation directory. For example,\n\n      `WorkingDirectory=/usr/local/software/nri-db`\n\n   1. Update the value for the `CLASSPATH` in the `Environment` property from\n      `@dbdriverpath@` to the absolute path of the database driver. For example,\n\n      `Environment=\"JAVA_OPTS=-Xmx512m CLASSPATH=/usr/local/db2/db2jcc.jar\"`\n\n   1. Optionally update the value for the `JAVA_OPTS` in the `Environment`\n      property with any additional Java options.\n\n1. Move the updated `install/nri-db.service` file into `/etc/systemd/system`\n   For example,\n\n   `sudo mv ./install/nri-db.service /etc/systemd/system`\n\n1. Run the following commands\n\n   ```sh\n   sudo systemctl daemon-reload\n   sudo systemctl start nri-db.service\n   sudo systemctl enable nri-db.service\n   ```\n\n##### Upstart\n\nThe file [`install/nri-db.conf`](./install/nri-db.conf) contains an\n[Upstart](http://upstart.ubuntu.com/cookbook/) job configuration file for\nrunning the `nri-db` application process. To install this job configuration,\nperform the following steps.\n\n1. Edit the `install/nri-db.conf` file as follows:\n\n   1. Update the value for the `chdir` stanza from `@installdir@`\n      to the absolute path to the  `nri-db` installation directory. For example,\n\n      `chdir /usr/local/software/nri-db`\n\n   1. Update the value for the `CLASSPATH` in the first `env` stanza from\n      `@dbdriverpath@` to the absolute path of the database driver. For example,\n\n      `env CLASSPATH=/usr/local/db2/db2jcc.jar`\n\n   1. Optionally update the value for the `JAVA_OPTS` in the second `env` stanza\n      property with any additional Java options.\n\n1. Move the updated `install/nri-db.conf` file into `/etc/init`\n   For example,\n\n   `sudo mv ./install/nri-db.conf /etc/init`\n\n1. Run the following commands\n\n   ```sh\n   sudo initctl reload-configuration\n   sudo initctl start nri-db\n   ```\n\n#### Manual Execution\n\nThe integration can also be run manually with a few simple commands.\n\n#### Linux\n\nTo run the integration on Linux, execute the following commands.\n\n```sh\nexport CLASSPATH=/path/to/dbdriver.jar:$CLASSPATH\ncd /path/to/nri-db-installdir\n./bin/nri-db\n```\n\nAlternately copy the following shell script into a file and make the file\nexecutable. Then the integration can be run at anytime with a single command.\n\n```sh\n#!/bin/bash\n# Run nri-db\n\nexport CLASSPATH=/path/to/dbdriver.jar:$CLASSPATH\n\ncd /path/to/nri-db-installdir\n\n./bin/nri-db\n```\n\n#### Windows\n\nTo run the integration on Microsoft Windows, execute the following commands.\n\n```bat\nset CLASSPATH=C:\\path\\to\\dbdriver.jar;%CLASSPATH%\ncd C:\\path\\to\\nri-db-installdir\n.\\bin\\nri-db\n```\n\nAlternately copy the following shell script into a file and make the file\nexecutable. Then the integration can be run at anytime with a single command.\n\n```bat\n@rem Run nri-db\n\nset CLASSPATH=C:\\path\\to\\dbdriver.jar;%CLASSPATH%\n\ncd C:\\path\\to\\nri-db-installdir\n\n.\\bin\\nri-db\n```\n\n## Building\n\nThis project uses [gradle](https://gradle.org/) with a generated\n[gradle wrapper](./gradlew). To run a build, execute the following command\nfrom the root of the project.\n\n```sh\n./gradlew clean build\n```\n\n## Testing\n\nThis project uses [JUnit 4](https://junit.org/junit4/) for testing. To run all\ntests, execute the following command from the root of the project.\n\n```sh\n./gradlew cleanTest test\n```\n\n### Integration Testing\n\nThe following sections document how to create local Docker instances running\ndifferent databases that can be used for integration testing.\n\n#### MySQL\n\n```sh\ndocker run --rm --name mysql -e MYSQL_ROOT_PASSWORD=root -d -p 3306:3306 mysql:latest\n```\n\n#### Postgres\n\n```sh\ndocker run --name postgres -e POSTGRES_PASSWORD=root -d --rm -p 5432:5432 postgres\n```\n\n#### DB/2\n\n```sh\ndocker run -itd --name db2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=root -e DBNAME=testdb ibmcom/db2\n```\n\n## Troubleshooting\n\n### Logging\n\nThis project uses [Java Util Logging](https://docs.oracle.com/javase/8/docs/api/index.html?java/util/logging/package-summary.html)\nfor generating logs. To generate debug logs, uncomment the following line in\nthe file [logging.properties](./config/logging.properties) and restart the\nintegration.\n\n```properties\n...\n#com.newrelic.infra.db.level = FINEST\n```\n\nLogs will be output to the console and to the [logs](./logs) directory.\n\n## Support\n\nNew Relic has open-sourced this project. This project is provided AS-IS WITHOUT\nWARRANTY OR DEDICATED SUPPORT. Issues and contributions should be reported to\nthe project here on GitHub.\n\nWe encourage you to bring your experiences and questions to the\n[Explorers Hub](https://discuss.newrelic.com) where our community members\ncollaborate on solutions and new ideas.\n\n## Contributing\n\nWe encourage your contributions to improve the New Relic Infrastructure Database\nIntegration! Keep in mind when you submit your pull request, you'll need to sign\nthe CLA via the click-through using CLA-Assistant. You only have to sign the CLA\none time per project.\n\nIf you have any questions, or to execute our corporate CLA, required if your\ncontribution is on behalf of a company,  please drop us an email at\nopensource@newrelic.com.\n\n## License\n\nThe New Relic Infrastructure Database Integration is licensed under the\n[Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License.\n\nThe New Relic Infrastructure Database Integration also uses source code from\nthird-party libraries. You can find full details on which libraries are used\nand the terms under which they are licensed in the third-party notices document.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewrelic-experimental%2Fnri-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnewrelic-experimental%2Fnri-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewrelic-experimental%2Fnri-db/lists"}