Vault - keepalived_notify.sh (state file)
Vault Solution · Config document · referenced from Load balancer
A two-line script Keepalived calls on every state change. It overwrites one file with the last transition, so an operator or a monitoring item can ask a node which role it holds without parsing logs.
| Item | Value |
|---|---|
| Path on the host | /usr/local/bin/keepalived_notify.sh |
| Owner and mode | root:root, 0500 |
| Deployed on | both load-balancer nodes of every cluster |
| Called by | notify in keepalived.conf |
| Writes | /var/run/keepalived_status |
The file
#!/bin/bash echo "$(date) - $1 $2 has transitioned to the $3 state with a priority of $4" > /var/run/keepalived_status
Arguments
| Argument | Value |
|---|---|
$1 | INSTANCE or GROUP |
$2 | Name of the instance, here haproxy_service |
$3 | New state: MASTER, BACKUP or FAULT |
$4 | Priority |