notification for RAID state change.

Peter L. Berghold Peter at berghold.net
Tue Feb 27 16:16:13 CET 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

abid dar wrote:
> I wanted to know if there was NRPE plugin to check it the state of systems RAID has changed. 
> 


Last time I had to deal with that issue I wrote my own plugin in Perl.
The device in question was a NAS appliance that had a web based
administrative interface (no log files.. no command line.. nothing.)

Using LWP::UserAgent I would "screen scrape" the HTML output looking for
RAID status changes using an administrative host as a "proxy" to
Netsaint.  (I'd use the same technique on Nagios.)

For Veritas LVM I'd probably use the same technique except that LVM has
command line stuff that I can access and process the output from command
line for status.

I couldn't lay my hands on my LVM plugin right away, but here is an
example of what I used for Sun's ODS RAID software:

- ---------- 8< snip 8< -------------------------------------------

#!/usr/local/bin/perl

use strict;

$ENV{PATH} = "/usr/bin:/usr/local/bin:/usr/sbin:/usr/opt/SUNWmd/sbin";
my ($md, @errors, @warnings);

if (open(CMD, "metadb 2>&1 |")) {
  while (my $line = <CMD>) {
    if ($line =~ m/^\s*(.*\S)\s+\d+\s+\d+\s+(\S+)\s*$/) {
      my ($flags, $dev) = ($1, $2);
      next if ($dev eq $md);
      $flags =~ s/\s*//g;
      foreach my $x ( "ampcluo" =~ m/./g )
        { $flags =~ s/$x// }
      next unless ($flags);
      push @errors, "metadb: $dev: $flags\n";
      $md = $dev;
    }
  }
  close CMD;

  if (open(CMD, "metastat 2>&1 |")) {
    while (my $line = <CMD>) {
      last if ($line =~ m/^metastat: .*: there are no existing
databases\s+$/);
      if ($line =~ m/^(\S+): /)
        { $md = $1; next }
      if ($line =~ m/^\s+State:\s*(.*\S)\s+$/) {
        push @errors, "$md: $1\n"
          unless ($1 =~ m/^(Okay|Resyncing)$/);
      }
    }
    close CMD;
  }
}

if (open(CMD, "vxprint -hrtq 2>&1 |")) {
  while (my $line = <CMD>) {
    next if ($line =~ m/^\s*$/);
    next if ($line =~ m/IPC failure: Configuration daemon is not
accessible/);
    next if ($line =~ m/\s+ENABLED\s+ACTIVE\s+/);
    next if ($line =~ m/\s+ENA\s+$/);
    next if ($line =~ m/^(Disk|dg|dm)\s/);
    push @errors, $line;
  }
  close CMD;
}

print @errors;
print @warnings;
exit 2 if (@errors);
exit 1 if (@warnings);
exit 0;

- ---------------- 8< snip! 8< -------------------------------------------

- --
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Peter L. Berghold                                     Peter at Berghold.Net
"Those who fail to learn from history are condemned to repeat it."
AIM: redcowdawg        Yahoo IM: blue_cowdawg              ICQ: 11455958
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org

iD8DBQFF5Es8UM9/01RIhaARAqVEAJ4+1T/FSRQXNHWWtZYEw0WKLmbgngCgpm2M
BkjxWKRkdrfFbjr89ui3Np4=
=j/7K
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Peter.vcf
Type: text/x-vcard
Size: 239 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/users/attachments/20070227/f1db62b5/attachment.vcf>
-------------- next part --------------
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list