- Code: Select all
# ZPOOL MONITOR ->
0 * * * * ~/bin/zpadmin_modified.pl
# ZPOOL WEEKLY SCRUB ->
0 1 * * 1 ~/bin/zpadmin_modified.pl -scrub
I put the script in ~/bin - and note that the script can be run as a non-root user, for the security inclined.
Also do remember to make the script executable!
- Code: Select all
chmod +x zpadmin_modified.pl
and here's the diff from the standard bigadmin zpadmin script, which I found here, since Sun's bigadmin no longer seems to be hosted by Oracle: ftp://ftp.scn.rain.com/pub/solaris/zpadmin.txt
(This was originally released under this license: http://web.archive.org/web/20100715080220/http://www.sun.com/bigadmin/common/berkeley_license.jsp)
- Code: Select all
--- zpadmin.pl 2012-09-26 15:26:59.000000000 -0400
+++ zpadmin_modified.pl 2012-10-09 13:17:03.000000000 -0400
@@ -18,7 +18,7 @@
use Net::SMTP;
use Sys::Hostname;
-my $log_path="/nfs/zpool_adm_log";
+my $log_path="/var/log/zpool_adm_log";
my $hostname = hostname;
sub log_event {
@@ -41,7 +41,7 @@
sub get_zp_list {
# zpool list -H -o name
- my $pool_names = `zpool list -H -o name`;
+ my $pool_names = `/usr/sbin/zpool list -H -o name`;
if ($pool_names eq "no pools available\n") {
return $pool_names;
}
@@ -52,7 +52,7 @@
sub get_zp_health {
# zpool list -H -o health $pool_name
my $pool_name = shift;
- my $result = `zpool list -H -o health $pool_name`;
+ my $result = `/usr/sbin/zpool list -H -o health $pool_name`;
chomp $result;
return $result;
}
@@ -66,7 +66,7 @@
sub scrub_pool {
# zpool scrub $pool_name
my $pool_name = shift;
- system("zpool scrub $pool_name") == 0 or
+ system("/usr/sbin/zpool scrub $pool_name") == 0 or
die "zpool scrub $pool_name failed: $?";
my $result = $? >> 8;
@@ -108,7 +108,7 @@
}
#START PROCESS>>>
-if ( ! -f "/sbin/zpool") {
+if ( ! -f "/usr/sbin/zpool") {
print "zpools not supported in this sun release.\n";
exit 1;
}