-if ( $state == $ERRORS{'CRITICAL'} ) {
- print "CRITICAL - Device(s) $msg have failed\n";
-} elsif ( scalar @resyncing > 0 ) {
+if (scalar @failed > 0) {
+ if (scalar @failed == 1) {
+ print "CRITICAL - Device $failed[0] has failed.\n";
+ } else {
+ print "CRITICAL - Devices ".join(", ", @failed)." have failed.\n"
+ };
+ exit $ERRORS{'CRITICAL'};
+} elsif (scalar @resyncing > 0 ) {