You can generate machine parseable information by using the ipmpstat -P syntax. The -P option is intended to be used particularly in scripts. Machine-parseable output differs from the normal output in the following ways:
Headers are omitted.
Fields are separated by colons (:).
Fields with empty values are empty rather than being filled with the double dash (--).
In the case of multiple fields being requested, if a field contains a literal colon (:) or back slash (\), these can be escaped or excluded by prefixing these characters with a back slash (\) .
To correctly use the ipmpstat -P syntax, observe the following rules:
Use the -o option fields together with the -P option.
Never use -o all with the -P option.
Ignoring either one of these rules will cause ipmpstat -P to fail.
To display in machine parseable format the group name, the failure detection time, and the underlying interfaces, you would type the following:
$ ipmpstat -P -o -g groupname,fdt,interfaces itops0:10.00s:subitops0 subitops1 acctg1::[hme0 hme1] field2:20.00s:fops0 fops3 (fops2) [fops1] |
The group name, failure detection time, and underlying interfaces are group information fields. Thus, you use the -o -g options together with the -P option.
This sample script displays the failure detection time of a particular IPMP group.
getfdt() { ipmpstat -gP -o group,fdt | while IFS=: read group fdt; do [[ "$group" = "$1" ]] && { echo "$fdt"; return; } done }