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
- User Groups:
- Windows
- Group Memeberships:
ORA_DBA
- Group Memeberships:
# Event Subscriptions
myrmex/ora-listener/status/oracle-home/listener/down
# Events
myrmex/ora-listener/oracle-home/listener/restartedset to 1 when listener was successfully started- Dimensions
oracle-homethe path to listenerORACLE_HOMElistenerthe listener name
- Dimensions
myrmex/ora-listener/oracle-home/listener/restart/failedset to 1 when listener failed to restart- Dimensions
oracle-homethe path to listenerORACLE_HOMElistenerthe listener name
- Dimensions
myrmex/plugins/error/plugin/msgset to error message on plugin execution failure- Dimensions
pluginthe name of the plugin that failed
- Dimensions
# Configuration
Plugin is configured with a yaml file:
tns_admin: optional path to listenerTNS_ADMIN. Defaults to$ORACLE_HOME/network/adminwhere$ORACLE_HOMEis read from incomingmyrmex/ora-listener/status/oracle-home/listener/downeventbecome: optional, runslsnrctlas specified user. The agentuidmust have password less sudo access tolsnrctlforbecomeuser. Use this setting if the agent is not running as useroracle, otherwise the listener will be started successfully but thetnslsnrprocess will be owned by the agentuid. Users will still be able to connect to the database as normal, but theoracleuser 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/sudoerslike below when usingbecome(replace$ORACLE_HOMEwith the actual path):polaris ALL=(oracle) NOPASSWD:SETENV: $ORACLE_HOME/bin/lsnrctltimeout: execution timeout in duration format (opens new window). Defaults to20ssource: the value that will appear as the source of metrics generated by this configuration. defaults to plugin hostnamelisteners: 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