Today when looking at a couple of projects on a ZFS 7320 Storage Appliance I noticed on one project that one of its replication actions had failed, as I hadn't checked the Recent Alerts log yet I was not aware of this.
I decided to write a small script to check if there were others that had failed.
Nothing fancy, just a loop through all projects, look at the project's replication child and compare the values of the last_sync and last_try properties and print the result if they're not equal. (There are probably more sensible ways of doing this, but at least it involves me getting the chance to put on my headphones and doing just a little bit of coding.)
script
// this script will locate failed project level replication
// it will look at the sync times for 'last_sync' and 'last_try'
// and compare these, if they deviate you should investigate.
// NOTE! this code is offered 'as is' Run at your own risk,
// it will probably work as intended, but in now way can I
// (or Oracle) be held responsible if your server starts behaving
// like a three year old kid in a candy store.. (not that mine do,
// they are very well behaved boys...)
run('configuration');
run('storage');
printf('Host: %s, pool: %s\n', get('owner'),get('pool'));
run('cd /');
run('shares');
proj=list();
printf("total projects: %d\n",proj.length +'\n');
// just for project level replication
for(i=0;i<proj.length;i++){
run('select '+proj[i]);
run('replication');
//get all replication actions
preps = list();
for(j=0;j<preps.length;j++){
run('select ' + preps[j]);
last_sync = get('last_sync');
last_try = get('last_try');
// printf("target %s\n", get('target')); //why the flip does this not get the proper name?
if(!( last_sync.valueOf() === last_try.valueOf())){
printf("sync has failed for %s %s\n", proj[i], get('target'));
}else{
// printf("OK %s %s\n", proj[i], get('target'));
}
run('done'); //done with the replica action
}
run('done');
run('done');
}
printf("finished\n");
For a more on how to run the script, or testing it please look at my previous post.
Sample output:
Host: elb1sn01, pool: exalogic
total projects: 45
sync has failed for ACSExalogicSystem cb3a24fe-ad60-c90f-d15d-adaafd595639
finished