Skip to main content

Power

Reboot or shut down the host. osapi dsl behavior get --name power and osapi dsl behavior method get show the same.

Behavior​

Namepower
DescriptionReboot or shut down the host
Placementnode
Areanode
Internalno
APIyes
CLIyes
Nextno
Platformsdebian
Sudonone
Runsnone
Writesnone
Keeps stateno
Usesnone
Used bynone

Methods (2)​

NAMEVERBHTTPROUTEPERMISSIONDESCRIPTION
rebootwritePOST/api/node/{hostname}/power/rebootpower:writeReboot the host
shutdownwritePOST/api/node/{hostname}/power/shutdownpower:writeShut the host down

Types (2)​

NAMEINPUTOUTPUT
rebootInput { delay, message }Result { action, delay, changed }
shutdownInput { delay, message }Result { action, delay, changed }

Settings (0)​

None. Declare them with behavior.Config.

Telemetry​

Spanbehavior.power.<method>
Child spansexec shutdown
Metricsosapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total
Attributesosapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed
Recorded inputsdelay (reboot, shutdown)

Method reboot​

Namereboot
Verbwrite
DescriptionReboot the host
DetailRuns shutdown -r -- +N, with N the delay in whole minutes and at least one, so the agent can answer before the host goes down. A message goes to the logged-in users. Each run changes the host.
HTTPPOST
Route/api/node/{hostname}/power/reboot
Permissionpower:execute
Commandosapi client node power reboot
Input typeInput
Output typeResult

Input (2)​

FIELDTYPEREQUIREDCONSTRAINTSDESCRIPTION
delayintegernomin 0Seconds before the host goes down. It rounds to whole minutes, at least one.
messagestringnoA message to the logged-in users first.

Output (3)​

FIELDTYPEDESCRIPTION
actionstringreboot or shutdown
delayintegerSeconds before the host goes down.
changedbooleanAlways true: each run changes the host.

Examples (2)​

EXAMPLEINPUTOUTPUT
In one minute(none)action=reboot, delay=60, changed=true
In five minutes, with a messagedelay=300, message=maintenanceaction=reboot, delay=300, changed=true

Method shutdown​

Nameshutdown
Verbwrite
DescriptionShut the host down
DetailRuns shutdown -h -- +N, with N the delay in whole minutes and at least one, so the agent can answer before the host goes down. A message goes to the logged-in users. Each run changes the host.
HTTPPOST
Route/api/node/{hostname}/power/shutdown
Permissionpower:execute
Commandosapi client node power shutdown
Input typeInput
Output typeResult

Input (2)​

FIELDTYPEREQUIREDCONSTRAINTSDESCRIPTION
delayintegernomin 0Seconds before the host goes down. It rounds to whole minutes, at least one.
messagestringnoA message to the logged-in users first.

Output (3)​

FIELDTYPEDESCRIPTION
actionstringreboot or shutdown
delayintegerSeconds before the host goes down.
changedbooleanAlways true: each run changes the host.

Examples (2)​

EXAMPLEINPUTOUTPUT
In one minute(none)action=shutdown, delay=60, changed=true
In five minutes, with a messagedelay=300, message=maintenanceaction=shutdown, delay=300, changed=true