Sample custom signature script
The following is an example of a custom signature script for policy checks in Veritas InfoScale Operations Manager.
Note: The following sample script is created using PERL.
\#!/opt/VRTSsfmh/bin/perl
BEGIN { @INC = ("/opt/VRTSsfmh/lib/modules"); }
use strict;
if ($ARGV[0] eq "--what")
{
print "CHECK_ID: PC_VXVM_UNUSED_VOLUMES\n";
print "CHECK_NAME: VxVM Unused Volumes\n";
print "CHECK_DESCRIPTION: Check to see if any VxVM volumes are unused.\n";
print "CHECK_KEYWORDS: UTILIZATION,UNIX,VXVM\n";
exit (0);
}
if($^O =~ /Win32/i)
{
print "RESULT_RC=100\n";
print "RESULT_TXT=Windows host detected\n";
print "RESULT_REMEDY=This check is intended only for unix hosts\n";\
exit(100);
}
my $exitcode = 0;
my @items = `/opt/VRTSsfmh/bin/vxlist -t stats vol`;
my $iocount = {};
foreach (@items) {
if(/^vol\s+(\S+)\s+(\S+)\s+(read|write)\s+(\S+)\s+/) {
my $name = $2."/".$1;
$iocount->{$name} += $4;
}
}
foreach (keys %$iocount) {
if($iocount->{$_} == 0) {
/(\S+)\/(\S+)/;
print "RESULT_RC=2\n";
print "RESULT_TXT=VxVM volume $2 in disk group $1 may be unused.
It has performed no I/O since last reboot.\n";
print "RESULT_REMEDY=There may be data on the volume, such as an unmounted file system.
If not, space can be reclaimed by deleting the volume,\n";
$exitcode = 2;
}
}
exit($exitcode);
More Information
Related information