{"id":37126859,"url":"https://github.com/toni-moreno/oracle_collector","last_synced_at":"2026-01-14T14:42:30.186Z","repository":{"id":62166582,"uuid":"558469828","full_name":"toni-moreno/oracle_collector","owner":"toni-moreno","description":"Tool for gather metrics from any oracle instance installed in any Server as execd plugin for telegraf","archived":false,"fork":false,"pushed_at":"2023-04-12T13:01:04.000Z","size":689,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-21T17:03:43.098Z","etag":null,"topics":["discovery","metrics","metrics-gathering","oracle","telegraf","telegraf-plugin"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toni-moreno.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-27T15:56:58.000Z","updated_at":"2024-01-29T06:19:51.000Z","dependencies_parsed_at":"2024-06-21T15:40:53.390Z","dependency_job_id":"ee1ab17b-0fcb-48f7-8488-31b3718d8a79","html_url":"https://github.com/toni-moreno/oracle_collector","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/toni-moreno/oracle_collector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toni-moreno%2Foracle_collector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toni-moreno%2Foracle_collector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toni-moreno%2Foracle_collector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toni-moreno%2Foracle_collector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toni-moreno","download_url":"https://codeload.github.com/toni-moreno/oracle_collector/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toni-moreno%2Foracle_collector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28423972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["discovery","metrics","metrics-gathering","oracle","telegraf","telegraf-plugin"],"created_at":"2026-01-14T14:42:29.668Z","updated_at":"2026-01-14T14:42:30.178Z","avatar_url":"https://github.com/toni-moreno.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Oracle Collector\n\nOracle Collector is an Open Source tool to get oracle metrics from any oracle instance running in any compatible ( Linux ) server, it runs as an execd plugin for telegraf\n\n\n## Install from precompiled packages\n\nAll releases here.\n\n[releases](https://github.com/toni-moreno/oracle_collector/releases)\n\n## Building and Run from master\n\nIf you want to build a package yourself, or contribute. Here is a guide for how to do that.\n\n### Dependencies\n\n- Go 1.19\n\n### Get Code\n\n```bash\ngo get -d github.com/toni-moreno/oracle_collector/...\n```\n\n### Building the backend\n\n\n```bash\ncd $GOPATH/src/github.com/toni-moreno/oracle_collector\ngo run build.go build           \n```\n\n### Creating minimal package tar.gz\n\nAfter building frontend and backend you will do\n\n```bash\ngo run build.go pkg-min-tar\n```\n\n### Creating  and running docker image\n\n\n```bash\nmake -f Makefile.docker\ndocker run tonimoreno/oracle_collector:latest -version\ndocker run  tonimoreno/oracle_collector:latest -h\ndocker run  -p 4090:4090 -v /mylocal/conf:/opt/oracle_collector/conf -v /mylocal/log:/opt/oracle_collector/log tonimoreno/oracle_collector:latest [options]\n```\n\n\n### Recompile backend on source change (only for developers)\n\nTo rebuild on source change (requires that you executed godep restore)\n```bash\ngo install github.com/unknwon/bra@latest\nbra run  \n```\n\n## Running first time ( outside telegraf )\n\nYou will need to set up oracle client environment variables `LD_LIBRARY_PATH` and `ORACLE_HOME` to run the collector.\n\n```bash\nexport LD_LIBRARY_PATH=/opt/oracle/product/21c/dbhomeXE/lib/\nexport ORACLE_HOME=/opt/oracle/product/21c/dbhomeXE\n```\n\n### Create a connection user.\n\nYou will need a monitoring user with proper grants to query all needed info.\n\nUse this for Oracle \u003e= 12.1\n\n`sqlplus \"/ as sysdba\" @./conf/recreate_user_C##MONIT.sql`\n\nUse this for Oracle \u003c 12.1\n\n`sqlplus \"/ as sysdba\" @./conf/recreate_user_C##MONIT_legacy.sql`\n\n\nTo execute without any configuration you need a minimal oracle_collector.toml file on the conf directory.\n\n```bash\ncp conf/sample.oracle_collector.toml conf/oracle_collector.toml\n./bin/oracle_collector [options]\n```\n\n## Running as Telegraf plugin.\n\nOracle collector will run as telegraf execd plugin you can use the sample in the conf dir. Telegraf will be executed as root user, so you will need to setup oracle client environment variables in the execd config file.\n\n```bash\ncp conf/telegraf-execd-example.conf /etc/telegraf.d/oracle_collector.conf\nsystemctl restart telegraf.service\n```\n\n\n## Basic Usage\n\n```bash\n$ ./bin/oracle_collector -h\nUsage of ./bin/oracle_collector:\n   -config: config file\n   -logdir: log directory where to create all log files\n  -pidfile: path to pid file \n  -version: display the version\n```\n\n\n## Gathered Info.\n\nOracle collector gathers 2 kind of different informations.\n\n1. Oracle Monitored/Discovered instances \n2. Internat stats.\n\n\n## Oracle Monitored Measurements/Metrics\n\nThe agent is capable to get metrics organized and sent as ILP ( InfluDB Line Protocol) measurements. It takes 2 non configurable measurements. And a lot of other configurable measurements in the `metric` section of the config file`[[oracle-monitor.mgroup.metric]]`.\n\n### Non configurable measurements.\n\nThese measurements will be sent always even if any metric `[[oracle-monitor.mgroup.metric]]` and any metric group `[[oracle-monitor.mgroup]]` exiting in the config file.\n\n**oracle_status**\n\nGet info from [v$instance](https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/V-INSTANCE.html) and [v$database] and [v$pdbs]\n\n\n```sql\n  select\n    INSTANCE_NUMBER,\n    INSTANCE_NAME,\n    HOST_NAME,\n    -- for version \u003cv18c (12.2.0.2)\n    VERSION\n    -- only for verion \u003e v18c (12.2.0.2)\n    VERSION_FULL AS VERSION,\n    STARTUP_TIME,\n    FLOOR((SYSDATE - STARTUP_TIME) * 60 * 60 * 24) as UPTIME,\n    STATUS,\n    DATABASE_STATUS,\n    INSTANCE_ROLE,\n    ACTIVE_STATE,\n    BLOCKED,\n    SHUTDOWN_PENDING,\n    ARCHIVER\n  from V$INSTANCE\n```\nAnd\n\n```sql\n  select\n    DBID,\n    NAME,\n    CREATED,\n    DB_UNIQUE_NAME,\n    OPEN_MODE,\n    DATABASE_ROLE,\n    FORCE_LOGGING,\n    LOG_MODE\n  from v$database`\n```\n\n\n\n* **tags**\n  * all `extra_labels` from the `[oracle-discovery]` config section\n  * all `[global_tags]` configured in the parent telegraf config\n  * *db:* name o the DB\n  * *db_unique_name:* de unique name for the DB\n  * *instance:* name of the instance\n  * *instance_role:* Indicates whether the instance is an active instance or an inactive secondary instance.\n\nHow much info it sends to the backend depens on the `oracle_status_extended_info` flag on the  `[oracle-discovery]` section:\n\n* **fields**\n  * From system process\n    * *proc_ok (boolean)*:  True when process (proc_pid) is ok, false first time when detected is down.\n    * *proc_pid (integer)*: PID from the Discovered PMON process\n  * From `v$instance` view:\n    * *inst_number (integer)*:\n    * *inst_status (string)*:\n    * *inst_uptime_sec (integer)*: \n    * *inst_version (string)*:\n    * *inst_active_state (string)*: (extended only)\n    * *inst_startup_time: (string)*: (extended only)\n    * *inst_bloqued (string)*: (extended only)\n    * *inst_db_status (status)*: (extended only)\n    * *inst_shutdown_pending (string)*: (extended only)\n    * *inst_archiver (string)*: (extended only)\n  * from `v$database` view:\n    * *db_role (string)*:\n    * *db_open_mode (string)*:\n    * *db_created (string)*: (extended only)\n    * *db_log_mode (string)*: (extended only)\n    * *db_force_logging (string)*: (extended only)\n  * from `v$pdbs` view:\n    * *pdbs_total (integer)*:\n    * *pdbs_active (integer)*:\n\n**oracle_pdb_status**\n\nGet info from [v$pdbs](https://docs.oracle.com/database/121/REFRN/GUID-A399F608-36C8-4DF0-9A13-CEE25637653E.htm#REFRN30652) for Oracle version \u003e 12.1 each \"discovery period\" with the following query.\n\nfor Oracle \u003c 12.1.0.2\n\n```sql \nselect \n  CON_ID,NAME,OPEN_MODE,RESTRICTED,TOTAL_SIZE,\nfrom v$pdbs\n```\n\nfor Oracle \u003e= 12.1.0.2\n\n```sql\nselect \n  CON_ID,NAME,OPEN_MODE,RESTRICTED,RECOVERY_STATUS,TOTAL_SIZE,BLOCK_SIZE\nfrom v$pdbs\n```\n\n* **tags**\n  * all `extra_labels` from the `[oracle-discovery]` config section\n  * all `[global_tags]` configured in the parent telegraf config\n  * *db:* name o the DB\n  * *db_unique_name:* de unique name for the DB\n  * *instance:* name of the instance\n  * *instance_role:* Indicates whether the instance is an active instance or an inactive secondary instance.\n  * *pdb_name:* the name of the pdb\n\n* **fields**\n  * *open_mode (string)*\n  * *restricted (string)*\n  * *recovery_status (string)*\n  * *total_size (integer)*\n  * *block_size (integer)*\n\n## Configurable measurements.\n\nOn each `[oracle-monitor.mgroup.metric]` section you can define measurment name,tags,and fiends as follows. \n\n```toml\n[[oracle-monitor.mgroup.metric]]\n# Resource\nid = \"resource_query_XXXX\"\ncontext = \"resource\"\nlabels = [ \"resource_name\" ]\nmetrics_desc = { current_utilization= \"Generic counter metric from v$resource_limit view in Oracle (current value).\", limit_value=\"Generic counter metric from v$resource_limit view in Oracle (UNLIMITED: -1).\" }\nmetrics_type = { current_utilization='integer',limit_value='integer',used_pct='float'}\nrequest='''\nSELECT \n    resource_name,\n    current_utilization,\n    CASE WHEN TRIM(limit_value) LIKE 'UNLIMITED' THEN '-1' ELSE TRIM(limit_value) END as limit_value,\n    CASE \n        WHEN TRIM(limit_value) LIKE 'UNLIMITED' THEN 0 \n        WHEN TRIM(limit_value) LIKE '0' THEN 0\n        ELSE ROUND(((current_utilization*100)/limit_value),3)\n    END as USED_PCT\nFROM v$resource_limit\n'''\n```\n\n- **measurement_name:** will be set with the value in the `context` struct field\n- **tags:**  will be set with all common tags ,  `extra_labels` from the `[oracle-discovery]` config section and  `[global_tags]` configured in the parent telegraf config appended by the `labels` struct list. ( each label should be a column in the response query)\n- **fields:** will be set and type trasnformed if needed by the definition in the in `metrics_type` struct field \n\nTags and fields will taken from the resulted query in field `request`\n\nIn the above example:\n\n**measurement:** \"resource\"\n* **tags**\n  * all `extra_labels` from the `[oracle-discovery]` config section\n  * all `[global_tags]` configured in the parent telegraf config\n  * resource_name\n* **fields**\n  * current_utilization (integer):\n  * limit_value (integer)\n  * used_pct(float)\n\n\n## Internal Statistics.\n\nOracle collector gathers also some internal processes informattion. The name of its measurements depens on the `measurement_prefix` parameter from the `[self-monitor]` config section.\n\nThese are the collected measurements:\n\n**\u003cprefix\u003eruntime_gvm_stats**\n\nGathers information about the Go Virtual Machine runtime stats. ( Garbage collection, goroutines and memory) Refer to [MemStats](https://pkg.go.dev/runtime#MemStats) to get detailed info on memory stats.\n\n* **tags**\n  * all `extra_labels` from the `[self-monitor]` config\n  * all `[global_tags]` configured in the parent telegraf config\n* **fields**\n  * *runtime_goroutines*: returns the number of goroutines that currently exist.\n  * *mem.mallocs:* is the cumulative count of heap objects allocated. \n  * *mem.alloc:*  is bytes of allocated heap objects.\n  * *mem.frees:*  is the cumulative count of heap objects freed.\n  * *mem.sys:* is the total bytes of memory obtained from the OS.\n  * *mem.heap_alloc_bytes:*  is bytes of allocated heap objects.\n  * *mem.heap_sys_bytes:* HeapSys is bytes of heap memory obtained from the OS.\n  * *mem.heap_idle_bytes:* HeapIdle is bytes in idle (unused) spans.\n  * *mem.heap_in_use_bytes:* HeapInuse is bytes in in-use spans.\n  * *mem.heap_released_bytes:* HeapReleased is bytes of physical memory returned to the OS.\n  * *mem.heap_objects:* HeapObjects is the number of allocated heap objects.\n  * *mem.stack_in_use_bytes:* is bytes in stack spans.\n  * *mem.m_span_in_use_bytes:* MSpanInuse is bytes of allocated mspan structures.\n  * *mem.m_cache_in_use_bytes:*  MCacheInuse is bytes of allocated mcache structures.\n  * *gc.total_pause_ns:* is the cumulative nanoseconds in GC stop-the-world pauses since the program started.\n  * *gc.pause_per_interval:* pause on each gathering `request_period` interval.\n  * *gc.pause_per_second:* pause acummulated per second.\n  * *gc.gc_per_inteval:*  number of gc's per `request_period`interval.\n  * *gc.gc_per_second:*  number if gc's per second.\n\n\n**\u003cprefix\u003ediscover_stats**\n\nGathers information about the oracle instance discovery process.\n\n* **tags**\n  * all `extra_labels` from the `[self-monitor]` config\n  * all `[global_tags]` configured in the parent telegraf config\n* **fields**\n  * *discovered_all/all*: (discovered_all) number of discovered processes with the `oracle_discovery_sid_regex` process pattern.\n  * *discovered_new/new*: (discovered_new) number of new instances since last discovery process that is not connected\n  * *discovred_current/current*: (discovered_current) number of currently discovered and also connected oracle instances\n  * *undiscovered*: number of instances which has been undiscovered since the last discovery process\n  * *connect_errors*: number of oracle instances with errors in the connecting process.\n  * *connect_errors_skipped*: number of oracle instances with errors  but skipped from the error list by the regexp rules in the `oracle_discovery_skip_errors_regex` parameter.\n  * *undiscovered_sid_names: list of SID names which has beed undetected since the last discovery process.  ( separeted by \":\")\n  * *discovered_sid_names* list of SID names detected and currently trying to connect (maybe with errors or not) (separated by \":).\n  * *errconnect_sid_names* list of SID names with connetion errors (separated by \":\")\n  * *errconnect_skipped_sid_names* list of SID with connection errors but skipped from the error list by the regexp rules in the `oracle_discovery_skip_errors_regex` parameter \n\n\n**\u003cprefix\u003ecollect_stats**\n\nThis measurement is needed to know how long collector takes on each query on each database and how many results (metrics) are we gathering in each query.\n\n* **tags**\n  * all `extra_labels` from the `[self-monitor]` config\n  * all `[global_tags]` configured in the parent telegraf config\n  * *db:* the database where collecting metrics\n  * *db_unique_name:* the unique name for the database\n  * *instance:* the instance where connected\n  * *instance_role:* the role of the instance.\n  * *metric_group:* the name of the metric group where is configured \n  * *metric_context:* the context of the metric group where is configured ( `context` parameter)\n  * *metric_id:* the uniq id of the metric ( `id` parameter or `context`if id not configured)\n* **fields**\n  * *num_metrics*: num of collected metrics from this query metric.\n  * *duration_us*: duration of the query in microseconds  \n\n\n**\u003cprefix\u003esql_driver_stats**\n\nGather information on each collector to  each DB instance connection with these [sql generic stats](https://pkg.go.dev/database/sql#DBStats)\n\n* **tags**\n  * all `extra_labels` from the `[self-monitor]` config\n  * all `[global_tags]` configured in the parent telegraf config\n  * *instance*: the instance name \n* **fields**\n  * *idle_conn*: The number of idle connections.\n  * *inuse_conn*: The number of connections currently in use.\n  * *max_idle_closed*: The total number of connections closed due to SetMaxIdleConns.\n  * *max_idle_time_closed*: The total number of connections closed due to SetConnMaxIdleTime.\n  * *max_open_connections*:\n  * *open_connections*: The number of established connections both in use and idle.\n  * *wait_count*: The total number of connections waited for.\n  * *wait_duration_ms*: The total time blocked waiting for a new connection.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoni-moreno%2Foracle_collector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoni-moreno%2Foracle_collector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoni-moreno%2Foracle_collector/lists"}