Skip to content
Snippets Groups Projects

Supervisor-vms: A Process Control System for OpenVMS

Supervisor-vms is a tools that allows to monitor and control a number of processes on OpenVMS systems.

Use process termination mailbox and AST. No CPU usage if no event occurs.

It was inspired by supervisor

Read the supervisor documentation is probably a good idea. Many of configuration parameters are the same.

Requirements

  1. Python 3.10 (VSI version)
  2. ovms module

Probably better to use the LD image which contains all the necessary modules.

Components

All logicals are defined in table SUPERVISORD_TABLE

supervisord.py

The server piece of supervisor is named supervisord.
It is responsible for starting processes (programs) at its own invocation, responding to commands from clients, restarting crashed or exited processeses

The server process uses a configuration file.

supervisorctl.py

The command-line client piece of the supervisor is named supervisorctl.

It provides a shell-like interface to the features provided by supervisord.

From supervisorctl, a user can connect to the supervisord process, get status on the processes controlled by, stop and start processes of, and get lists of running processes (programs).

The command-line client talks to the server across a mailbox (SUPERVISORD_CMD logical)

Running supervisord

Required privileges: ALTPRI, SYSNAM, PRMMBX, IMPERSONATE, SETPRV, WORLD

First create a supervisord.conf, you can use the template supervisord.conf_template as an example.

Then start supervisord, probably in nodaemon mode initially.

Finally, if all seem correct, shutdown it and restart it on daemon mode.

Running processes doesn't need to be stopped.
When restarting supervisord find the necessary informations for running processes using the logical name table SUPERVISORD_TABLE.

supervisord Command-Line Options

-c FILE, --configuration=FILE
The path to a **supervisord** configuration file. Unix syntax should be used
-n, --nodaemon
Run supervisord in the foreground
-p pwd, --password=pwd
Optional password, used with supervisorctl
-h, --help
Show supervisord command help

Running supervisorctl

Required privilege: PRMMBX, SYSNAM

supervisorctl Command-Line Options

-c FILE, --configuration=FILE
The path to a supervisord configuration file. Unix syntax should be used
-p pwd, --password=pwd
Optional password, used with supervisord
-h, --help
Show supervisord command help

supervisorctl Actions

help
Print a list of available actions
help <action>
Print help for <action>
start <name>
Start a process
start <name> <name>
Start multiple processes
start all
Start all processes
status
Get all process status info.
status <name>
Get status on a single process by name
status <name> <name>
Get status on multiple named processes
stop <name>
Stop a process
stop <name> <name>
Stop multiple processes
stop all
Stop all processes
shutdown
Stop supervisord, don't stop processes

Configuration file

The Supervisor configuration file is conventionally named supervisord.conf.
It is used by both supervisord and supervisorctl.

File Format

supervisord.conf is a Windows-INI-style (Python ConfigParser) file.
It has sections (each denoted by a [header]) and key / value pairs within the sections.
The sections and their allowable values are described below.

[supervisord] Section Settings

All pathname use a OpenVMS syntax.

[supervisord] Section Values

nodaemon
If true, supervisord will start in the foreground instead of daemonizing
Default: false
user
OpenVMS account to run supervisord as a detach process (daemon mode).
Default: system
command
Command procedure which run supervisord.
Default: None, should be specified, can be build from the template supervisord.com_template
stdout_file
stdout of supervisord process.
Default: NLA0:
logfile
The path to the activity log of the supervisord process
Default: supervisord.log

[program:x] Section Settings

The configuration file must contain one or more program sections in order for supervisord to know which programs it should start and control.
The header value is composite value.
It is the word “program”, followed directly by a colon, then the program name.
Read the $creprc documentation may be useful.

[program:x] Section Values

image
Name of the image to be activated in the newly created process.
Default: SYS$SYSTEM:LOGINOUT.EXE
command
Equivalence name to be associated with the logical name SYS$INPUT in the logical name table of the created process.
Default: NLA0:
process_name
Process name to be assigned to the created process.
Default: %(program_name)s
user
Instruct supervisord to use this OpenVMS user account as the account which runs the program.
Default: None, mandatory
autostart
If true, this program will start automatically when supervisord is started.
Default: true
stdout_file
Equivalence name to be associated with the logical name SYS$OUTPUT in the logical name table of the created process.
Default: NLA0:
stderr_file
Equivalence name to be associated with the logical name SYS$ERROR in the logical name table of the created process.
Default NLA0:
startsecs
The total number of seconds which the program needs to stay running after a startup to consider the start successful (moving the process from the STARTING state to the RUNNING state).
Set to 0 to indicate that the program needn’t stay running for any particular amount of time.
Default: 10
startretries
The number of serial failure attempts that supervisord will allow when attempting to start the program before giving up and putting the process into an FATAL state<.
Default: 3
stopwaitsecs
The number of seconds to wait for the program after a $FORCEX has been sent. If this number of seconds elapses before supervisord will attempt to kill it with a $DELPRC.
Default: 10
kt_limit
Sets the limit of the number of kernel threads that can be created in the process.
Default: 0
baspri
Base priority to be assigned to the created process.
Default: 4
nouaf
Create the detach process with flag PRC$M_NOUAF set.
Read OpenVMS documentation for more information.
Default: false
quotas
Process quotas to be established for the created process. View the template configuration for format and example.
privileges
Process privileges to be established for the created process. View the template configuration for format and example.
autorestart
Specifies if supervisord should automatically restart a process if it exits when it is in the RUNNING state.
May be one of false, unexpected, or true.
If false, the process will not be autorestarted.
If unexpected, the process will be restarted when the program exits with an exit code that is not one of the exit codes associated with this process’ configuration (see exitcodes).
If true, the process will be unconditionally restarted when it exits, without regard to its exit code.
Default: unexpected
exitcodes
The list of “expected” exit codes for this program used with autorestart. If the autorestart parameter is set to unexpected, and the process exits in any other way than as a result of a supervisor stop request, supervisord will restart the process if it exits with an exit code that is not defined in this list.
Default: 1