Table of Contents
View and manipulate maintenance periods.
Usage
s9s maintenance {command} {options}
Command
Name, shorthand | Description |
---|---|
−−create |
Creates a new maintenance period. |
−−current |
Prints the active maintenance for a cluster or for a host. Prints nothing if no maintenance period is active. |
−−list , -L |
Lists the registered maintenance period. See Maintenance List. |
−−delete |
Deletes an existing maintenance period. The maintenance periods are identified by their UUID strings. The UUID strings by default, are shown in an abbreviated format. The full-length UUID strings will be shown when the command line option is provided. Deleting a maintenance period is also possible by providing only the first few characters of the UUID when these first characters are unique and enough to identify the maintenance period. |
−−next |
Prints information about the next maintenance period for a cluster or host. Prints nothing if no maintenance is registered to be started in the future. |
Options
Name, shorthand | Description |
---|---|
−−begin=DATETIME |
A string representation of the date and time when the maintenance period will start. |
−−cluster-id=ID |
The cluster for cluster maintenance. |
−−end=DATETIME |
A string representation of the date and time when the maintenance period will end. |
−−full-uuid |
Print the full UUID. |
−−nodes=NODELIST |
The nodes for the node maintenance. See Node List. |
−−reason=STRING |
The reason for the maintenance. |
−−start=DATETIME |
A string representation of the date and time when the maintenance period will start. This option is deprecated, please use the --begin option instead. |
−−uuid=UUID |
The UUID to identify the maintenance period. |
Maintenance List
Using the --list
and --long
command-line options a detailed list of the registered maintenance periods can be printed:
$ s9s maintenance --list --long
ST UUID OWNER GROUP START END HOST/CLUSTER REASON
Ah a7e037a system admins 11:21:24 11:41:24 192.168.1.113 Rolling restart.
Total: 1
The list contains the following fields:
Field | Description |
---|---|
ST | The short status information, where at the first character position A stands for ‘active’ and - stands for ‘inactive’. In the second character position h stands for ‘host-related maintenance’ and c stands for ‘cluster-related maintenance’. |
UUID | The unique string that identifies the maintenance period. Normally only the first few characters of the UUID is shown, but if the --full-uuid the command-line option is provided the full-length string will be printed. |
OWNER | The name of the owner of the given maintenance period. |
GROUP | The name of the group owner of the maintenance period. |
START | The date and time when the maintenance period starts. |
END | The date and time when the maintenance period expires. |
HOST/CLUSTER | The name of the cluster or host under maintenance. |
REASON | A short human-readable description showing why maintenance is required. |
Examples
Create a maintenance period for PostgreSQL node 10.35.112.21, starting at 05:44:55 AM for one full day (cmon expects UTC time to create a maintenance):
$ s9s maintenance \
--create \
--nodes=10.35.112.21:5432 \
--begin=2024-05-15T05:44:55.000Z \
--end=2024-05-16T05:44:55.000Z \
--reason='Upgrading RAM' \
--batch
Create a new maintenance period for 192.168.1.121 which shall start tomorrow and finish an hour later:
$ s9s maintenance --create \
--nodes=192.168.1.121 \
--begin="$(date --date='now + 1 day' --utc '+%Y-%m-%d %H:%M:%S')'" \
--end="$(date --date='now + 1day + 1 hour' --utc '+%Y-%m-%d %H:%M:%S')" \
--reason="Upgrading software."
List out all nodes that are under maintenance period:
$ s9s maintenance --list --long
ST UUID OWNER GROUP START END HOST/CLUSTER REASON
-h 70346c3 dba admin 07:42:18 08:42:18 10.0.0.209 Upgrading RAM
Total: 1
Delete a maintenance period for UUID 70346c3:
$ s9s maintenance --delete --uuid=70346c3
Check if there is any ongoing maintenance period for cluster ID 1:
$ s9s maintenance --current --cluster-id=1
Check the next maintenance period scheduled for node 192.168.0.227 for cluster ID 1:
$ s9s maintenance \
--next \
--cluster-id=1 \
--nodes="192.168.0.227"