wallaby inventory is a useful command for quickly checking up on the health of your pool and answering certain kinds of questions: Which nodes have checked in recently? Which nodes have checked in without being explicitly configured? Which nodes have never checked in?
Recently, I added constraint support to wallaby inventory. That is, instead of listing all nodes, you can choose to list only nodes for which a given Ruby expression is true. These constraints can be simple, like last_checkin < 1.hour_ago (which will find all nodes that have checked in more than one hour ago), or more complex. They are only limited by Ruby’s $SAFE execution: among other things, they cannot modify running classes, perform file I/O, fork new processes, or, because of how QMF is implemented, invoke QMF methods on the node object. However, every QMF property of the node object is available to wallaby inventory constraints. The transcript below provides some examples running against a wallaby agent loaded up with test data.
Some examples of the new constraint support in the Wallaby inventory tool
# Constraints can make use of simple syntactic sugar for specifying times.
wallaby:master!? % wallaby inventory -c "not last_checkin.is_never && last_checkin < 2.hours_ago"
node name is provisioned? last checkin
--------- --------------- ------------
Aldridge-Brownhills provisioned Mon Oct 18 11:23:47 -0500 2010
# Constraints can be defined over any property of a node.
wallaby:master!? % wallaby inventory -c "memberships.size == 0"
node name is provisioned? last checkin
--------- --------------- ------------
betty unprovisioned never
bigpool-7b6379dc unprovisioned never
fred provisioned never
test-dev-winxp unprovisioned never
test31.lab.bigpool-domain unprovisioned never
wilma unprovisioned never
wallaby:master!? % wallaby inventory -c "name =~ /yel/"
node name is provisioned? last checkin
--------- --------------- ------------
cystopyelonephritis provisioned never
encephalomyelopathy provisioned never
meningomyelorrhaphy provisioned never
polioencephalomyelitis provisioned never
yellow-complexioned provisioned never
yellowish-red-yellow provisioned never
# Constraints can be arbitrarily complex, but they run under Ruby $SAFE level 4,
# which means that they cannot call QMF methods.
wallaby:master!? % wallaby inventory -c "last_checkin.is_never && (name =~ /wa/ || name =~ /lla/ || name =~ /by/)"
node name is provisioned? last checkin
--------- --------------- ------------
Boulogne-Billancourt provisioned never
Mentor-on-the-Lake-Villag provisioned never
Pseudo-presbyterian provisioned never
alto-cumulus-castellatus provisioned never
by-doingby-drinking provisioned never
east-northeastwardly provisioned never
hyperpolysyllabically provisioned never
labyrinthibranchiate provisioned never
main-topgallantmast provisioned never
maxillopremaxillary provisioned never
milk-and-wateriness provisioned never
miscellaneousnesses provisioned never
north-northeastward provisioned never
north-northeastwardly provisioned never
north-northeastwards provisioned never
north-northwestward provisioned never
north-northwestwardly provisioned never
north-northwestwards provisioned never
pseudo-Presbyterian provisioned never
south-southeastward provisioned never
straightforwardness provisioned never
unstraightforwardness provisioned never
west-southwestwardly provisioned never
westnorthwestwardly provisioned never zygomaticomaxillary provisioned never