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/restarted
set to 1 when listener was successfully started- Dimensions
oracle-home
the path to listenerORACLE_HOME
listener
the listener name
- Dimensions
myrmex/ora-listener/oracle-home/listener/restart/failed
set to 1 when listener failed to restart- Dimensions
oracle-home
the path to listenerORACLE_HOME
listener
the listener name
- Dimensions
myrmex/plugins/error/plugin/msg
set to error message on plugin execution failure- Dimensions
plugin
the 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/admin
where$ORACLE_HOME
is read from incomingmyrmex/ora-listener/status/oracle-home/listener/down
eventbecome
: optional, runslsnrctl
as specified user. The agentuid
must have password less sudo access tolsnrctl
forbecome
user. Use this setting if the agent is not running as useroracle
, otherwise the listener will be started successfully but thetnslsnr
process will be owned by the agentuid
. Users will still be able to connect to the database as normal, but theoracle
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 usingbecome
(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 to20s
source
: 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