Oracle DB listener autostart

  • Last Updated 3/31/2023, 12:34:01 PM UTC
  • About 3 min read

Plugin info

name: ora-listener-start

Starts oracle database listeners when down and emits events for the start process result

# Prerequisites

  • Linux
    • User Groups: oinstall, dba
  • Windows
    • Group Memeberships: ORA_DBA

# Event Subscriptions

  • myrmex/ora-listener/status/oracle-home/listener/down

# Events

  • myrmex/ora-listener/oracle-home/listener/restarted set to 1 when listener was successfully started
    • Dimensions
      • oracle-home the path to listener ORACLE_HOME
      • listener the listener name
  • myrmex/ora-listener/oracle-home/listener/restart/failed set to 1 when listener failed to restart
    • Dimensions
      • oracle-home the path to listener ORACLE_HOME
      • listener the listener name
  • myrmex/plugins/error/plugin/msg set to error message on plugin execution failure
    • Dimensions
      • plugin the name of the plugin that failed

# Configuration

Plugin is configured with a yaml file:

  • tns_admin: optional path to listener TNS_ADMIN. Defaults to $ORACLE_HOME/network/admin where $ORACLE_HOME is read from incoming myrmex/ora-listener/status/oracle-home/listener/down event

  • become: optional, runs lsnrctl as specified user. The agent uid must have password less sudo access to lsnrctl for become user. Use this setting if the agent is not running as user oracle, otherwise the listener will be started successfully but the tnslsnr process will be owned by the agent uid. Users will still be able to connect to the database as normal, but the oracle user will not have permissions to control the listener (TNS-01190: The user is not authorized to execute the requested listener command). Add an entry in /etc/sudoers like below when using become (replace $ORACLE_HOME with the actual path):

    polaris ALL=(oracle)    NOPASSWD:SETENV: $ORACLE_HOME/bin/lsnrctl
    
  • timeout: execution timeout in duration format (opens new window). Defaults to 20s

  • source: the value that will appear as the source of metrics generated by this configuration. defaults to plugin hostname

  • listeners: list of listener names we are allowed to start

# Example Configuration

# path to tns admin directory (optional)
tns_admin: /u01/app/12.2.0.1/grid/network/admin
# the list of listeners we are allowed to start
listeners:
  - LISTENER

# Validate Configuration

ora-listener-start  --run-conf /path/to/config/file.yaml --validate

# Testing

Run the plugin from the command line to start one or more listeners

ora-listener-start --run-conf /path/to/config/file.yaml --run-events/path/to/listener/down/events.json

# Example test event file

[
    {
        "namespace": [
            {
                "value": "myrmex"
            },
            {
                "value": "ora-listener"
            },
            {
                "value": "status"
            },
            {
                "name": "oracle-home",
                "value": "/u01/app/12.2.0.1/grid"
            },
            {
                "name": "listener",
                "value": "LISTENER"
            },
            {
                "value": "down"
            }
        ],
        "timestamp": "2019-05-10T18:25:43.511Z",
        "data": 1
    }
]

# List events emmited by this plugin

ora-listener-start --events
Last Updated: 3/31/2023, 12:34:01 PM