#!/usr/bin/perl

# $id: check_zones.pl,v 1.0 2008/11/29 16:00 Farhan Ahmed Exp $
# version 1.0
# Nagios Solaris 10 Zones checker
# If have any questions please contact farhhanahmed@hotmail.com
#

use strict;

my $status;

my @zones = qx {zoneadm list -ip};

foreach (@zones) {

my($id,$name,$state) = split(/:/,$_);

if($state eq "running") {
print "OK: zone $name is in running state ";
}

else{
print "CRITICAL: Zone $name is in $state ";
$status = 2;
}
	}

if($status == 2) {
exit 2;
}
