NAME
Monitoring::Sneck::Checks::vrrp - checks keepalived, freevrrpd, or FreeBSD's CARP being MASTER or BACKUP as it should
VERSION
Version 0.0.1
SYNOPSIS
vrrp|perl:vrrp
vrrp_primary|perl:vrrp -s master
vrrp_mixed|perl:vrrp -m VI_WEB -b VI_DB
carp|perl:vrrp -m em0:1 -b 2
freevrrpd|perl:vrrp -T freevrrpd -s master
DESCRIPTION
Checks the state of each VRRP instance of keepalived, each VRID of freevrrpd, or each CARP vhid on FreeBSD, catching a failover no one saw, or one that never failed back.
- CRITICAL :: A state other than MASTER or BACKUP, such as FAULT, INIT, or PARTIAL. One not in the state --master, --backup, or --state says it should be in. One named by --master or --backup that is not there. keepalived or freevrrpd not running.
- UNKNOWN :: keepalived not being able to be signalled, as when not run as root, or not writing its state out. freevrrpd.conf not being readable.
- OK :: Everything else, including there being nothing to check.
Without --master, --backup, or --state, either of MASTER or BACKUP is fine, so only FAULT and the like are caught.
A line for each follows the status line, with its interface, ID, and priority, or advskew for CARP, and addresses for freevrrpd.
keepalived
keepalived only says what state it is in when sent USR1, at which it writes /tmp/keepalived.data. So the PID in /run/keepalived.pid, or /var/run/keepalived.pid, is sent that, and the file read once it has been written anew, which is waited on for up to three seconds. This needs root. Instances are named as in keepalived.conf.
CARP
Read from ifconfig -a, so root is not needed. A vhid is named by its interface and number, such as em0:1. --master and --backup also take just the number, which is then every interface with that vhid. FreeBSD only.
freevrrpd
freevrrpd has no way of being asked its state. What it does as MASTER is hold the addresses of the VRID, so each VRID in /usr/local/etc/freevrrpd.conf is MASTER if every one of its addresses is on a interface that is up, going by ifconfig -a, BACKUP if none are, and PARTIAL if only some are. A VRID still starting up, or one freevrrpd gave up on, looks like BACKUP.
It is running if the PID in /var/run/freevrrpd.pid is. Root is only needed if freevrrpd.conf, which may have passwords in it, is not readable otherwise. A VRID is named by its interface and serverid, such as em0:1, or just the serverid, as for CARP. FreeBSD only.
OPTIONS
- -T, --type :: What to check, keepalived, freevrrpd, or carp. Default :: carp on FreeBSD, else keepalived
- -m, --master :: A instance, VRID, or vhid that must be MASTER. May be given more than once.
- -b, --backup :: A instance, VRID, or vhid that must be BACKUP. May be given more than once.
- -s, --state :: The state, master or backup, the ones not named by --master or --backup must be in.
METHODS
check
Does the check.
keepalived_instances
Has keepalived write its state out and reads its VRRP instances from it, see "keepalived".
Returns undef if keepalived is not running, else a array ref of hash refs of...
- name :: The instance, as in keepalived.conf.
- state :: MASTER, BACKUP, FAULT, and so on.
- detail :: The line about it for after the status line.
Dies if it can not be signalled or does not write its state out.
carp_instances
Reads the CARP vhids from ifconfig -a.
Returns a array ref of hash refs as for "keepalived_instances", name being the interface and vhid, such as em0:1, with also...
- alias :: The vhid alone.
Dies if not on FreeBSD or ifconfig fails.
freevrrpd_instances
Works out the state of each VRID in freevrrpd.conf from the addresses ifconfig -a shows, see "freevrrpd".
Returns undef if freevrrpd is not running, else a array ref of hash refs as for "carp_instances", name being the interface and serverid, and state MASTER, BACKUP, or PARTIAL.
Dies if not on FreeBSD, freevrrpd.conf can not be read, or ifconfig fails.