I found a script on the internet that kind of meets my needs of finding a script to determine if a linux machine has a staled NFS Mount Point. I tweeked the script a little bit to fit my environment and I have came up with the below script. I was successfully able to run the script locally on the machine but when I use SAM to run the script, I get
Get Output Failed:
Can't identify dynamic column definitions from script output. Please, check if script output has properly formatted unique identifiers.
Has anyone also tried creating this script and found a better way to determine if an NFS mount point is stalled, or if anyone with better perl scripting experience in SAM can point out my mistake, I would greatly appreciate it. Thanks in advance.
#!/usr/bin/perl
# Usage: check_nfs_client
# Description:
# This script determines whether there
# are stale NFS mounts on the host.
open FD,">/tmp/nfsCheck";
print FD "#!/bin/bash\ncd \$1 || { exit 0; }\nexit 0;\n";
close FD;
$dirs = `mount | grep " type nfs " | awk '{print \$3}'`;
foreach $mtpt (split(/\n/,$dirs)) {
system("/tmp/nfsCheck $mtpt &");
system("sleep 0.3");
chomp($proc = `ps -ef | grep nfsCheck | grep -v grep | awk '{print \$2}'`);
if ("$proc" ne "") {
print "NFS CRITICAL: Stale NFS mount point - $mtpt.\n";
system("kill -9 $proc");
exit 1;
}
}
print "NFS OK: All mounts available.\n";
exit 0;