Slaughter Variables

slaughter allows you to write your policies in a combination of pure-perl, and a set of primitive functions it provides. These primitives are augmented by variables which are discovered/set at run-tim.

This page documents the standard variables which are provided, but you should note that the variables are determined at run-time based upon your own local system so yours might differ.

Dumping Variables

To see which variables, and information, has been collected about your own system you can run:

slaughter --dump

(You may run this without being root).

Using Variables

You have two choices when it comes to using the variables in your policies:

  • Using them from the global name-space.
  • Using them from the global %template hash.

For example the variable "fqdn" is thus accessible via either of these:

print $fqdn . "\n";

print $template->{'fqdn'} . "\n";


The following variables are available:

archEither i386 or amd64, depending upon the type of the system.
bits32 or 64 depending on the client system.
domainThe domain portion of the hostname.
fqdnThe fully qualified (long) hostname of the client system.
hostnameThe short (unqualified) hostname of the client system.
kernelThe version of the kernel running upon the client system.
kvm1 if the guest is a KVM guest.
load_average_1Load average for the past one minute.
load_average_5Load average for the past five minutes.
load_average_15Load average for the past fifteen minutes.
raid1 if some form of RAID was detected.
releaseThe symbolic name of the current distributions release, via LSB.
serverThe name of the server the client is running against.
softwareraid1 if software RAID was detected.
verbose0 or 1 depending on whether the slaugher run was launched wiht --verbose
xen1 if the guest is a Xen system (domU or dom0).

In addition to these variables IP addresses are also dynamically determined - both IPv6 and IPv4. There are two variables setup:

  • $ip_count
    • The count of (IPv4) IP addresses.
  • $ip6_count
    • The count of IPv6 IP addresses.

You can loop through the addresses with code such as this:

my $count = 1;
while ($count < $ip6_count )
   print "IPv6 address $count is : $template->{'ip6_$count'}\n";
   $count += 1;

i.e. The variable "$ip_1" is setup for the first IP address, the variable $ip6_1 contains the first IPv6 address, etc.